All projects

Personal project

MuJoCo-ROS 2 Quadruped Navigation

A simulated Unitree B2 that walks with a trot gait to waypoints picked in RViz.

  • Navigation
  • Planning
  • Control
Waypoint navigation: the B2 walking in MuJoCo (left) along the spline path drawn in RViz (right).

My contributions

  • Built a ROS 2 bridge between MuJoCo and RViz, publishing joint states and the world-to-base transform.
  • Wrote PD joint control, 2D and 3D leg IK, and a configurable trot gait for forward and backward motion.
  • Added waypoint navigation: RViz interactive markers, cubic-spline paths and IMU heading control.

A simulated quadruped, the open-source Unitree B2 model, in the MuJoCo physics engine, connected to ROS 2 Humble so it can be visualised and commanded from RViz. The goal: walk from point A to point B along waypoints picked in RViz.

Bridging MuJoCo and ROS 2

A ROS 2 bridge reads joint and actuator data from MuJoCo and publishes joint states and the world-to-base transform, so RViz mirrors the simulation in real time. PD controllers hold each joint at its target angle for a stable stance.

Legs and gait

Each leg has a geometric IK solver that turns a foot position into hip, thigh and knee angles; a 2D planar solver proved the most accurate. On top of it runs a trot gait: diagonal leg pairs half a cycle apart, with configurable stride length, step height and cycle time, for forward and backward motion.

Trot gait in MuJoCo, mirrored in RViz.

Waypoint navigation

Waypoints are dragged out with an interactive marker in RViz and joined into a smooth path by cubic-spline interpolation. A simple state machine turns the robot toward each waypoint using IMU yaw, then trots until it is within 10 cm. Keeping the robot stable through turns is the main open problem, with ZMP-based balance as the next step.

Drawing waypoints with an interactive marker in RViz.