How pocketxjl/humanoid-control works
This repository implements a ROS-based humanoid locomotion stack: commands and robot measurements enter controller nodes, state estimation and OCS2-based model-predictive control produce desired motion, and whole-body control turns that motion into joint commands. Gait scheduling and swing-foot planning shape the motion references; simulation and visualization support operation. The README documents the optimization and estimator behavior, while several internal connections are inferred from those documented responsibilities because their wiring was not sampled.
Main entry points: humanoidController.cpp Humanoid controller · HumanoidInterface.cpp Humanoid optimal-control interface · SwitchedModelReferenceManager.cpp Switched reference manager · JoyControllerNode.cpp Joy controller node
Components 21
Commands and runtime
- Joy controller node
humanoid_controllers/src/JoyControllerNode.cpp - Gait command publisher
humanoid_dummy/src/gait/GaitKeyboardPublisher.cpp - OCS2 dummy nodes
humanoid_dummy/src/HumanoidSqpMpcNode.cpp
Control and estimation
- Humanoid controller
humanoid_controllers/src/humanoidController.cpp - State estimation
humanoid_estimation/src/StateEstimateBase.cpp - Linear Kalman filter
humanoid_estimation/src/LinearKalmanFilter.cpp - Humanoid optimal-control interface
humanoid_interface/src/HumanoidInterface.cpp - Centroidal dynamics
humanoid_interface/src/dynamics/HumanoidDynamicsAD.cpp - Contact constraints
humanoid_interface/src/constraint/FrictionConeConstraint.cpp - NMPC and MRT
humanoid_controllers/src/humanoidController.cpp
Locomotion planning
- Gait schedule
humanoid_interface/src/gait/GaitSchedule.cpp - Switched reference manager
humanoid_interface/src/reference_manager/SwitchedModelReferenceManager.cpp - Swing trajectory planner
humanoid_interface/src/foot_planner/SwingTrajectoryPlanner.cpp
Execution and simulation
- Whole-body control
humanoid_wbc/src/WeightedWbc.cpp - Safety checker
humanoid_controllers/include/humanoid_controllers/SafetyChecker.h - MuJoCo simulation
mujoco_sim/script/humanoid_sim.py - Simulation teleoperation
mujoco_sim/script/teleop.py
Visualization
- Humanoid visualization
humanoid_dummy/src/visualization/HumanoidVisualizer.cpp
Other components
- Operator
- Robot sensors
- Joint actuators
Connections 20
- Operator → Joy controller node: sends commands
- Joy controller node → Gait command publisher: publishes gait
- Gait command publisher → Gait schedule: sends gait command
- Robot sensors → Humanoid controller: provides measurements
- Humanoid controller → State estimation: updates state
- State estimation → Linear Kalman filter: filters measurements
- Humanoid controller → NMPC and MRT: advances optimization
- Humanoid optimal-control interface → Centroidal dynamics: provides dynamics
- Humanoid optimal-control interface → Contact constraints: configures constraints
- Switched reference manager → Gait schedule: gets mode schedule
- Switched reference manager → Swing trajectory planner: updates trajectory
- NMPC and MRT → Switched reference manager: modifies references
- NMPC and MRT → Humanoid optimal-control interface: uses model
- Humanoid controller → Whole-body control: computes joint commands
- Humanoid controller → Safety checker: checks commands
- Humanoid controller → Joint actuators: publishes joint targets
- Humanoid controller → Humanoid visualization: publishes observations
- OCS2 dummy nodes → Humanoid visualization: publishes robot state
- Operator → Simulation teleoperation: provides input
- Simulation teleoperation → MuJoCo simulation: controls simulation