Search

Search papers and lessons

Learning quadrupedal locomotion over challenging terrain

Joonho Lee, Jemin Hwangbo, Lorenz Wellhausen et al. · 2020

A four-legged robot learns to walk over mud, snow, rubble and vegetation using only joint and body sensors, after training in simulation with a teacher-student scheme and an adaptive terrain curriculum.

On this page

  • Colour = topic mix
  • Discrete math
  • Probability
  • Reinforcement learning
  • Calculus
  • Neural network basics
  • Linear algebra
  • Sign in to see your progress

TL;DR

A four-legged robot needs to walk over mud, snow, loose rubble and thick vegetation, where cameras and laser scanners can fail and wheels get stuck. This paper trains one neural-network controller in a physics simulator, using only the robot's joint and body sensors, and then runs it on real robots with no fine-tuning. The controller keeps working on ground it never saw in training.

The method has three parts: a teacher policy that is allowed to see the true terrain in simulation, a student policy that learns to imitate the teacher using only the robot's own sensor history, and an automatic curriculum that keeps the training terrains at a useful level of difficulty.

The problem

Legged robots could reach places wheeled and tracked machines cannot, but in 2020 the best controllers were fragile on rough natural ground. The usual design is a hand-built state machine. It switches between gait primitives and reflex behaviours, and it decides when to switch by estimating whether a foot is touching the ground or slipping. Those estimates depend on tuned thresholds and on sensors such as foot contact switches. Mud, snow and vegetation break both assumptions. A foot that sinks into mud looks like a foot that is slipping, and a foot hidden in grass cannot be seen by a camera.

Learning-based controllers had already shown good results, but mostly on flat ground in a laboratory. The authors' earlier work had shown end-to-end learning of locomotion and recovery, again on flat ground. Training directly on rough, deformable terrain with reinforcement learning was hard: the reward signal arrives rarely, so the policy learns very slowly. The problem was to get a controller that is robust on hard terrain, works on real hardware, and does not depend on sensors that fail outdoors.

Key idea

The controller is split into two parts that learn at different stages. The first part is a teacher that can see everything in the simulator, including the terrain shape, friction and which feet are touching the ground. This privileged information makes learning fast. The second part is a student that sees only what a real robot has, its own proprioception (the sensing of its own joints and body): joint positions and velocities, body orientation and angular velocity, and the commands it was given. The student is trained to copy the teacher's outputs. Because the student only sees its own sensor history, it has to work out the terrain from how its body reacts. A foot that suddenly stops moving forward tells it something about the ground.

The picture to keep in mind is a driving instructor who can see the whole road, training a student who only has the windscreen and the steering wheel. The student learns to infer what matters from the signals it has, and it does not need the road map on the day of the test.

Two further ingredients make the scheme work. The first is a sequence model, a temporal convolutional network that reads a window of recent sensor readings. The second is a curriculum that proposes terrains of medium difficulty, so the teacher always trains on ground it can partly cross.

The method

Commands and the gait

The controller receives a command. Only the direction of travel is given, not a target speed, because the feasible speed depends on the slope: a robot can walk faster downhill than uphill. The command also says whether to turn left, right or not at all, or to stop.

Each leg has a phase variable that runs around a circle. The first half of the circle means the foot is on the ground, and the second half means it is in the air. All four phases advance at a common base frequency of 1.25 Hz plus a per-leg offset. The policy outputs the per-leg frequency offsets and residual foot-position offsets. The foot target is a fixed, phase-dependent trajectory plus that residual, and joint angles come from an analytic inverse-kinematics solution (inverse kinematics) tracked by position controllers on each joint. Starting from a periodic gait prior and learning only residuals makes the policy easier to train, which is one of the design choices the paper credits for stable learning.

Teacher policy

The teacher is a multi-layer network that sees the robot state oto_t and privileged information xtx_t: terrain properties and contact information. A small encoder turns xtx_t into a latent vector lˉt\bar{l}_t, which the authors interpret as a compact description of the terrain and the contacts. The rest of the network then combines lˉt\bar{l}_t with oto_t to produce the action aˉt\bar{a}_t, a 16-dimensional vector of frequency offsets and foot residuals.

The teacher is trained as a Markov decision process (MDP) with a reward for moving in the commanded direction. The paper uses trust region policy optimization (TRPO) for this stage. The reward is dense enough that the teacher learns quickly, which is the point of giving it the privileged inputs.

Student policy

The student sees only hth_t, a subset of the sensor readings. The key hypothesis is that the teacher's terrain latent lˉt\bar{l}_t can be recovered, at least partly, from a time series of such readings. The student reads a window of the last NN readings through a temporal convolutional network (TCN): a stack of causal convolutions in which each layer looks further into the past, with dilation, and strided layers shrink the representation. A causal convolution only uses past readings, so the network can run on the robot in real time.

The student is trained by supervised regression. Its action output is pushed toward the teacher's action, and its latent output is pushed toward the teacher's latent, with a squared-error loss on both. Training data comes from rolling out the student itself, and at each visited state the teacher supplies the labels. This is the dataset aggregation scheme, DAgger (DAgger), which avoids the drift that happens when a student is trained only on the teacher's own trajectories. The student, not the teacher, is the controller that runs on the robot.

Adaptive terrain curriculum

Terrains are generated from a parameter vector. Parameters include slope, step height, roughness and friction-like settings. For each parameter setting, the authors measure how traversable the terrain is for the current policy. A trajectory counts as successful in a direction when the robot moves at more than 0.2 metres per second along the command. The traversability of a terrain is the fraction of trajectories that succeed.

The curriculum keeps terrains whose traversability falls between 0.5 and 0.9. Below 0.5 the terrain is too hard to learn from, and above 0.9 it is too easy to teach anything. A particle filter, a sampling method that tracks a changing distribution over a set of candidate points, maintains the set of parameter settings in that range. The filter is updated from the trajectories the policy already generates, so no extra evaluation runs are needed. As the policy improves, the set moves toward harder terrain. The same curriculum is used for both the teacher and the student.

Simulation and the transfer to hardware

The simulator models the robot's joint motors with a learned model of the position controller, so that the commanded and measured joint behaviour match closely. Training uses procedurally generated rigid terrains (see also Domain Randomization) such as hills, steps and slopes. The authors do not model mud, snow or vegetation. The hope, borne out in deployment, is that a robust policy for rigid rough terrain also copes with deformable terrain. The learned policy is then deployed on the real robots with no fine-tuning.

Results

The authors tested the controller on two generations of the ANYmal robot in natural settings. These included mountain trails, creeks, mud, thick vegetation, loose rubble, snow and a damp forest. The controller crossed all of them, and it stayed stable on ground it never met in training.

Table 1 of the paper compares it with a strong baseline controller on three surfaces. The average speeds are shown below, with the mechanical cost of transport (COT), a dimensionless measure of energy spent per unit weight per unit distance. Lower COT is better.

SurfaceSpeed, ours (m/s)Speed, baseline (m/s)COT, oursCOT, baseline
Moss0.4520.1990.4230.625
Mud0.3380.1970.6920.931
Vegetation0.248not measured (baseline failed)1.23not measured

On moss the controller is about 2.3 times faster, and its COT is about 32 percent lower. On mud it is about 1.7 times faster, with a COT about 26 percent lower. The baseline could not complete the vegetation trials at all, which the authors count as a larger difference than the table shows. The baseline's failures were recorded but not folded into the speed numbers, because the operator reset the robot after each fall.

Other experiments in the paper cover a 16.8 cm step climbed in an indoor test, a 10 kg payload on a step, debris that shifts under the feet, and a steep descent of about 45 degrees and an 18 cm stair rise during the DARPA Subterranean Challenge. The step-height success rates were measured over 10 trials per condition. Ablation studies in simulation, with five random seeds per model, showed that the sequence model, the privileged teacher and the adaptive curriculum each contribute to performance. The experiments vary the length of the history window, and the history matters: the student needs enough past readings to infer the terrain.

Why it mattered

The paper showed that the usual route to robust locomotion, a large hand-tuned set of state machines and reflexes, was not the only one. A learned controller that uses only proprioception can handle natural terrain that defeats camera-based systems. It is a demonstration of sim-to-real transfer at a difficulty level that had not been reached before for quadrupeds in the field.

Its ideas spread into later legged-robot work, including the line of research on adapting to terrain from sensor history (see RMA). Its emphasis on sensor histories rather than explicit contact estimation is one of the lasting design choices it introduced.

Reading guide

Read the prerequisites in this order for a smooth path through the paper:

  1. Reinforcement Learning and Markov Decision Process: the paper frames the teacher as an MDP trained by a policy-optimisation method.
  2. Feedforward Neural Network: the teacher and the encoder are multi-layer networks, and the student's output head uses the same building blocks.
  3. Policy Gradient and TRPO: the method behind the teacher's training. Read these before Results, which reports the teacher's training behaviour.
  4. Curriculum Learning: needed for the adaptive terrain curriculum section.
  5. Knowledge Distillation and Behavior Cloning: needed for the student policy, which copies the teacher through supervised regression.
  6. DAgger: needed to understand why the student is trained on its own visited states.
  7. Robot Kinematics: needed for the foot targets and the inverse kinematics step in the motion synthesis.
  8. Domain Randomization: useful context for the sim-to-real choices in the simulation section.

For the Results section you need only the first sections of this list, plus the idea of traversability from the curriculum.

Check yourself

QuestionRecall: what is the difference between the teacher policy and the student policy in this paper?Show answer
The teacher sees privileged information from the simulator, such as the true terrain and contact states, and is trained with reinforcement learning. The student sees only the robot's own sensor history, and it is trained by supervised imitation of the teacher. Only the student runs on the real robot.
QuestionComputation: a controller has an average speed of 0.452 m/s on moss, and the baseline has 0.199 m/s. By what factor is the controller faster?Show answer
The factor is 0.452 divided by 0.199, which is about 2.27. The controller is roughly 2.3 times faster on this surface.
QuestionWhy: why does the curriculum keep terrains with traversability between 0.5 and 0.9, rather than always training on the hardest terrain the policy can barely cross?Show answer
A terrain with traversability below 0.5 gives too little successful experience to learn from, so training signal is sparse. A terrain with traversability above 0.9 is too easy to teach anything new. The middle range keeps the policy on the edge of its skill, where improvement is fastest. The particle filter keeps the training distribution in that band as the policy improves.
QuestionApplied: a team wants to adapt this method to a wheeled robot that has a camera and a laser scanner, but no joint-level sensing of its wheels. Which parts of the method transfer, and which need to change?Show answer
The idea of teacher-student training with privileged simulator information transfers, and so does the curriculum that keeps terrain at a useful difficulty. The student's inputs must change: the design relies on the robot's joint and body history, so the team would need to define a sensor history that the wheeled robot actually has, such as wheel odometry and inertial readings. The gait prior, with its foot trajectories, does not apply to wheels and would need replacing. The team should also check whether an exteroceptive sensor, which the paper avoids, could help on their terrain.

Sources

Read the full paper

Joonho Lee, Jemin Hwangbo, Lorenz Wellhausen et al., 2020. arXiv:2010.11251