google-deepmind / mujoco_mpc

Real-time behaviour synthesis with MuJoCo, using Predictive Control
https://github.com/deepmind/mujoco_mpc
Apache License 2.0
967 stars 146 forks source link

support more robots #116

Closed GilgameshD closed 9 months ago

GilgameshD commented 1 year ago

Hi, thanks for building this amazing project! I wonder if there is any plan to support more robots, for example, Unitree go1, which should be very similar to A1. Thanks

thowell commented 1 year ago

Thanks for your interest in MJPC. If you would like to add another task, take a look at this part of the documentation.

It's pretty straight forward to modify the A1 task by swapping in the Go1 xml model (and the related assets) from Menagerie.

@kevinzakka do you have the Go1 task floating around somewhere?

kevinzakka commented 1 year ago

Go1 XML is now in Menagerie — it should be super straightforward to replicate the A1 task for it, mostly just a matter of copying over the XML and assets and adding some sites.

GilgameshD commented 1 year ago

Thanks for replying. I tried to replace A1.xml with GO1.xml and fix all compatibility problems. I can successfully start the UI with GO1 now. But the robot always flips and cannot walk. I guess there are still some parameters in the task file that are not compatible with GO1. Is there anything I should change in this file?

thowell commented 1 year ago

You will likely need to change some of the parameters here like kHeightQuadruped.

GilgameshD commented 1 year ago

will try, thanks!

lyuyiqi commented 1 year ago

Hi all. I am working on a similar project and I've had GO1 working on my simulator. However, everytime I turned off "action" the robot always straightened its feet and jump off the ground (restore to its initial abduction, hip and knee angles) instead of lying down due to loss of actuation like original A1 model does. I would really appreciate it if you could give me some hint to solve this problem.

kevinzakka commented 1 year ago

@lyuyiqi Are you using torque or position actuators?

lyuyiqi commented 1 year ago

Thank you for your reply. I just checked the model again and indeed the actuators are position type. After I replace them with general type and now it works very well! Thank you again for your instruction!

fucker007 commented 1 year ago

hello i am implementing cassie robot as a course design ,but getting the following error:

WARNING: Nan, Inf or huge value in QACC at DOF 15. The simulation is unstable. Time = 75.8185.  

I checked the qacc variables, it is very large, but the initial state, the data.ctrl is 0, why is qacc and qvel so large, any advise, be grateful.

ctrl: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0     
qacc: -66749.3 340.516 -48825.6 21233.7 -117638 -3536.89 1.18634e+06 -12356.9 -35603.6 501364 -486736 4.72508e+06 -331869 2.61728e+06 -472750 1.60132e+07 -340228 -617662 330307 -1.19458e+06 17753.3 -36136 -497080 483571 4.68214e+06 -305874 2.54013e+06 -481444 1.59818e+07 -342857 -569416 320391   
qvel: -962.327 4.8076 -662.995 316.228 -1910.94 -51.0099 15184.1 -25.112 -207.886 183.094 -6153.09 65139.8 -3692.46 34416.3 -6608.29 230191 -95.3175 -13608.1 2020.93 -15307.8 85.8585 -223.508 -181.957 6092.33 64515 -3365.66 33349.1 -6756.55 229758 -96.9575 -12905.7 1952.82  
yuvaltassa commented 1 year ago

Did you try reducing the timestep?

fucker007 commented 1 year ago

Thanks for replying,It is work well when setting a smaller timestep. I am learning the code of humanoid walker, but I am wondering why -7 when setting posture.
code path: mujoco_mpc/tree/main/mjpc/tasks/humanoid/walk/walk.cc, line 122.

  // ----- posture ----- //  
  mju_copy(&residual[counter], data->qpos + 7, model->nq - 7);  
  counter += model->nq - 7;  

@yuvaltassa thanks for your replying, best wish.

kevinzakka commented 1 year ago

-7 because we don't want to index the freejoint (3 dims for pos, 4 for quat).

fucker007 commented 1 year ago

-7 because we don't want to index the freejoint (3 dims for pos, 4 for quat).

Thanks for replying,This makes me understand correctly, bless you.

fucker007 commented 1 year ago

I have tried some tricks on cassie , however it's diffcult to walk by mujoco_mpc, so is it possible ? any suggestion, be grateful.

thowell commented 9 months ago

See #206 for using cassie model with MJPC.