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

Discrepancy in mass calculation from mesh #1472

Closed
vaxenburg opened this issue Mar 4, 2024 · 2 comments
Closed

Discrepancy in mass calculation from mesh #1472

vaxenburg opened this issue Mar 4, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@vaxenburg
Copy link
Contributor

I'm seeing a significant difference in mass calculation from meshes in two different MuJoCo versions. Here is a minimal example:

from dm_control import mjcf

xml = """
<mujoco>
    <asset>
        <mesh name="thorax" file="thorax_body.msh"/>
    </asset>
    <worldbody>
        <body name="thorax">
           <geom name="thorax" type="mesh" mesh="thorax" density="0.478"/>
        </body>
    </worldbody>
</mujoco>
"""

physics = mjcf.Physics.from_xml_string(xml)
mass = physics.named.model.body_mass['thorax']

print(mass)
# Prints 0.20764519675374468 in mujoco 2.3.1
# Prints 0.22578387429620797 in mujoco 3.1.2

This particular thorax_body.msh mesh can be found here, but the issue is not specific to this mesh and probably any mesh would do.

Any ideas would be very helpful!

@vaxenburg vaxenburg added the bug Something isn't working label Mar 4, 2024
@quagla
Copy link
Contributor

quagla commented Mar 5, 2024

This is caused by the change

ffca553

The old computation inferred the volume of the object from the inertia box whereas we now use the actual volume for computing the mass. Apologies if this was not documented in the changelog.

@quagla quagla closed this as completed Mar 5, 2024
copybara-service bot pushed a commit that referenced this issue Mar 5, 2024
Fixes #1472.

PiperOrigin-RevId: 612787350
Change-Id: Ia5609266462b5d537ce0c03efa764f1f32bc9389
traversaro pushed a commit to traversaro/mujoco that referenced this issue Mar 5, 2024
Fixes google-deepmind#1472.

PiperOrigin-RevId: 612787350
Change-Id: Ia5609266462b5d537ce0c03efa764f1f32bc9389
@vaxenburg
Copy link
Contributor Author

Thank you! This is good to know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants