← Back to Projects

Self-Rising Robot

Oct 2026
In Progress

A two-servo robot that learns to stand back up after being knocked over. The robot is a simple chain of three links driven by two MG90S hobby servos, with an MPU6050 inertial sensor as its only perception. I built the simulation in MuJoCo, modelled the real servos' torque and speed limits, and trained a control policy with PPO. A curriculum that gradually increases the tip-over angle lets the policy learn from gentle nudges up to lying flat on its side, and after 4.5M simulated steps it recovers from a full 90° fall in over 80% of attempts. The policy only sees what the hardware can measure, which keeps the network at about 5k parameters, small enough to run directly on an ESP32-C3 at 50 Hz.

Links

Build Log

The three-link robot with two MG90S servosThe three-link robot with two MG90S servos

The idea is simple: a robot that gets knocked over and stands back up on its own. No cameras, no fancy hardware. Just a chain of three links, two MG90S hobby servos, and an MPU6050 as its only sense of the world. The interesting part is not the robot. It is whether a policy trained entirely in simulation can run on a microcontroller and actually work.

I built the simulation in MuJoCo. The important bit was modelling the real servos honestly: MG90S servos have a hard torque limit and a hard speed limit, and if the sim ignores those, the policy learns moves the hardware can never do. So the sim gets the same constraints the real servos have.

Training is PPO through Stable-Baselines3 on a Gymnasium env. Dropping the robot flat on its side from step one does not work, it just never finds a reward. So I added a curriculum: start with gentle nudges, and as the policy gets good at recovering from those, increase the tip-over angle until it is lying flat on the ground.

After 4.5M simulated steps it recovers from a full 90° fall in over 80% of attempts. Watching it figure out the swing-and-catch motion on its own is the best part.

The policy only sees what the hardware can measure: gravity direction from the IMU, angular velocity, and its own last servo commands. That constraint is what makes this deployable. The whole network is about 5k parameters, small enough to run directly on an ESP32-C3 at 50 Hz. Next phase: export it to plain C and put it on the physical robot.