google-deepmind / mujoco

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

Title: Block on Rotating Plate Changes Position but Not Angle #1775

Closed z-yf17 closed 1 week ago

z-yf17 commented 2 months ago

Content:

Hi,

I am facing an issue with my MuJoCo simulation and I would appreciate some help.

I have a rotating plate, and when I place a block on it, the block's position changes as the plate rotates, but its angle does not. Ideally, the block should change its angle along with its position as it rotates on the plate.

Why is this happening, and how can I adjust the setup so that the block's angle changes appropriately with the rotation of the plate?

Thank you very much for any assistance!

![Uploading 8fabb63a506d7

65146d4a60c4b24ee38af25614affa5

db7b707ba26574d783.png…]()

3a6072c0c624520591ada1b0d5acd45 148f3c0cdb778f380a8b592cb7d7e05
Balint-H commented 2 months ago

Can you share a minimum working example XML of only your spinning plate and cube where this effect is reproduced?

z-yf17 commented 2 months ago

image image

Here is the code. Thanks.

Balint-H commented 2 months ago

It is caused by the large diagonal inertia you set (by a couple orders of magnitude larger than usual for a cube that size) and the frictionloss you specified in the joint (which resists all movement)

Unless you have a specific reason to use inertial (e.g. measurements from CAD software or real life experiments) I recommend using the default inertia calculations and removing the inertial element.

In the future, please paste MJCFs in a code block, or upload a txt file containing it, or a zip file of the xml. (I know, it is weird that github doesn't support xml files by default)