Skip to content
WE BUILDHUMANOIDS

GUIDE · 5 MIN READ

Reinforcement learning for humanoids

How humanoid makers train walking policies with reinforcement learning in simulation, and how those policies are checked before they reach a real robot.

REVIEWED BY WBH · · DRAFTED WITH AI ASSISTANCE FROM THE CITED SOURCES

For: People who build, program or evaluate humanoid robots.

What reinforcement learning does for a humanoid

Unitree describes the basic workflow for using reinforcement learning (RL) to achieve motion control as Train, Play, Sim2Sim and Sim2Real. In the first stage the robot interacts with a simulation environment, and training looks for a policy that maximises the designed rewards [1]. Booster Robotics describes Booster Gym as an RL framework designed for humanoid robot locomotion [3]. Humanoid-Gym is likewise an RL framework, built on Nvidia Isaac Gym and designed to train locomotion skills for humanoid robots, with an emphasis on zero-shot transfer from simulation to the real world [2]. Unitree RL GYM is a repository for RL implementation based on Unitree robots, supporting the Go2, H1, H1_2 and G1 [1].

The authors of proximal policy optimization (PPO) propose a new family of policy gradient methods for RL. The methods alternate between sampling data through interaction with the environment and optimising a surrogate objective function using stochastic gradient ascent. Standard policy gradient methods perform one gradient update per data sample, whereas the PPO objective enables multiple epochs of minibatch updates. The authors tested PPO on benchmark tasks that included simulated robotic locomotion [4]. In Humanoid-Gym, each environment has a configuration file with two classes: LeggedRobotCfg holds all environmental parameters and LeggedRobotCfgPPO holds all training parameters. Its default humanoid_ppo task is a PPO baseline, and its example command launches PPO training across 4096 environments [2].

In Humanoid-Gym, non-zero reward scales specified in the configuration each contribute a function of the corresponding name to the sum-total reward, and a reward is removed by setting its scale to zero. The repository also says it features specialised rewards for humanoid robots, which simplify the difficulty of sim-to-real transfer [2].

Why training runs in simulation, many robots at once

Simulators supply data in quantity and remove some of the safety concerns of learning on a real machine [6]. Current frameworks also simulate many robots at the same time: Unitree RL GYM takes the number of parallel environments as a training parameter [1], and Booster Gym trains in Isaac Gym with parallelised environments [3].

Rudin and colleagues present a training set-up that achieves fast policy generation by using massive parallelism on a single workstation GPU, together with a game-inspired curriculum that is well suited for training with thousands of simulated robots in parallel. Policies for flat terrain took under four minutes and policies for uneven terrain twenty minutes, a speedup of multiple orders of magnitude compared to previous work, and they transferred to the real robot [5]. Their robot was the quadruped ANYmal rather than a humanoid [5], but the humanoid frameworks above rely on the same idea of many simulated robots learning in parallel [3] [1].

From simulator to robot: the usual pipeline

Unitree names the stages of its workflow Train, Play, Sim2Sim and Sim2Real [1]:

  1. Train: the robot interacts with the simulated environment while training looks for the policy with the highest designed reward; Unitree advises against watching training live, because visualisation slows it down [1].
  2. Play: the trained policy is run to confirm it behaves as intended, and the network is exported, as policy_1.pt for a standard MLP or policy_lstm_1.pt for a recurrent network [1].
  3. Sim2Sim: the policy runs in a second simulator, MuJoCo, to show that it does not rely on peculiarities of the training simulator [1].
  4. Sim2Real: the policy is deployed on the physical robot, which must first be put in debug mode [1].

Booster Gym lists its own stages. A policy is trained in Isaac Gym, evaluated in the same environment to check that it behaves as expected, and tested in MuJoCo to verify that it generalises across environments. It is then exported from a .pth file to a JIT-optimised .pt format and deployed with the SDK in Webots for a final check in simulation; the same Webots deployment script is used to deploy the model to the physical robot. Training settings are loaded from a YAML file for each task, and command-line arguments such as --num_envs can override them [3].

Closing the gap to reality

A policy that works in simulation can still fail on hardware. Peng and colleagues explain why: behaviour learned in a simulator is often specific to that simulator, and because of modelling error a strategy that succeeds there may not carry over [6]. Their answer was to randomise the simulator's dynamics during training. The resulting policies adapted to dynamics they had not seen, including the real system, without any training on it; they demonstrated this on an object-pushing task with a robot arm [6].

Humanoid-Gym integrates a sim-to-sim framework from Isaac Gym to MuJoCo, which lets users verify trained policies in different physical simulations. Its MuJoCo settings are, according to the repository, finely tuned to closely mimic real-world scenarios, and it reports zero-shot sim-to-real transfer on RobotEra's XBot-S, a 1.2-metre humanoid, and XBot-L, which is 1.65 metres tall [2]. Booster lists settings and techniques that reduce the sim-to-real gap among the features of Booster Gym [3].

Frameworks for specific robots

  • Unitree RL GYM supports the Go2, H1, H1_2 and G1, and uses MuJoCo for its sim-to-sim step [1]; see Unitree H1 and Unitree G1.
  • Booster Gym is pre-configured for the Booster T1. Booster now also offers a training pipeline in Isaac Lab that supports the Booster K1, together with robot descriptions and example motion data [3].
  • Humanoid-Gym uses RobotEra's XBot-L as its main example and says it can be used for other robots with minimal adjustments [2].

Makers also mention RL in product descriptions. AGIBOT says the A2-W combines 3D model synthesis training with RL so that the time to adapt to new objects can be reduced to within hours [7], and NEURA lists reinforcement learning among the capabilities of the 4NE1 Mini [8].

What to check as a builder

  1. Is there an open training framework for the robot, and which simulator does it use: Isaac Gym, Isaac Lab or MuJoCo [3] [1]?
  2. Does the maker publish robot descriptions for simulation [3]?
  3. Is there a second simulator for a sim-to-sim check before the policy reaches hardware [2]?
  4. How is a trained policy deployed, and in which safety mode [1]?
  5. Has transfer to real hardware been shown, and on which robot [2]?