On this page

ProjectSolo
8-DoF quadruped robot
A four-legged robot I designed and built: five-bar legs on eight servos, a custom servo-shield PCB, and ROS 2 control on a Raspberry Pi 5 that trots holding heading within ±2°.
- Role
- Solo engineer
- Period
- September 2025 – present
- Context
- Solo project
- Status
- Ongoing

- 0.10–0.15m/strot speed, heading held within ±2°
- 130–175mmadjustable body height
- 82 → <10mmstepping drift in MuJoCo with closed-loop position control
- ×2.2foot workspace from leg range computed on the CAD
Problem#
Walking on servos that report nothing#
The robot stands on eight Feetech FT6335 hobby servos, two per leg. Each servo takes a position command and drives toward it, but it reports no joint angle and no torque back: the servos run open loop. Nothing on the robot measures how far the body has travelled either.
Every decision the controller makes therefore comes from two sources: a BNO055 IMU (inertial measurement unit) that reports the body’s roll, pitch and yaw, and exact kinematics that turn servo commands into foot positions. Leveling, heading and foot placement all run on a Raspberry Pi 5 from those two.
Approach#
What the robot does#
On the robot, a ROS 2 controller trots forward at 0.10–0.15 m/s while a heading loop holds its direction within ±2°, and a leveling loop keeps the body flat. A PS5 gamepad drives it live: speed, turning and body height.
Designed end to end, tested on a model first#
I designed and built the robot across mechanics, electronics, kinematics and control: the body, mounts and servo-shield PCB, then a control stack in ROS 2 Humble on the Pi.
A MuJoCo model built from the CAD frames, masses and inertias, and a software-in-the-loop matrix of seven body poses, test every controller change before it reaches the robot. The matrix runs each behaviour at heights of 130, 155 and 175 mm, at ±10° pitch and at ±8° roll. 347 automated tests cover the code.


What I built#
The five-bar leg and its kinematics#

Each leg is a five-bar linkage: a closed chain of links in which two motors together set one foot position. Both servos sit in the body, and the calf moves through a push rod, which keeps the leg light.
Forward kinematics maps the two servo angles θ to the foot position p = f(θ). My exact solution of the five-bar reproduces the first firmware’s 40-sample gait table exactly.
Inverse kinematics runs the other way, from a desired foot position p* to servo angles. I solve it by Gauss-Newton iteration with the Jacobian J of f, at about 22 µs per solve:
The servo-shield PCB#

I designed a servo-shield PCB that powers and drives all eight servos from the 7.4 V battery. It carries:
- a TPS63060 buck-boost converter for the 5 V logic rail, with power protection;
- a PCA9685 PWM servo driver;
- bulk capacitance for servo current transients;
- a PCA9306 I²C level shifter, so the same board serves an Arduino or a Raspberry Pi.


Gait, body pose and balance#
The ROS 2 controller on the Pi runs at 50 Hz and has three layers.
- Gait generator. A data-driven generator places each foot along a swing and stance path. The trot proven on the robot moves diagonal legs together with a 0.6 s period, a 20 mm foot lift and a 0.7 duty factor, the fraction of each cycle a foot spends on the ground. At 0.7, all four feet share the load for 40% of every cycle, and the body rocks about 30% less than at 0.6.
- Body pose. A pose layer sets height (130–175 mm), pitch (±10°) and roll (±8°) as one rigid transform about the ground point under the body.
- Balance. A leveling PID corrects body attitude around the commanded pose, with a 1° deadband so the servos hold still when the body is level. A heading PID on IMU yaw steers toward the commanded heading.
PS5 gamepad teleoperation feeds speed, turning and body height into the same layers.
One guarded path to the servos#
Every servo command passes through one path on its way to the PCA9685:
- a per-servo limit clamp;
- a 500–2500 µs pulse clamp;
- a 400°/s rate limiter;
- one block write to the driver.
A fuzz test over 100,000 samples found no command outside the limits, and no clamp fired in any walk on the robot.
The stock BNO055 driver never recovers from an I²C error, and a stale IMU once held a 17 mm leveling correction that threw off the walk. The correction now fades to zero on stale data, and a supervisor node restarts the driver.
Leg range computed from the CAD#
A hand-set joint box (60–120° thigh, 60–100° calf) kept the legs far inside their real range. I computed the feasible joint region from the CAD meshes and the forward kinematics instead:
| Leg range | Hand-set box | Computed from the CAD |
|---|---|---|
| Thigh × calf joint range | 60–120° × 60–100° | 36–157° × 58–125° |
| Joint-space area | 2,400 deg² | 5,341 deg² |
| Foot workspace | 81 cm² | 180 cm² (×2.2) |
| Fore-aft reach at 155 mm height | −26…+70 mm | −81…+117 mm |

A second pass sweeps both servos through their whole travel against the CAD, calibrated on the robot’s real lowest pose with the hip 70 mm above the ground. It finds 10,080 deg² of contact-free joint space connected to the standing pose, which widens the range again.

Keeping the front and rear legs apart#
On each side, the front and rear legs can reach each other. Two independent sweeps check every rear-front leg pose pair on a 2° grid, about 1.8 million pairs per side: one slices the meshes into layers, the other uses MuJoCo contacts. They agree on 99.97% of pairs, and exact mesh distance settles the rest.
The sweeps found about 6,000 pairs per side that the old foot-gap table allowed and where the rear crank link hits the front calf. The swept unsafe set is now the controller’s one inter-leg check: a startup check covers every gait, pose and stride, and a per-tick guard tests each command against the set in 1.6 µs.

Results#
Trotting with heading hold#
On the robot, the trot runs forward at commanded speeds of 0.10–0.15 m/s, holding heading within ±2°.
Walking backward: the heading hold that caused a spin#
Walking backward at 0.12 m/s, the robot spun 45–117° in 5 s. With the heading hold off, it backed up straight, so the hold itself caused the spin: a large differential stride made the feet slip as they pushed toward the nose, the yaw response reversed, and the PID pushed harder.
The heading PID outputs a turn rate ω from the heading error e, clamped to a limit I call its authority:
Capping ωmax at 0.1 rad/s, well above the robot’s natural veer of about 0.015 rad/s, broke the loop:
| Run on the robot | Heading authority | Heading error at the end of the run |
|---|---|---|
| Backward, hold on (before) | 0.4 rad/s | 45–117° (spinning) |
| Backward, hold off | none | 4.3° |
| Backward, hold on (after) | 0.1 rad/s | 0.5–3.5° |
| Forward, hold on (after) | 0.1 rad/s | 1.0–1.5° |
After the fix, roll stayed within 0.9–1.5° RMS in both directions.
Drift and balance in MuJoCo#
In MuJoCo, closed-loop position control cut stepping drift from 82 mm to under 10 mm, over 10 s of stepping in place on flat ground at seven body poses with simulated odometry. The same loop cuts the distance a push costs:
| MuJoCo, 7 body poses | Open loop | Closed loop |
|---|---|---|
| Stepping in place for 10 s, final drift | 49–82 mm | 0–9 mm |
| 4 N push while walking at 0.1 m/s, distance lost | 84–388 mm | 22–98 mm |
Across 273 runs, the model never fell and no servo clamp fired. Leveling brings the body from a 4° slope into its 1° deadband in under 5 s, and a 4 N side push tilts it by at most 2.0°.
What’s next#
- A PPO locomotion policy trained in Isaac Lab for sim-to-real transfer on open-loop servos with no joint feedback.
- A jump that pushes off with the takeoff velocity closed on the IMU and lands with leveling held.
- Vision-directed behaviours driven by the front camera.