How jmelzer244/self-righting-rl-arm works
This repository builds a sim-to-real self-righting controller: a MuJoCo arm model feeds a Gymnasium task, PPO trains a policy (optionally with randomized physics and noisy observations), and an export step packages network weights for an ESP32-S3 closed-loop controller. The README also documents the Onshape-to-MuJoCo model workflow and hardware sensing and actuation. The firmware and model-generation internals were not sampled, so those links reflect README documentation rather than inspected implementation.
Main entry points: selfright_env.py Self-right task · scene.xml MuJoCo scene · domain_rand.py Randomized task · selfright_esp32.ino ESP32 controller
Components 17
Arm model
- Robot model
robot.xml - MuJoCo scene
scene.xml - Arm meshes
assets
Simulation task
- Self-right task
selfright_env.py - Randomized task
domain_rand.py - Scene viewer
view.py
Policy learning
- PPO training
train.py - Randomized PPO
train_dr.py - Rollout recording
watch.py
Embedded deployment
- Policy exporter
export_policy.py - MLP weights
policy_weights.h - ESP32 controller
selfright_esp32.ino
Other components
- Model author
- Onshape export
- MPU6050 IMU
- Arm servos
- Policy trainer
Connections 19
- Model author → Onshape export: models arm
README.md - Onshape export → Robot model: exports model
README.md - Robot model → MuJoCo scene: builds scene
- Arm meshes → MuJoCo scene: provides geometry
- MuJoCo scene → Self-right task: loads model
selfright_env.py - Self-right task → Randomized task: extends task
domain_rand.py - Policy trainer → PPO training: starts training
README.md - PPO training → Self-right task: trains with
train.py - Policy trainer → Randomized PPO: starts training
README.md - Randomized PPO → Randomized task: trains with
train_dr.py - Randomized task → Self-right task: inherits task
domain_rand.py - Policy trainer → Rollout recording: records rollout
README.md - Rollout recording → Self-right task: steps environment
watch.py - MuJoCo scene → Scene viewer: loads scene
view.py - Policy trainer → Policy exporter: exports policy
README.md - Policy exporter → MLP weights: writes weights
export_policy.py - MLP weights → ESP32 controller: supplies policy
README.md - MPU6050 IMU → ESP32 controller: provides readings
README.md - ESP32 controller → Arm servos: drives servos
README.md