ami-iit / rod

The ultimate Python tool for RObot Descriptions processing.
https://pypi.org/project/rod/
BSD 3-Clause "New" or "Revised" License
13 stars 3 forks source link

Enhance processing and URDF export of `//frame` elements #34

Closed diegoferigo closed 1 month ago

diegoferigo commented 1 month ago

This PR:


In the last two year, sdformat received different updates on how URDF models are converted to SDF. In particular, few of them altered how kinematic chains involving massless links (or with tiny masses) are processed. Here below some references for those that want to dig deeper:

TL;DR

This PR bumps the minimum version of sdformat to 12.x such that the processing of such cases is handled in a unique way. Then, in order to prevent the need to install a full Gazebo suite, the minimum sdformat version is raised to 13.x. This version allows to have the gz sdf command line just by installing a small subset of the Gazebo libraries.


Some further details on the logic introduced by this PR:

diegoferigo commented 1 month ago

Ok I guess it's now time to remove support for the sdformat version included in Ubuntu 22.04. cc @traversaro

traversaro commented 1 month ago

Ok I guess it's now time to remove support for the sdformat version included in Ubuntu 22.04. cc @traversaro

That kinds of mean enforcing the installation of gz sim via openrobotics's apt repo in apt and gz-sim with conda-forge on conda-forge, right? Fortunatly both at the moment are side-by-side installable with gazebo classic thanks to:

diegoferigo commented 1 month ago

That kinds of mean enforcing the installation of gz sim via openrobotics's apt repo in apt and gz-sim with conda-forge on conda-forge, right?

Yep!

I don't want to install the whole Gazebo Sim suite just for having the /usr/bin/gz sdf command. I tried to get it using Fortress (sdformat 12.x and gz-tools 1.x), but I couldn't find a way to install only a subset of the libraries. Instead, things work fine with sdformat 13.x and gz-tools 2.x. I propose to support them as minimum versions.

Btw, the working versions are the first ones after the transition from Ignition Gazebo to Gazebo Sim.


Edit: on Fortress it's actually possible to have a minimum installation with only libsdformat12 gz-tools, but the right command line is ign sdf. However, as discussed below, this sdformat supports only the 1.9 SDF specification that at the time of writing does not have all the necessary features to support what ROD require.

traversaro commented 1 month ago

Can you add a few lines on this runtime dependency on sdformat + gz-tools ? As long as the dependency was just any gz command (either gz-tools+sdformat or gazebo classic) I guess it was quite common for users to just have in the system and/or environemnt, while now the the requirement is more specific, it is quite probably that users will get it wrong. By the way, what is the error in case gz from gazebo classic is installed?

diegoferigo commented 1 month ago

Can you add a few lines on this runtime dependency on sdformat + gz-tools?

I plan to update the main README with the new dependencies in another PR. I will also bump Python to 3.10. Furthermore, I'd also like to add these dependencies to the conda-forge recipe of rod so that they get automatically installed.

By the way, what is the error in case gz from gazebo classic is installed?

You can see the test failing here. The sdformat of Gazebo Classic 1) does not convert chains of dummy links to frames and 2) links with zero mass are silently removed.

traversaro commented 1 month ago

I plan to update the main README with the new dependencies in another PR.

Ok.

traversaro commented 1 month ago

You can see the test failing here. The sdformat of Gazebo Classic 1) does not convert chains of dummy links to frames and 2) links with zero mass are silently removed.

So it does not fail on gz invocation, but silently produce the wrong result? Do you think we can make that an hard failure?

diegoferigo commented 1 month ago

So it does not fail on gz invocation, but silently produce the wrong result? Do you think we can make that an hard failure?

I gave it a thought. Initially I was thinking how to check the installed sdformat version either by checking the output of gz sdf --versions or by inspecting the OS. I didn't like both solutions as they are quite fragile.

Then, I realized that the sdformat version is not really relevant. What really matters is the SDF specification. This can be checked more easily by processing a SDF string <sdf version='1.4'> and checking the version of the output (I used 1.4 as the minimum specification listed in the sdformat website).


diegoferigo commented 1 month ago

@traversaro last check? Apparently on Windows files need to properly closed before being opened by another process, therefore I had to pass through a temporary directory when a model description string has to be processed by sdformat.