[Question] Has anyone integrated MuJoCo MPC with ROS2 for real-time control
Hi everyone,
I was wondering if anyone has already integrated MuJoCo MPC with ROS2. Specifically, I’m looking for a setup where a ROS2 node reads the current robot state (either from a real robot or from Gazebo) and then outputs the optimal control command computed by the MPC.
Has anyone implemented such a bridge or node? If so, I’d really appreciate any pointers, example repositories, or advice on how to properly connect MuJoCo MPC’s control loop with ROS2 topics/services.
Thanks in advance! Alberto
Hi @albertoguglielmo, this one has deployment on Unitree but using ROS https://github.com/johnzhang3/mujoco_mpc_deploy But Unitree has its ROS2 interface with mujoco, so probably porting is possible https://github.com/unitreerobotics/unitree_mujoco Hope they are of use to you
Thanks @Tadinu! Both links look very relevant mujoco_mpc_deploy and the Unitree MuJoCo interface. I’ll dig into them and try to put together a ROS 2 bridge (state in from Gazebo/real robot, optimal control out). I’ll report back and share a minimal example/repo if I get it working. Really appreciate the pointers!
Hi @albertoguglielmo,
I personally adapted a version of this code, which seemed to work alright. You have to work around their controller a bit but the basic building blocks are there.
Thank you very much, I will definitely take a look at it.