Robotics · Shuja Abidi

Background

How does a robot with legs move?

A walking robot has to answer two questions all the time: where should I go, and how do I move my legs without falling over? This page explains both, for four-legged and two-legged robots, and shows how the answers moved from hand-written equations to learning.

1

Main concept

A robot moves in a loop: sense, decide, act, and sense again, many times a second.

Every moving robot, from a vacuum cleaner to a humanoid, runs the same loop. What changes is how hard each step is. For a legged robot, the hardest part is that the body is never fully still: it is always falling a little, and the legs keep catching it.

Sensorscameras, lidar, IMU,joint encoders Perceptionmap, obstacles,people, ground Planningwhere to go:a path and a speed Controlhow to move: leg andjoint targets, balance Motors + bodytorque at each joint,feet push the ground the body moves, so the sensors measure something new, and the loop runs again SLOW · 1–10 TIMES A SECOND FAST · 50–1000 TIMES A SECOND e.g. "walk forward at 0.5 m/s, turn left slowly"
Planning and control run at very different speeds. Planning can take a fraction of a second to think. Control can't: if a leg reacts late, the robot falls.

The body: joints, motors and sensors

Joints and degrees of freedom

Each joint that can move on its own is one degree of freedom. A robot dog usually has 3 per leg (12 in total). A humanoid has 6 or more per leg, plus a waist, arms and sometimes hands: 20 to over 40.

Motors

An electric motor at each joint produces a torque (a twisting force). The controller doesn't move the body directly. It only chooses torques, and the body moves because the feet push on the ground.

Sensors

An IMU measures tilt and turning, like the inner ear. Encoders measure each joint's angle. Cameras and lidar see the world. Some robots also feel when a foot touches the ground.

Balance: why legs are harder than wheels

Look straight down from above. The feet on the ground mark out a shape called the support polygon. If the robot's centre of mass sits above that shape, it can stand still without falling. That is static balance. If not, it is falling, and must move its feet in time to catch itself. That is dynamic balance, and it is how people, running dogs and most modern robots move.

Dog, 3 feet downcentre of mass inside: stable Dog trotting, 2 feet downsupport is a line: must keep moving Humanoid, 1 foot downtiny support: mostly dynamic
Filled circles and shaded shapes are feet on the ground. The orange dot is the centre of mass seen from above.

The one idea to remember: planning decides where the robot goes. Control decides how the legs move to get there without falling. Most of robotics research sits in one of these two layers.

2

Quadruped motion

Four legs give a robot dog choices: which feet to lift, in what order, and for how long.

Each leg repeats a cycle of two phases. In stance the foot is on the ground, pushing the body. In swing the foot is in the air, moving forward to its next spot. A gait is the pattern of when each leg is in stance. The duty factor is the fraction of the cycle a foot spends on the ground.

Pick a gait to see its pattern. Bars show when each foot is on the ground during one cycle.

front ↑ Feet down: 3 start of cycleend of cycle

Where to put the next foot

A simple rule, from Marc Raibert's work in the 1980s, still sits inside many controllers: place the foot ahead of the hip by an amount that grows with speed. Step further ahead and the robot slows down. Step closer and it speeds up. Step to the side and it turns or corrects a lean. The same rule lets a dog recover from a push: it simply steps where it is falling.

Pushing with the feet

While feet are on the ground, the controller decides how hard each one pushes, and in which direction, so the body stays level and moves at the right speed. Feet can only push, never pull, and they slip if they push too much sideways. That limit is called the friction cone, and good controllers respect it, especially on slopes.

A typical robot dog leg

  • Hip, sideways (abduction): swings the leg out from the body.
  • Hip, forward and back: swings the thigh.
  • Knee: bends the lower leg.

Three motors per leg, twelve in all. The foot is usually a rubber ball, so it has no ankle to control.

Why trot is the favourite

Diagonal pairs always balance each other, so the body stays level, and the gait works over a wide range of speeds. Most robot dogs trot by default.

3

Humanoid motion

Two legs, a high body and small feet: a humanoid is balancing on the edge all the time.

A humanoid spends most of each step on one foot. Its centre of mass is high, and the patch of ground it can push on is about the size of a shoe. So almost all of its balance is dynamic: it is always falling a little in the direction it wants to go, and catching itself with the next step.

centre of mass gravity tips forward capture pointstep here to stop stance foot SIDE VIEW · INVERTED PENDULUM FROM ABOVE · FOOTSTEPS AND ZMP left right left next orange: the zero moment point (ZMP) moves inside a foot, then crosses to the next one
Left: the simplest useful model of a walking humanoid. Right: the pressure point under the feet must stay inside the support area, or the foot starts to roll.

Inverted pendulum

Picture a heavy ball on top of a stick, standing on the foot. It wants to fall. Walking is the art of letting it fall forward, then placing the next foot so it falls the other way. Many controllers plan with this simple model, called the linear inverted pendulum.

Zero moment point

The ZMP is the point on the ground where the foot's pressure balances out. If it stays inside the foot, the foot stays flat. Honda's ASIMO and many robots after it walked by planning motions that keep the ZMP inside the feet.

Capture point

The capture point is where the robot would have to step to come to a complete stop. If it is pushed hard, a good controller steps there. If the point lies too far away to reach in one step, the robot needs two or more.

The walking cycle

  1. Double support: both feet are down, and the weight shifts from the back foot to the front foot.
  2. Single support: the back foot lifts and swings forward. The robot balances on one foot.
  3. Heel strike: the swing foot lands where the controller chose. The cycle repeats with the other leg.

The upper body matters too. Arms and waist swing to cancel the turning push of the legs, just as people swing their arms. Controlling all joints together, while keeping balance and respecting contact, is called whole-body control.

4

From control to AI

First engineers wrote the equations by hand. Now robots often learn to walk in simulation.

ApproachThe idea in one lineStrengthWeakness
Feedback (PID)Measure the error, push against it.Simple, fast, everywhere: it holds each joint at its target.Knows nothing about balance or the future.
Model-based walkingPlan motions with a simple physics model, such as the inverted pendulum and ZMP.Predictable and explainable.Careful and slow; struggles on rough ground.
Model predictive control (MPC)Every few milliseconds, plan the next fraction of a second, apply the first step, plan again.Handles limits such as friction; reacts to pushes.Needs a good model and fast computing.
Whole-body controlSolve for all joint torques at once, so many goals (balance, hands, feet) are met together.Uses the whole body.Complex to tune.
Reinforcement learning (RL)Let a neural network try millions of times in simulation and reward it for walking well.Robust on rough ground; recovers from pushes; fast to run.Hard to explain; must cross the gap from simulation to reality.

How a robot learns to walk

In reinforcement learning, the controller is a neural network called a policy. Many times a second it reads the robot's state (tilt, joint angles and speeds, the speed command) and outputs a target for each joint.

  1. Thousands of copies of the robot try to walk at once in a fast simulator on a graphics card.
  2. Each gets a reward: points for following the speed command, minus points for falling, wasting energy or jerky motion.
  3. The policy is adjusted, a little at a time, towards actions that earned more reward.
  4. The simulation is varied on purpose (different friction, weight, pushes, motor strength), so the policy can't rely on one exact world. This is called domain randomisation.
  5. After hours, sometimes minutes, the policy is copied to the real robot.

Today: the two are combined

Learning and control are not rivals. A common design today:

  • Learned policy for the legs, because it is robust.
  • Classical planning (maps and path search, or MPC) for where to go, because it is predictable and safe.
  • Large AI models are starting to sit on top, turning language and images into goals: "go to the kitchen and pick up the red cup".

Milestones

  1. The zero moment point.Miomir Vukobratović describes the ZMP, the basis of decades of humanoid walking.
  2. Hopping robots.Marc Raibert's hopping and running machines show that balance can come from where the foot is placed.
  3. ASIMO.Honda's humanoid walks smoothly with ZMP-based control.
  4. BigDog.Boston Dynamics' quadruped walks on rough ground, snow and ice.
  5. MIT Cheetah 3.Convex MPC plans foot forces in real time, for fast and agile running.
  6. Learning in simulation, walking for real.ETH Zurich's ANYmal walks with a policy trained by RL in simulation (Hwangbo et al., Science Robotics).
  7. Learned walking on hard terrain.An RL policy walks ANYmal over mud, snow and rubble outdoors (Lee et al., Science Robotics).
  8. Walking in minutes.Thousands of robots simulated at once on a graphics card learn to walk in minutes (Rudin et al., CoRL).
  9. Affordable robots, open policies.Low-cost quadrupeds and humanoids, such as Unitree's, bring legged robots to many labs, often with learned walking policies shared openly.

5

Practical examples

Four everyday situations, and which layer of the robot does the work in each.

PerceptionPlanningControl mark the layers from the main concept.

A robot dog climbs stairs

  1. PerceptionThe camera or lidar builds a height map: each step's height and depth.
  2. PlanningChoose to face the stairs straight on, and slow down.
  3. ControlLift each swinging foot higher, and place it on the middle of a step, away from the edge.

A "blind" learned policy can climb some stairs with no camera at all, by feeling each step through its legs. It is slower and less safe than one that can see.

A humanoid gets pushed

  1. ControlSmall push: shift the pressure in the feet and the ankles absorb it.
  2. ControlBigger push: bend at the hips to move the centre of mass back.
  3. ControlBig push: take a step towards the capture point, or several steps.

Planning isn't involved at all: there's no time. People recover the same way, with ankle, hip and stepping strategies.

Crossing a busy room to a door

  1. PerceptionFind walls, furniture and people, and guess where each person is heading.
  2. PlanningSearch for a path that keeps a polite distance, and plan again when someone steps in the way.
  3. ControlSimply follow the speed and turning command. The legs don't need to know about the people.

A humanoid picks up a box

  1. PerceptionFind the box, its size, and where to grip it.
  2. PlanningWalk to a spot in front of it, then plan the arm motion.
  3. ControlWhole-body control bends the knees and moves the hips back, so the weight of the box doesn't tip the robot forward.

Where legged robots work today