TL;DR
Hwangbo and colleagues trained control policies for ANYmal, a medium-dog-sized quadruped robot, entirely in simulation. Their key addition was an Actuator Network that models the robot's motors, including delays and internal feedback, learned from measurements on the real robot. The resulting policies ran faster than the robot's previous record, walked more efficiently than the best existing controller, and flipped the robot upright from nine random configurations.
Builds on: Reinforcement Learning, Trust Region Policy Optimization (TRPO), Actuator Network · Leads to: Domain Randomization, the companion idea of randomising the simulator so the policy does not depend on any one model
Why it mattered
Before this paper, the best existing ANYmal controllers were built by hand, module by module. Engineers split the problem into hand-tuned modules, and a new robot or a new manoeuvre could take months of work. The authors' central claim is that reinforcement learning can replace that process: the task is written as a reward and a set of start states, and the policy is found automatically.
The paper showed this on a real, large legged robot. Its speed record was broken by 25 percent, the new controller tracked velocity commands more accurately and with less torque and power than the best existing controller on the same hardware, and a fall-recovery behaviour was learned, which the authors say had not been achieved on a quadruped of comparable complexity before.
The method also changed the economics of control. Inference takes about 25 microseconds on one CPU thread, roughly 0.1 percent of the robot's onboard computing. Training runs on an ordinary desktop with one CPU and one GPU, and no run lasted more than eleven hours. Because the behaviours share one code base, the authors say that switching the network's parameters changes the behaviour, while the task description changes with the goal.
The problem
Learning on a real legged robot is hard for three reasons. Training needs a very large number of trials, and the controller can behave chaotically and fall during learning. Training in simulation avoids those costs, but simulators differ from reality, a difference the paper calls the reality gap. Improving the simulator analytically or by system identification is possible, and so is randomising its properties so the policy is robust to them.
For a legged robot the simulator's weakest part is the actuator. The rigid links can be modelled well from a CAD model, but the mapping from commanded position to actual torque includes delays from several hardware and software layers, the low-level controller's dynamics, and compliance and damping at the joints. The paper notes that ANYmal's 12 series elastic actuators are hard to model analytically. Their model of Gehring and colleagues contains nearly one hundred parameters, and the authors found it insufficiently accurate for training a high-performance controller.
Prior modular and trajectory-optimisation controllers faced their own limits. Modular controllers operate in small regions where each approximation holds, and their tuning is laborious. Trajectory optimisation can need the robot to solve a hard problem at run time, or to offload it to an external computer.
How it works
The method has four steps, shown in the paper's Figure 1: identify the robot's physical parameters, learn an actuator model, train a control policy in simulation, and deploy the policy on the robot.
flowchart LR A["1. Identify rigid-body model and parameter uncertainty"] --> B["2. Learn actuator net from real data"] B --> C["3. Train policy with TRPO in the hybrid simulator"] C --> D["4. Deploy policy on ANYmal, no hardware tuning"]
- Model the rigid body. The links are modelled from the CAD model, with about 20 percent uncertainty in inertia, so the authors train on 30 randomised versions of the robot. Check: 30 models with masses, centres of mass and joint positions sampled around their nominal values.
- Learn the actuators. Sine-wave foot motions are logged on the real robot at 400 Hz, and a small network maps position errors and velocities over a short history to torque. Check: the history used is the current sample and the samples at 0.01 and 0.02 seconds earlier.
- Train the policy. Inside the hybrid simulator, a multi-layer perceptron takes the history of robot states and outputs a joint position target. The target becomes a torque through a fixed impedance law, and TRPO improves the policy from the reward. Check: a training run of about a quarter of a billion state transitions takes roughly four hours.
- Deploy. The trained network runs on the robot at 25 microseconds per evaluation, with no further tuning on hardware. Check: this is about 0.1 percent of the robot's onboard compute, so the policy leaves most of the computer free.
Three training choices made the simulated policies work on hardware. The output is a position target rather than a torque, which makes the policy a stable standing controller at the start of training. The policy uses a bounded activation, because unbounded ones can produce huge actions in states the policy never visited. And a curriculum scales down every cost term except the objective at the start, so the policy first learns to move, and the costs for smooth, efficient motion are turned up towards full strength. The paper also adds noise to the velocity measurements, because on the real robot they come from numerically differentiating positions.
The math
The control problem is written as a discounted reinforcement-learning problem. At each time step the agent sees an observation , takes an action , and gets a reward . The policy is a distribution over actions, conditioned on the recent history . The objective is
where is the discount factor and is the distribution of trajectories under the policy and the dynamics. This is the Discounted Return that TRPO maximises.
Step 2 in symbols: the actuator model
The actuator network replaces the ideal torque with a learned function of the history of position error and velocity , as the Actuator Network lesson describes. Inside the simulator it is the map
with a small network trained by Mean Squared Error.
Step 3 in symbols: the action is an impedance command
The policy outputs a single position reference per joint. The torque is then
with Nm/rad and Nm/rad/s. This is the same structure as a PD Control law with a target velocity of zero. Check: if rad and rad/s, then Nm.
The gain choice has a stated reason: Nm of torque range divided by rad of motion range is about Nm/rad, so the network's output has a similar scale for torque and position.
Step 3 in symbols: the discount and the half-life
The discount factor sets how far ahead the policy plans. Its half-life in seconds is
With and a control step s, this gives s, which is the value the paper reports.
Step 3 in symbols: the curriculum
The curriculum factor scales the cost terms that are not the objective. It advances by , starting from , with advance rate . After iterations, , which rises towards 1.
Worked examples
- Position target from the policy: rad, so the error is rad. Check: the error is the target minus the current angle.
- Velocity: rad/s. Check: the velocity term opposes motion, so it has a negative sign.
- Proportional part: Nm.
- Derivative part: Nm, which is subtracted.
- Torque: Nm. Interpretation: most of the command comes from the position error, and the velocity term only trims the response.
- Start: . Check: the factor begins at 0.3, so most cost terms are switched down.
- After one iteration: . Check: the factor rises by a tiny amount.
- After 100 iterations: the exponent is , so .
- After 1,000 iterations: the exponent is , so .
- Interpretation: the costs for smooth, efficient motion are switched on gradually, reaching about 0.94 of full strength after a thousand iterations. The paper chooses so that the factor is about 0.9 by the end of training.
The paper reports two training runs. The locomotion policies used nine days of simulated time, which took about four hours of computation. The recovery policy used 79 days of simulated time, which took about eleven hours.
- Locomotion: 9 days is simulated hours. Check: 216 divided by the 4 hours of computation is 54.
- Interpretation: end-to-end training ran about 54 times faster than real time. The paper says the simulator alone runs roughly a thousand times faster than real time, and that about half of its runtime goes to evaluating the actuator nets. The gap between the two numbers is not broken down in the paper.
- Try it: compute the simulated hours per real hour for the recovery run, and say whether it is faster or slower than the locomotion run.
Answer: 79 days is simulated hours, and 1896 divided by 11 is about 172. The recovery training ran about 172 times faster than real time, so it was faster per real hour than the locomotion training, even though its episodes were different.
Common mistakes and tradeoffs
- It is tempting to think the actuator network alone made the policies work. In fact the paper's ablations show that policies trained with an ideal actuator model and with a carefully tuned analytical model could not make a single step without falling. The learned actuator model is one ingredient, and the others (the impedance output, the curriculum, the bounded activation, and the randomisation) matter too.
- It is tempting to think the speed record is the main result. In fact it is one of three demonstrations. The command-tracking comparison against the best existing controller is the more controlled test, and the fall recovery is the one that had no prior quadruped equivalent, according to the authors.
- It is tempting to think a learned policy has no structure to check. In fact the authors choose concrete design features that can be checked: a position output with fixed gains, a bounded activation, and a discount whose half-life is stated in seconds.
- It is tempting to think unbounded activations are a free improvement. In fact the paper reports that the nonlinearity strongly affects real-robot performance: ReLU can produce very large actions in states the training never reached.
| Approach | Engineering effort | Run-time compute | Stated limit |
|---|---|---|---|
| Hand-tuned modular controller | Months per robot and per manoeuvre | Low | Operates in small regions where its approximations hold |
| Trajectory optimisation | Heavy tuning and approximations | High, often on an external computer | Contact timing and points must be specified in advance |
| Learned controller with a learned actuator model | About two days of task design for a locomotion task | Very low on the robot | Needs a simulator and an actuator net, and a cost design per task |
Results
The paper's measured results are summarised below.
| Result | Number in the paper |
|---|---|
| Random-command test: linear velocity error | 0.143 m/s |
| Random-command test: yaw rate error | 0.174 rad/s |
| Comparison profile, best existing controller: linear and yaw error | 0.231 m/s and 0.278 rad/s |
| Learned vs existing controller, torque | 8.23 Nm vs 11.7 Nm on average |
| Learned vs existing controller, mechanical power | 78.1 W vs 97.3 W on average |
| Top speed on the real robot (command 1.6 m/s) | 1.5 m/s, against a previous record of 1.2 m/s |
| Peak torque and joint speed reached | 40 Nm and 12 rad/s |
| Fall recovery | All nine random configurations recovered, in under 3 seconds |
| Ideal or analytical actuator models | No successful step |
| Inference time on one CPU thread | About 25 microseconds |
Command following. The policy follows forward, lateral and turning commands without knowing their timing, with 30-second random tests and five minutes without failure. Its forward velocity reliably reaches 1.2 m/s when commanded slightly higher. The paper reports that the best existing controller's tracking error is about 95 percent higher for linear velocity and about 60 percent higher for yaw rate on the comparison profile. Two linear-velocity figures come from different command profiles, so that 95 percent is not a simple ratio of the two numbers in the table.
Efficiency. Over forward speeds from 0.25 to 1.0 m/s, the paper reports the learned controller uses 23 to 36 percent less torque than the existing gaits, and its velocity error is 1.5 to 2.5 times smaller than the dynamic lateral walk and 5 to 7 times smaller than the flying trot. The learned walk uses a straighter knee posture, 10 to 15 degrees, which the authors say the existing approach could not reach without a higher failure rate.
High speed. The learned high-speed gait is close to a flying trot with a longer and asymmetric flight phase. The authors suspect it is one of several near-optimal solutions. The high-speed result is one controlled test at a command of 1.6 m/s, where the robot reached 1.5 m/s.
Limits. The paper's own limitations are concrete. A single network trained in one session shows single-faceted behaviour and does not generalise across tasks, which the authors suggest hierarchical policies could address. The approach still needs a cost function and an initial-state distribution for each task, which took about two days of expert time for the locomotion tasks and about a week for recovery. The actuator model is per joint and assumes independence, which may fail for hydraulic systems. The short-term results do not establish long-term durability, although the robot was used for more than three months without changing the policies.
Reading guide
- Introduction. Read Reinforcement Learning and PD Control, since the paper contrasts a PID-based modular controller with a learned one. The reality gap is the paper's framing for why simulation alone is not enough.
- Results, command-conditioned locomotion. The metrics are velocity and yaw error, torque and mechanical power. The comparison controller is a modular design, and Trajectory Optimization is the other family the introduction contrasts it with.
- Results, high-speed locomotion. The gait is discussed in terms of Robot Kinematics and contact timing. The speed claim depends on the hardware limits in the paper's Figure 3.
- Results, recovery from a fall. The collision model has 41 bodies, so simulation depends on Robot Dynamics and contact handling.
- Method: rigid body and actuation. The actuator model is in Actuator Network. The idea of randomising the simulator is the one in Domain Randomization, and the paper's contrast between analytical identification and randomisation is covered in System Identification.
- Method: reinforcement learning and observations. Read Policy (Reinforcement Learning) and Discounted Return for the objective, Trust Region Policy Optimization (TRPO) for the update rule, and Kalman Filter for the height estimator used in observations.
- Method: policy training. The curriculum and the MLP design rely on Curriculum Learning and Activation Function.
Check yourself
QuestionWhat are the three ingredients the paper combines to bridge the reality gap?Show answer
QuestionThe policy outputs a position target with Nm/rad and Nm/rad/s. For rad and rad/s, what is the torque?Show answer
QuestionWhy does the paper use a position output and a bounded activation rather than torque and ReLU?Show answer
QuestionA team wants to reuse this approach for a new legged robot whose hydraulic actuators share one accumulator. What should they expect and change?Show answer
Sources
- Hwangbo J, Lee J, Dosovitskiy A, et al. (2019). Learning agile and dynamic motor skills for legged robots. arXiv. https://arxiv.org/abs/1901.08652
- DOI for the arXiv preprint: https://doi.org/10.48550/arXiv.1901.08652