$ show silvery107/rl-mpc-locomotion
This repository implements a hierarchical controller for quadruped locomotion that combines a high-level reinforcement learning policy with a low-level model predictive controller (MPC). The RL policy dynamically predicts weight parameters for the MPC, which computes optimal ground reaction forces and joint torques. The codebase includes Isaac Gym training environments for the Unitree A1, Go1, and Aliengo robots, along with a custom C++ MPC solver (OSQP-based) and a finite state machine for robust transient handling. While primarily a research project that bridges RL and MPC for legged robots, it also provides reusable robotics components such as state estimators, leg controllers, gait pattern generators, and foot swing trajectory planners. The work is based on the MIT Cheetah software and includes detailed development logs and configuration files for reproducible experiments.
The LLM identified 6 files worth highlighting for reuse:
Defines the Quadruped class that encapsulates robot geometry (leg positions, hip offsets), mass, inertia, and actuator limits. Provides a clean, parameterized interface for any four-legged robot and can be reused across simulation or real-robot control projects with minimal adaptation.
Implements LegController with data structures for desired and actual joint states, plus computation of joint torques via PD control in both Cartesian and joint space. Isolated from the rest of the codebase, it can be extracted for any robot control application that requires low-level torque commands.
Provides a state estimator that computes robot orientation from quaternions, angular/linear velocities, and ground normal estimation. Self-contained and uses only NumPy, making it suitable for reuse in other legged robot projects where a simple estimator is needed.
Implements OffsetDurationGait and various predefined gait patterns (trot, pace, gallop, etc.) using leg contact timings. This module is parameterized by leg order and timing, and can be reused in any locomotion controller that requires gait scheduling independent of the MPC solver.
Generates cubic Bezier swing trajectories for foot movement given start, mid, and end positions. The implementation is standalone with clear input/output interfaces, reusable for any robotic system requiring smooth foot swing planning.
Implements a stable moving window filter using Neumaier's algorithm for computing running averages. Lightweight, dependency-free, and can be reused in any stream processing context for noise reduction on sensor signals.