google-deepmind / mujoco

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

Is it a bug to get body position? #112

Closed chinahuangyong closed 2 years ago

chinahuangyong commented 2 years ago

Hello, I am use mujoco to simulate the quadruped mini cheetah, mini cheetah is static, but i get the position from the sensor in mujoco, the position axis x is always Increase.

mini_cheetah_mujoco

this is mini cheetah xml file and stl file. mini_cheetah.zip

yuvaltassa commented 2 years ago

Hi @chinahuangyong,

This is a bit hard to diagnose, in the model you attached the robot just falls over, so I can't reproduce. Did you remove the joints or add high-gain position actuators? If you send the model where this happens and we could follow up.

In the meantime I recommend turning on force visualisation (hit the 'F' key). For some setting you can get jittering forces which can cause this phenomenon. If that's the case perhaps try switching to elliptic friction cones (in the 'physics' tab) as the are completely isotropic, unlike pyramidal cones.

BTW, this is a nice model, can you point me to where you found it?

chinahuangyong commented 2 years ago

yeah, i use pd control to control the joint position, the despite position;

RF:
x0.q[0] = -0.7;
  x0.q[1] = 1.;
  x0.q[2] = 2.715;
LF:
  x0.q[0] = 0.7;
  x0.q[1] = 1.;
  x0.q[2] = 2.715;
HR:
  x0.q[0] = -0.7;
  x0.q[1] = -1.0;
  x0.q[2] = -2.715;
HL:
  x0.q[0] = 0.7;
  x0.q[1] = -1.0;
  x0.q[2] = -2.715;

image

the model is convert urdf file to xml file, and add some constraint and others.

yuvaltassa commented 2 years ago

Could you please make a model that shows this behaviour upon load in simulate without any additional code? You can add position actuators using <position joint="joint_name" kp="gain"/> (you probably want more damping in your joints btw), and you can change the semantics of your joints angles using <joint ref="refangle"/>, such that the zero controls upon load will take the joints to -refangle

Thanks

saran-t commented 2 years ago

Closing since there hasn't been a response for a while. Please reopen if required.