mujoco_mpc icon indicating copy to clipboard operation
mujoco_mpc copied to clipboard

[Question] Has anyone integrated MuJoCo MPC with ROS2 for real-time control

Open albertoguglielmo opened this issue 2 months ago • 2 comments

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

albertoguglielmo avatar Nov 06 '25 08:11 albertoguglielmo

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

Tadinu avatar Nov 06 '25 10:11 Tadinu

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!

albertoguglielmo avatar Nov 06 '25 12:11 albertoguglielmo

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.

cinogul avatar Dec 02 '25 08:12 cinogul

Thank you very much, I will definitely take a look at it.

albertoguglielmo avatar Dec 02 '25 09:12 albertoguglielmo