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

Error with CalcPrincipalMomentsAndMaybeAxesOfInertia in Simple Example #21924

Closed
cohnt opened this issue Sep 17, 2024 · 4 comments · Fixed by #21929
Closed

Error with CalcPrincipalMomentsAndMaybeAxesOfInertia in Simple Example #21924

cohnt opened this issue Sep 17, 2024 · 4 comments · Fixed by #21929
Assignees
Labels

Comments

@cohnt
Copy link
Contributor

cohnt commented Sep 17, 2024

What happened?

I have a single obj model that I'm trying to load into the world, but I'm getting the following error message when I process the associated model directives:

    models = ProcessModelDirectives(directives, plant, parser)
RuntimeError: CalcPrincipalMomentsAndMaybeAxesOfInertia(): Unable to calculate the eigenvalues or eigenvectors of the 3x3 matrix associated with a RotationalInertia.

I tried printing out the matrix whose eigenvalues were being computed, and all entries were nan.

This gist has a simple reproduction of the bug.

Version

No response

What operating system are you using?

No response

What installation option are you using?

No response

Relevant log output

No response

@jwnimmer-tri jwnimmer-tri added the component: multibody parsing Loading models into MultibodyPlant label Sep 17, 2024
@mitiguy
Copy link
Contributor

mitiguy commented Sep 17, 2024

FYI: I checked the geometry in the file test.obj with one of my CAD programs.
It displayed something strange -- picture attached.
It also displays NAN for inertia properties.
If the geometry is poorly formed, perhaps we could issue a better error message?
test_obj_Viewd_in_SimWise

@cohnt
Copy link
Contributor Author

cohnt commented Sep 18, 2024

I've confirmed that fixing the direction of the faces no longer leads to an error. New test.obj attached below.

Having a better error message would be very helpful in this case -- I would have never thought that having faces in the wrong direction would lead to inertia errors.

g test

v 0.000000 0.000000 0.500000
v 0.000000 0.000000 -0.500000
v 0.000000 1.000000 0.500000
v 0.000000 1.000000 -0.500000
v 1.000000 0.000000 0.500000
v 1.000000 0.000000 -0.500000

f 1 5 3
f 2 4 6
f 1 3 2
f 2 3 4
f 3 5 4
f 4 5 6
f 5 1 6
f 6 1 2

@mitiguy
Copy link
Contributor

mitiguy commented Sep 19, 2024

@cohnt PR #21929 is meant to produce a better error message.
Feel free to provide guidance or comments here or there.
As of now, the error message is something like:
"CalcSpatialInertia(): The calculated volume of a triangle surface mesh is 0 whereas a reasonable positive value was expected. The mesh may have bad geometry, e.g., the winding (order of the vertices) of some faces do not produce outward normals."

@cohnt
Copy link
Contributor Author

cohnt commented Sep 20, 2024

Yes, that error message is very helpful. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants