ROS 2 framework for legged robots. One lifecycle node per robot runs a real-time cycle over a shared robot state; the hardware, the motors, the sensors, the state estimator, the controllers and the operation modes are pluginlib plugins selected and configured with ROS 2 parameters.
| Go2 | R1 | NAO | |
|---|---|---|---|
| MuJoCo | ![]() |
![]() |
![]() |
| Gazebo | ![]() |
![]() |
![]() |
- Robots: Unitree Go2 (quadruped) and R1 (humanoid), plus the NAO (V6 motors) as a third robot added with its URDF, an SRDF and parameter files; it stands, walks and turns in MuJoCo and Gazebo.
- Simulators: MuJoCo (in the node, lockstep, publishes
/clock) and Gazebo (gz-sim: a system plugin hosts the node,ros_gz_simlaunch), plus the unitree_sdk2 / DDS path of the real robots. - ROS 2 native: ament packages built with colcon, pluginlib, ROS 2 parameters
(
robot_description,robot_description_semantic), lifecycle node, topics, services, TF,robot_state_publisher, RViz,joy,ros_gz_sim/ros_gz_bridge,osqp_vendor. - Named poses in the SRDF of each robot (
group_state): the posture modes (stand up, stand down, sit, squat...) move between them. - Body relative commands:
cmd_vel(body twist) andgoal_pose(the posture of the body while standing, a target to walk to while walking). - Kinematic and dynamic controllers: gait with Raibert placement, ZMP / LIPM preview control for bipeds, convex MPC of the ground reaction forces for quadrupeds.
- State estimation with a Kalman filter of the base and the feet that also fuses
external odometries (
nav_msgs/Odometrytopics, simulator ground truth, Unitree sport odometry). - Safety for the real robot: dry run, joint limits, gain ramp, watchdog, remote with emergency stop.
- Vendor interfaces in simulation: the DDS interface of the Unitree robots and the ROS 2 interface of naoqi_driver in front of the simulated robot, so programs written for the real robots run against MuJoCo and Gazebo unchanged.
mkdir -p ~/ws/legged_ws/src && cd ~/ws/legged_ws
git clone -b rolling https://github.com/juanscelyg/gaitos.git src/gaitos
source /opt/ros/rolling/setup.bash
sudo apt install libmujoco-dev libegl-dev ros-rolling-rmw-cyclonedds-cpp
rosdep install --from-paths src --ignore-src -y
colcon build --base-paths src --cmake-args -DCMAKE_BUILD_TYPE=Release
source install/setup.bash
ros2 launch gaitos_mujoco sim.launch.py robot:=go2source ~/ws/legged_ws/install/setup.bash
ros2 service call /go2/mode/stand_up std_srvs/srv/Trigger
ros2 service call /go2/mode/balance_stand std_srvs/srv/Trigger
ros2 topic pub -r 10 /go2/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 0.4}}"
ros2 service call /go2/mode/stand_down std_srvs/srv/TriggerQuick start, in detail: what each step does, Gazebo, the real Unitree robots and their DDS simulator, the vendor interfaces in simulation and the display.
Step by step, each robot in each simulator and the real robots: build, launch arguments, modes, postures, walking, the vendor interfaces, known issues (all the tutorials).
| Robot | MuJoCo | Gazebo | Real robot |
|---|---|---|---|
| Go2 | Go2 in MuJoCo | Go2 in Gazebo | Go2 real and DDS simulator |
| R1 | R1 in MuJoCo | R1 in Gazebo | R1 real |
| NAO | NAO in MuJoCo | NAO in Gazebo | — |
| Page | Contents |
|---|---|
| Build | Dependencies, FetchContent (SDK, messages, models), offline builds, CI. |
| Quick start, in detail | MuJoCo, Gazebo, the real Unitree robots, the DDS simulator, the display. |
| Packages | Every package of the repository and what it holds. |
| Architecture and plugins | The real-time cycle, its stages, the plugin interfaces, writing a plugin. |
| ROS 2 interfaces | Topics, services, TF, the lifecycle node, node extensions. |
| Operation modes | Modes, their rules and the SRDF poses. |
| Controllers and state estimation | Gait, stance, ZMP / LIPM, convex MPC, Kalman estimator, external odometry. |
| Parameters | Parameter files, their order and blocks, gains. |
| Vendor interfaces in simulation | Unitree DDS (R1, Go2) and naoqi_driver (NAO) in front of MuJoCo and Gazebo. |
| Robots | Go2, R1 and NAO: models, motors, contacts, backends; adding a robot. |
| Safety and the real robot | Read only, limits, gain ramp, watchdog, remote, a first-run sequence. |
| Status | What is verified and the known limitations. |
| Tutorials | Each robot in each simulator and the real robots, step by step. |
Apache 2.0. The robot models come from unitree_ros and unitree_mujoco (BSD-3-Clause, Unitree Robotics) and nao_robot (BSD). The NAO meshes come from the model "NAO with Ignition position controller" of Gazebo Fuel (OpenRobotics, CC BY 4.0).






