rbdl / rbdl-toolkit

Application for visualizing and working with rbdl models
European Union Public License 1.2
19 stars 11 forks source link

Error loading URDF models #13

Closed jfslin closed 3 years ago

jfslin commented 3 years ago

I am trying to use rbdl-toolkit to perform IK, but have been unable to figure out how to proceed. I have separated this into 2 issues:

Tried two different versions of rbdl-toolkit:

Working with 3 different models (2 of which should be working with rbdl-toolkit already):

Trying built toolkit with the three model files:

jf2lin@HCRMIPC002:~/Downloads/rbdl$ rbdl-toolkit --model reemc_uw.urdf 
/usr/local/share/ORB/rbdl-toolkit
jf2lin@HCRMIPC002:~/Downloads/rbdl$ rbdl-toolkit --model iCubHeidelberg01_no_weights.urdf 
/usr/local/share/ORB/rbdl-toolkit
jf2lin@HCRMIPC002:~/Downloads/rbdl$ rbdl-toolkit --model reemc_hd.lua
/usr/local/share/ORB/rbdl-toolkit

Now trying the AppImage toolkit with the three model files:

jf2lin@HCRMIPC002:~/Downloads/rbdl$ ./rbdl-toolkit-x86_64.AppImage --model reemc_uw.urdf 
./rbdl-toolkit-x86_64.AppImage: symbol lookup error: /tmp/.mount_rbdl-teG56tS/usr/bin/../lib/libQt5Widgets.so.5: undefined symbol: _ZN22QGuiApplicationPrivate12addQtOptionsEP5QListI18QCommandLineOptionE, version Qt_5_PRIVATE_API
jf2lin@HCRMIPC002:~/Downloads/rbdl$ sudo !!
sudo ./rbdl-toolkit-x86_64.AppImage --model reemc_uw.urdf 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
/tmp/.mount_rbdl-t9NrI3t/usr/local/share/ORB/rbdl-toolkit
Segmentation fault
jf2lin@HCRMIPC002:~/Downloads/rbdl$ ./rbdl-toolkit-x86_64.AppImage --model reemc_hd.lua 
./rbdl-toolkit-x86_64.AppImage: symbol lookup error: /tmp/.mount_rbdl-t1h1gjT/usr/bin/../lib/libQt5Widgets.so.5: undefined symbol: _ZN22QGuiApplicationPrivate12addQtOptionsEP5QListI18QCommandLineOptionE, version Qt_5_PRIVATE_API
jf2lin@HCRMIPC002:~/Downloads/rbdl$ sudo ./rbdl-toolkit-x86_64.AppImage --model reemc_hd.lua 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
/tmp/.mount_rbdl-tNSc0Or/usr/local/share/ORB/rbdl-toolkit
jf2lin@HCRMIPC002:~/Downloads/rbdl$ sudo ./rbdl-toolkit-x86_64.AppImage --model iCubHeidelberg01_no_weights.urdf 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
/tmp/.mount_rbdl-tl6pNDG/usr/local/share/ORB/rbdl-toolkit

So it seems like the only workable option for me is the reemc_hd lua model, in both the compiled version as well as the AppImage version, but I'm guessing that no model showing up is a bit odd.

ju6ge commented 3 years ago

Okay so there seem to be multiple issues at play here. Firstly URDF Support is really new and I have not have a lot of chances to debug it with multiple different models. So thank you for taking the time to write down you experiences.

Now to the problem of the model not showing up, i have encountered this when the meshes are not found correctly or are using not so widely used mesh file formats. rbdl-toolkit uses Qt3D and therefor supports all mesh file format it supports.

When a mesh file is not found correctly you receive the "No file with filename" error. That is the error you are see in the last case when loading the iCubHeidelberg01_no_weights.urdf with the app image. The filename model://iCub .. uses a special uri schema. This is a big pain point in my opinion when using urdf models. It seams that different people using different tools have all come up with their own uri schema to describe the model root. I already added logic to find files specified as package://. Logically there is no path on your system starting with model://. The easiest solution here is to just use absolute path or paths that are relative to the place where the urdf file is located. The case of the reemc_hd.lua is weird since the toolkit is mostly used to display lua models. But without taking a closer look at the model code itself i can't tell why it is not finding or displaying the meshes correctly. My guess would be that the meshes just use a format that is not support by qt3d because otherwise you should at least get an error that the file could not be found.

Now regarding the toolkit AppImage, you should not need to run it as root. I am guessing that you are using Ubuntu 20.04. The AppImage was build using Ubuntu 18.04. According to the AppImage documention it should therefor run on anything newer. My Main system at home is using Arch and the it works just fine. But I also have seen previous versions of the toolkit AppImage fail on newer Ubuntu versions. Sadly debugging did not lead to a good explanation for why this happens and also the errors where not reproducable on a different machine with the same base operating system. So I am inclined to blame Canonical, but I will be keeping an eye on this going forward since in my opinion using an AppImage is the most sensible way to distribute rbdl-toolkit currently because of its qt version dependencies and also because I don't the time to package it for all the major distros.

I hope this helps. Don't hesitate to ask if you have further questions regarding rbdl-toolkit.

jfslin commented 3 years ago

Thanks for the response. I'm not attached to either Lua or URDF, as long as it works with ROS. I mainly used another dynamics library previously that doesn't use either Lua or URDF, so they're both new to me anyway.

Okay, I understand the pathing problem. However, using the AppImage version

f2lin@HCRMIPC002:~/Downloads/rbdl$ sudo ./rbdl-toolkit-x86_64.AppImage --model /home/jf2lin/Downloads/rbdl/reemc_hd.lua 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
/tmp/.mount_rbdl-tZgiVjQ/usr/local/share/ORB/rbdl-toolkit

still doesn't allow the model to load properly. Using my own compiled version (Ubuntu 20.04, QT 5.13.2)

jf2lin@HCRMIPC002:~/Downloads/rbdl$ rbdl-toolkit --model /home/jf2lin/Downloads/rbdl/reemc_hd.lua 
/usr/local/share/ORB/rbdl-toolkit

also doesn't load the model. Yes, I am on Ubuntu 20.04. I had some other unrelated issues that forced me to upgrade, but if downgrading back to 18.04 is the best way to approach this, I rather get RBDL working first. I am willing to reformat back to 18.04, but if there are things I can help debug if I stay on 20.04, I am happy to help where I can.

I've attached the two REEM C model files I used here. The HD Lua version came from Felix Aller, while the UW URDF version was compiled from the REEM C docker image for the University of Waterloo's REEM C.

reemc.zip

ju6ge commented 3 years ago

Okay so the reemc_hd.lua is a valid lua model, but it does not specify any visuals, meaning there is no mesh information in there and therefor rbdl-toolkit has nothing to display. I attached a model with visuals and model markers so you have an example how to add those ;). model.tar.gz

When loading the reemc_uv.urdf i get a file not found error referring to package://reemc_description/meshes/arm/arm_1.dae do you have those on your system? URDF Models created with gazebo are expected to be in package directory structure. Meaning they are in some subdirectory of a directory containing a package.xml. This directory is then taken as the model root directory from which all paths with uri package:// are resolved. If you don't have that try finding the original source of the model that also contains these meshes.

jfslin commented 3 years ago

I've extracted the the proper _description meshes and tried to load my URDF model for the REEM C. I renamed all the package:// pathing to absolute path and was able to get it to show...something. Seems like there's a few unsupported meshes that didn't render properly.

image

RVSagar commented 3 years ago

Just documenting some testing I did:

I tried to get a minimal URDF (single cylinder) to load in RBDL-Toolkit but there seem to be some issues.

This is the URDF (taken from here) which I named 'cylinder.urdf':

<?xml version="1.0"?>
<robot name="myfirst">
  <link name="base_link">
    <visual>
      <geometry>
        <cylinder length="0.6" radius="0.2"/>
      </geometry>
    </visual>
  </link>
</robot>

In rviz the URDF shows like so:

rviz_cylinder

But in RBDL-Toolkit it gets rendered like so (using ./rbdl-toolkit-x86_64.AppImage --model cylinder.urdf):

rbdl_toolkit_cylinder_urdf

I'll look through the source to understand what's going on, but just thought I'd report. I also seem to get Segmentation fault (core dumped) often when I try loading URDFs. Will investigate further.

ju6ge commented 3 years ago

I fixed the mesh rotation of the cylinder with #24.

For debugging the crashes it would be useful to run the application through gdb. That way it is possible to backtrace at what line in the code the crash happens. Also when running rbdl-toolkit with a self compiled version, you need to make sure to apply the urdf pull request on rbdl-orb. This ensures that rbdl and the toolkit are using the same urdf parser library. The reason the pull request is not merged is that it has not been reviewed yet ;)

RVSagar commented 3 years ago

Thanks for the quick fix! I figured it was probably a rotation issue. And sounds good on the note on the URDF pull request, I'll do that when I'm debugging and developing anything for URDFs

jfslin commented 3 years ago

A follow up the the URDF REEM C model loading - perhaps unsurprisingly given the error message, toolkit doesn't support .dae meshes. Switching them to .stl meshes gets it working. Using random converter online here, I was able to get something to look at. I will convert all the meshes over and at least get a complete REEM C render.

image

jfslin commented 3 years ago

A quick follow up. Replacing all the .dae files with .stl improves the model. It's still missing surfaces, but I think the issue is with the mesh itself.

image

jfslin commented 3 years ago

I'm thinking we can close this issue for now. The original issue was that I wanted to be able to load the REEM C URDF model and I am able to do that now.