-
Notifications
You must be signed in to change notification settings - Fork 70
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
Add ModelExporter class and add preliminary support for exporting URDF from iDynTree::Model #554
Conversation
b68e41a
to
047ef63
Compare
This dependency is necessary to convert a double to its shortest string exact representation. It can be probably removed as soon as std::to_chars is widely available.
047ef63
to
710961b
Compare
* | ||
* @warning This function does not support exporting sensor or solid shapes at the moment. | ||
* | ||
* @param[in] options the URDFParserOptions struct of options passed to the parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be great to document also the output and default parameters here. Also, if we should specify a relative path or an absolute path of the urdf file. These details are not clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the default options, the user is referred to the iDynTree::ModelExportOptions, that contains docs related to the available and the default options. I will make it clear in the commit to address reviews, let me know if it is enough.
xmlNodePtr child_xml = xmlNewChild(joint_xml, NULL, BAD_CAST "child", NULL); | ||
xmlNewProp(child_xml, BAD_CAST "link", BAD_CAST model.getLinkName(childLink->getIndex()).c_str()); | ||
|
||
// TODO(traversaro) : handle joint limits and friction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be moved also in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this is not mentioned in the description of the pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is still pending
xmlNewProp(robot, BAD_CAST "name", BAD_CAST "iDynTreeURDFModelExportModelName"); | ||
xmlDocSetRootElement(urdf_xml, robot); | ||
|
||
// TODO(traversaro) : We are assuming that the model has no loops, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be mentioned in the documentation, explicitly. Since I notice there are users of iDynTree in the cable robots or parallel mechanisms community as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be in the main readme of idyntree not only in this pr
I thought it was there but I could not find a mention to it now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related issue: #555 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small doubt about the unit test not checking for the sensors
I think it will be helpful if we add an explicit print to console statement in the |
I totally agree with this suggestion, but I expect to implement most of those features before the 0.12 release, so I would prefer to avoid overthinking how to report this problems to the user, as eventually we will need to remove them. If for the 0.12 release we still miss some features, then I would agree to add those error messages. |
Reviews addressed in 15f4848 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small variable name to check and some documentation concerns
ok = ok && exportTransform(Transform(Rotation::Identity(), inertia.getCenterOfMass()), inertial); | ||
|
||
xmlNodePtr inertia_xml = xmlNewChild(inertial, NULL, BAD_CAST "inertia", NULL); | ||
RotationalInertiaRaw rotInertia = i.getRotationalInertiaWrtCenterOfMass(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one was also meant to be inertia
and not i
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That happens when you modify the code and you do not try to recompile it. : )
Thanks for the check.
xmlNewProp(robot, BAD_CAST "name", BAD_CAST "iDynTreeURDFModelExportModelName"); | ||
xmlDocSetRootElement(urdf_xml, robot); | ||
|
||
// TODO(traversaro) : We are assuming that the model has no loops, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be in the main readme of idyntree not only in this pr
I thought it was there but I could not find a mention to it now.
xmlNodePtr child_xml = xmlNewChild(joint_xml, NULL, BAD_CAST "child", NULL); | ||
xmlNewProp(child_xml, BAD_CAST "link", BAD_CAST model.getLinkName(childLink->getIndex()).c_str()); | ||
|
||
// TODO(traversaro) : handle joint limits and friction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is still pending
@fjandrad I am not sure why I cannot directly respond to your comments, anyhow I reply to them here.
It make sense, I opened a new issue for this in #555 .
I already added it in 15f4848#diff-05b37777f3462332b9cce4040d3f16deR69 for the main user facing documentation, and I added it in the specific function private docs in ba04aaa . As far as I know all your comments should be addressed. |
Friendly ping @prashanthr05 @fjandrad . |
A legit problem in the build system on macOS was detected by Travis in https://travis-ci.org/robotology/idyntree/jobs/573683257, and it should be fixed by aaf1dec . |
Friend ping @fjandrad |
aaf1dec
to
a25f21e
Compare
Thannks for the reviews @fjandrad and @prashanthr05 ! |
Add
iDynTree::ModelExporter
class and related tests.Currently the only format supported for export is the URDF format.
Currently the model exporter only exports a subset of the features supported in iDynTree::Model. In particular, the following features are not supported:
The PR is composed by the following two commits:
std::to_chars
My idea is to implement most of the missing features before 0.12 release, but as the limitations are currently documented, I think it make sense to first review this initial PR, and then the other features can be added in future PRs.
This PR is based on the old closed PR #382 .