-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load meshes that are specified using the package://
URDF URI
#291
Comments
Related urdf issue: ros/urdf#30 . |
SDF is evaluating the support for specifying meshes using path relative to the model location: https://bitbucket.org/osrf/sdformat/pull-requests/558/accept-relative-path-in/diff . |
Related PR: leggedrobotics/raisimOgre#25 . |
According to the ROS specification we need to look in
And given Pinocchio license we can just take that code, as long as we keep the existing copyright header. |
I have implemented some code that seems to do the same of https://github.com/stack-of-tasks/pinocchio/blob/9389400a6018e97ec3822796d465a4b801630a1f/src/utils/file-explorer.cpp#L45 in https://github.com/S-Dafarra/dyn-visualizer/blob/master/src/main.cpp#L29-L68 using At this point, we have a list of paths. Then, we can try to open the mesh file by basically trying all the addresses 🤔 |
Note that on Windows the PATH separator is
In theory it should be possible to also understand which folder to use by inspecting the
|
With S-Dafarra/dyn-visualizer@b359c4b I managed to load the meshes without using |
Great! Once we have the right code, the places to update are:
|
Probably we could have a method directly in ExternalMesh to obtain the absolute filename. |
I would like to keep separated the input read from the |
I have tried to consider also the Windows case in S-Dafarra/dyn-visualizer@30c39bc What about adding a class in ModelIO? Something like |
I think it is ok,
The existing code does not seem to have state, perhaps a function may be also be ok? |
I was thinking to allow the possibility to specify also the prefix, and/or to add some search paths, and/or to specify the environmental variables to check. That's why I thought about a class Edit: Thinking about it, indeed, also a function is doable |
That make sense, the tricky part is understand how to make that composable w.r.t. to the use of those functionality in deeply nested code, see #291 (comment) , however this can be done in a second step if the default behaviour is ok to get the visualizer to work with iCub models. |
Good point! Ok, let's keep it simple and stupid 😁 |
Relative PR #798 |
Related bullet issue: bulletphysics/bullet3#3224 . |
Fixed by #798 . |
Similar issue on MuJoCo: google-deepmind/mujoco#1432 . |
We need to correctly process meshes of generated URDF models.
One of the problems to solve is that the URDF format [1] does not describe the semantics of the
filename
attribute, that is used to specify external meshes inCollada
orSTL
format.In practice, most URDF released as part of ROS packages specify the meshes location using the
package://
URI, that are resolved to absolutefilename
s using ROS'resource_retriever
.Clearly this is not a viable strategy for libraries that do not depend on ROS, and want to load arbitrary URDF files. Unfortunately mesh handling without using ROS is not uniform across different libraries.
Some (such as Google's Bullet ) just support meshes specified w.r.t to the model subdirectory using the format
filename="meshes/mesh.dae"
, but I guess a model of that kind would not be supported by ROS tools.For iDynTree, I guess the most reasonable strategy is to add a class that is able to resolve
package://
URIs, with some strategy.A possible basic strategy is to manually specify to the class to (to be completed)
[1] : http://wiki.ros.org/urdf/XML/link
See robotology/icub-models-generator#33 , robotology/icub-models-generator#28 for more info.
The text was updated successfully, but these errors were encountered: