Allow setting decimals of numerical values when exporting the URDF - #155
Conversation
Summary of ChangesHello @flferretti, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the URDF export functionality by introducing a new configuration option that allows users to define the numerical precision of values within the generated URDF file. This feature addresses the need for consistent and controlled decimal representation in robot models, which can be critical for simulation accuracy or compatibility with other systems. The implementation involves reading the precision setting from the configuration and applying it through a post-processing step that meticulously reformats numerical attributes across various URDF elements using XML parsing. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces functionality to control the numerical precision of values when exporting URDF files. This is a valuable addition for users who need fine-grained control over the output format. The implementation includes parsing a new configuration parameter, validating its range, and applying the precision using XPath to modify the generated XML. Documentation in README.md has been updated to reflect this new feature. Overall, the changes are well-structured and address the stated objective.
Nicogene
left a comment
There was a problem hiding this comment.
@flferretti thank you for the contribution!
If I understood correctly you are formatting the numerical precision at the level of XML (URDF), isn't there an exporter option in iDyntree that allows to do this? (cc @traversaro)
If not it is ok what you did
I was not aware of this, thank you! I'll check on idyntree if I can find that option EDIT: I couldn't find anything useful, maybe Silvio can give us more info |
No, the We can easily add a The main advantages of doing this in iDynTree and then just expose the parameter are that any logic added to
|
|
I don't know if @traversaro @flferretti are you planning to add this functionality to iDyntree, I agree it would be much clean and easy to maintain, otherwise if @flferretti you have tested that it works, it is ok for me to merge this PR as it is |
I can work on the iDynTree side next week and update this PR |
Great! The only drawback I see is that we should need also un update of idyntree vcpkg version that includes this new feature (@traversaro) |
|
I've opened gbionics/idyntree#1293 |
|
Great @flferretti ! Remember to update: To |
4e7d406 to
5746d62
Compare
|
@Nicogene I can drop the outdated commits with a force push or if you prefer to squash, for me it's fine |
Great, let's await that: is merged and we can merge as well |
Co-authored-by: Silvio Traversaro <silvio@traversaro.it>
|
The vcpkg pr was merged. |
With this PR, it will be possible to set a number of decimals when exporting the URDF. E.g.:
I have no way to test this in Creo since I'm on Linux. I did a rough test copying the functions to a test file and compiling it:
test_precision.cppCMakeLists.txtC.C. @FabioBergonti