Skip to content
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 moveLinkFramesToBeCompatibleWithURDFWithGivenBaseLink function #1193

Merged
merged 2 commits into from
Jul 22, 2024

Conversation

traversaro
Copy link
Member

Until now, if you exported a iDynTree::Model that did not respected the URDF constraint of the child link frame origin being on the joint axis, you only got an error during the URDF export process, something like:

[ERROR] URDFModelExport: Impossible to convert joint torso_pitch to a URDF joint without moving the link frame of link torso_1 , because its origin is 1.90735e-10 -0.032 -0.0364

This PR does not modify this behaviour to avoid confusion in the export of URDF, but it adds a new iDynTree::moveLinkFramesToBeCompatibleWithURDFWithGivenBaseLink function to generate a URDF compatible model from a non-URDF compatible model, so for example if a code like:

iDynTree::Model modelToExport;

// ... modelToExport is created

iDynTree::ModelExporter modelExporter;
modelExporter.init(modelToExport);
bool ok = transformedModelExporter.exportModelToFile("/file/name.urdf");

was reporting an error, you can modify it like:

iDynTree::Model modelToExport;

// ... modelToExport is created

// Convert modelToExport in a URDF-compatible model (using the default base link)
iDynTree::Model modelToExportURDFCompatible;

bool ok = iDynTree::moveLinkFramesToBeCompatibleWithURDFWithGivenBaseLink(modelToExport, modelToExportURDFCompatible);

iDynTree::ModelExporter modelExporter;
modelExporter.init(modelToExportURDFCompatible);
ok = ok && transformedModelExporter.exportModelToFile("/file/name.urdf");

to actually export a model that is identical to the original one, but with the link frames moved to comply with URDF constraints.

Fix #847 .

@traversaro
Copy link
Member Author

Please ignore the macos-12 failure that is due to #1192 .

@traversaro traversaro requested a review from Nicogene July 22, 2024 10:58
@traversaro
Copy link
Member Author

This functionality may be of interest of other users of the URDF exporter, for example @francesco-romano .

Copy link
Member

@Nicogene Nicogene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

cc @mfussi66

@traversaro traversaro merged commit 0fddd93 into master Jul 22, 2024
35 of 37 checks passed
@traversaro traversaro deleted the fix847 branch July 22, 2024 12:36
flferretti pushed a commit to flferretti/idyntree that referenced this pull request Dec 23, 2024
…obotology#1193)

* Add moveLinkFramesToBeCompatibleWithURDFWithGivenBaseLink function definition and tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Permit to export as URDF iDynTree::Model models that do not respect URDF convention on link frames
2 participants