Closed BenjaminNavarro closed 4 years ago
Now, in order to convert between format, I need to be able to output URDF/YAML files from the RBDyn data structures. This leads to some issues:
Sorry I forgot to answer about this...
Isn't the simplest solution to use the parser result to do the conversion rather than adding extra information to RBDyn classes?
Hi @BenjaminNavarro any updates on this?
Sorry, not yet. I've been busy with other higher priority stuff lately. I'll try to get back to it this month
Just to let you know that I'm finally back on this. I just rebased my branch on master and I'll start looking into @gergondet comments.
I think this PR will only contain the parsers and then I'll make new ones for the YAML/URDF generators and for some core modifications we made in our own version of RBDyn
Ok so the integration of the parsers is done and both tests pass.
In addition to mc_rbdyn_urdf
and the YAML parser here are a few things that were added/improved:
Mesh
: Box
, Cylinder
, Sphere
and Superellipsoid
from_urdf
, from_yaml
and from_file
. The two first ones can either load the description from a string or load it form a file. The last one automatically checks the file extension to chose which format to parseI need to look at the Python bindings now.
The CI fails because of the missing dependencies. Should I also take care of this? I can also make the BUILD_PARSERS
CMake option default to off.
The CI fails because of the missing dependencies. Should I also take care of this? I can also make the BUILD_PARSERS CMake option default to off.
I have pushed a patch to take care of that. Hopefully it will go well :)
Removed some UB and possible exceptions when accessing boost::variant
Out of curiosity, do you recall what were the specific changes?
Support for the following shapes in addition to the existing Mesh: Box, Cylinder, Sphere and Superellipsoid
Superllipsoid
is not part of the URDF format afaik, could you link some reference on the excepted parameters of the tag? (e.g. in doxygen)
Three free functions to load models: from_urdf, from_yaml and from_file. The two first ones can either load the description from a string or load it form a file. The last one automatically checks the file extension to chose which format to parse
I think I prefer to have from_urdf(content, ...)
and from_urdf_file(file, ...)
rather than an overload with a tag to distinguish the two (and that will make the bindings much simpler to write as well)
It's getting late here so I'll have a closer look at it tomorrow but it looks like you haven't addressed some of the comments regarding the CMake scripts themselves. Otherwise, probably all good :)
Removed some UB and possible exceptions when accessing boost::variant
Out of curiosity, do you recall what were the specific changes?
basically replacing things like:
auto& mesh = boost::get<Geometry::Mesh>(v.geometry.data);
mesh.filename = meshDom->Attribute("filename");
v.geometry.data = mesh;
with:
auto mesh = Geometry::Mesh();
mesh.filename = meshDom->Attribute("filename");
v.geometry.data = mesh;
Since it assumes that a Geometry::Mesh
is the current active member of the variant, which might not be the case.
Support for the following shapes in addition to the existing Mesh: Box, Cylinder, Sphere and Superellipsoid
Superllipsoid
is not part of the URDF format afaik, could you link some reference on the excepted parameters of the tag? (e.g. in doxygen)
Not it's not, but since it's part of sch-core and that it can be handy we added it some time ago. Yes, I'll link the wikipedia page which has a nice visual to understand what each parameter is doing.
Three free functions to load models: from_urdf, from_yaml and from_file. The two first ones can either load the description from a string or load it form a file. The last one automatically checks the file extension to chose which format to parse
I think I prefer to have
from_urdf(content, ...)
andfrom_urdf_file(file, ...)
rather than an overload with a tag to distinguish the two (and that will make the bindings much simpler to write as well)
Ok no problem, I will do that
It's getting late here so I'll have a closer look at it tomorrow but it looks like you haven't addressed some of the comments regarding the CMake scripts themselves. Otherwise, probably all good :)
I did, but I really messed up a rebase after that and lost the modifications... Sure, have a nice evening/night
By the way, there is this fixme laying in the code:
// FIXME! Just like visual tags, there can be several collision tags!
Should I take care of it as well? Since fixing it would break the ABI that's probably a good time to address this. Unless there's no real need for it
I wrote that comment when I added the parsing of the <visual>
tags. Concerning collisions, I double checked why I left that FIXME
, and indeed the URDF specification says:
Note: multiple instances of \<collision> tags can exist for the same link. The union of the geometry they define forms the collision representation of the link.
Thus it would be better if the parser supported this. If you don't mind taking care of it that'd be great. Especially considering that I'm planning to add support for the URDF collision primitives in mc_rtc soon :)
Hi,
I've made some small changes/cleanup on the PR and it's good for me atm.
Changes:
rbdyn.parsers.from_urdf_file
(and add bindings for from_file
)BUILD_PARSERS
to BUILD_RBDYN_PARSERS
ParserResult::collision_tf
as this is redundant with the origin in the collection of ParserResult::collision
I still have to make some changes for the debian packaging side.
I'm also thinking of moving all the parsers related code in to the rbd::parsers
namespace, what do you think of it ? @arntanguy @BenjaminNavarro
That's great, thanks a lot!
I don't see any problem in moving all parsers related code to rbd::parsers
.
Ok, I've made the required changes on the packaging side and moved everything parsers related to the rbd::parsers
namespace
Will merge when the CI passes and release v1.2.0
shortly after
It's still work in progress but I wanted a place to discus about the issues I'm facing.
My goal is to integrate the URDF (from mc_rbdyn_urdf) and YAML (my own) parsers directly into the RBDyn repository and to provide facilities to convert between formats.
For the (very short) story, I made the YAML parser because I hate reading XML and even more writing it by hand. So if I need a model for a robot that doesn't have a URDF, I can now write it in YAML instead.
The YAML parser has been extensively tested and provides the same functionalities as the URDF one.
Now, in order to convert between format, I need to be able to output URDF/YAML files from the RBDyn data structures. This leads to some issues:
MultiBody
,MultiBodyConfig
orMultiBodyGraph
. For instance, joint limits are stored separately from theJoint
class. This means that either we include them in theJoint
class or we need to ask users to provide them separately. Modification of theJoint
class can be made API backward compatible but not ABI backward compatible since new member variables must be added. The same goes forvisual
,collision
andcollision_tf
fromParserResult
that could be stored within theBody
class instead.parent
,child
andframe
components of the joints are not easy to get. So far, I couldn't find a proper way of extracting these information after the creation of the graph, but I'll keep looking.