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

URDF to SDF conversion ignores links with mass smaller than 1e-6 #1007

Closed
traversaro opened this issue May 2, 2022 · 3 comments
Closed

URDF to SDF conversion ignores links with mass smaller than 1e-6 #1007

traversaro opened this issue May 2, 2022 · 3 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed URDF URDF parsing

Comments

@traversaro
Copy link
Contributor

Spin-off of #199 for visibility. Quoting from #199 (comment) :

Original comment by Kaelin (Bitbucket: Kaelin).

I happen to have run into a variant of this issue today and spent a while debugging it. In addition to the case of having not declared an inertia node in the XML at all, this also occurs if you have a mass value which is too small. A mass value of 0.00001 (1e-5) works fine, but if you decrease it to 0.000001 (1e-6), the link is silently omitted. This is pretty dangerous, since it is easy to gloss over an additional 0 when scanning for issues. I saw that having no mass was disallowed, so my natural inclination was to make it some very small number, and happened to hit too many zeroes.

An error in this case, even if massless links aren’t implemented, would be much appreciated.

@traversaro traversaro added the bug Something isn't working label May 2, 2022
@traversaro
Copy link
Contributor Author

traversaro commented May 2, 2022

The issue is due to the following line:

it may not be immediatly clear why the cutoff value is 1e-6, but this come from the fact that the second argument of ignition::math::equal is not specified and by default it is 1e-6:

@azeey
Copy link
Collaborator

azeey commented Mar 23, 2023

Fixed by #1238

@azeey azeey closed this as completed Mar 23, 2023
@aaronchongth
Copy link
Collaborator

Fixed by #1238

More specifically, #1238 does not allow link mass with value of <= 0, without any epsilon values, https://github.com/gazebosim/sdformat/pull/1238/files#diff-2bc5ca23bcfc66fe173f513399bec8065b1cb4e607d741566517d7368e6bce0fR2670

scpeters added a commit that referenced this issue May 10, 2023
When converting from URDF to SDFormat, some links without
an <inertial> block or a small mass may be dropped with only
debug messages in a log file, which are easily missed.
This makes the following changes:

* When a massless link in the middle of a kinematic chain is
  successfully merged to its parent by fixed joint reduction,
  fix bug that was dropping the massless link's child links and
  joints.
* Print no warnings or debug messages when a massless link
  is successfully merged to a parent by fixed joint reduction.
* Promote debug messages to warnings / errors when links
  are dropped to improve visibility. Improve message clarity
  and suggest fixes to the user.
* Change massless threshold test to `> 0` instead of being
  within a 1e-6 tolerance of 0.
* Add unit and integration tests.

Related to #199 and #1007.

(cherry picked from commit 6ffe669)

Signed-off-by: Aaron Chong <[email protected]>
Co-authored-by: Steve Peters <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed URDF URDF parsing
Projects
None yet
Development

No branches or pull requests

4 participants