google-deepmind / mujoco

Multi-Joint dynamics with Contact. A general purpose physics simulator.
https://mujoco.org
Apache License 2.0
7.47k stars 734 forks source link

Changing the geom mass fails to affect simulation properties? #1717

Closed kurtenkera closed 3 weeks ago

kurtenkera commented 3 weeks ago

Hi,

I'm currently simulating a simple box in free-fall, and investigating the various physical features of this simulation (e.g the contact forces, velocity of the box) before I start to scale up the complexity of my simulations. Below is a video of my simple simulation:

https://github.com/google-deepmind/mujoco/assets/127472392/92378717-68de-4cde-9808-24e7ce3e8c07

I've noticed that when I increase the box's density, the contact forces on the box exerted by the floor increase accordingly as expected. However, the velocity of the box remains unchanged/invariant, no matter how much I increase/decrease the box's density?

I've inspected the documentation, and it says "that the geom mass and inertia are only used during compilation, to infer the body mass and inertia if necessary. At runtime only the body inertial properties affect the simulation." This means that the body mass and inertia should be inferred from the geom mass, and the inferred body mass should affect the simulation properties (i.e., the velocity of the box should change as I alter the geom mass/density, even though I'm not observing this?).

Why is the velocity not changing but the contact forces are changing as I change the geom mass/density? I've attached my basic XML file below:

<mujoco>

  <option gravity = "0 0 -9.81" />

  <worldbody>
    <light diffuse=".5 .5 .5" pos="0 0 3" dir="0 0 -1"/>
    <geom type="plane" name = "floor_plane" size="5 5 0.1" rgba="1 0 1 1"/>
    <body pos="0 0 4" name = "single_box" euler = "-10 48 0">
      <joint type="free"/>
      <geom type="box" name = "single_box" pos = "0 0 0" size = "1 1 1" rgba = "0 1 0 1" density = "100"/>
    </body>
  </worldbody>  

</mujoco>
yuvaltassa commented 3 weeks ago

Why do you think the velocity should change?

That's not how gravity works đŸ™‚

yuvaltassa commented 3 weeks ago

Relatedly, see https://en.wikipedia.org/wiki/Galileo%27s_Leaning_Tower_of_Pisa_experiment