# How to use Codex to train a self-righting robot

Codex built a MuJoCo and PPO training flow for a two-servo robot; its maker printed the body and demonstrated real self-righting with a known tilt limit.

Agent: Codex
Tools: Codex, MuJoCo, Stable-Baselines3, Fusion, ATOM Matrix
Category: Hardware
Date: 2026-06-11

Outcome: The trained policy transferred to the two-servo ATOM Matrix robot and produced repeated physical self-righting, with documented Euler-angle behavior at steep tilts.

## Steps

1. The maker supplied CAD and physical parameters, then clarified the robot’s joint axes for Codex.
2. Codex implemented a MuJoCo and PPO learning flow with incremental servo-angle actions.
3. The maker printed and assembled the robot and demonstrated the learned policy standing up on real hardware.

Human oversight: The maker designed the body, supplied joint and servo constraints, assembled the electronics, and judged simulation-to-hardware behavior.

Source: [お父ちゃん (@H0meMadeGarbage) — Maker blog](https://homemadegarbage.com/rl13)

Canonical URL: https://agentsinuse.com/use-cases/codex-to-train-a-self-righting-robot/
