Skip to content

Legged locomotion ​

How a four-legged robot stays up while it moves: gaits and their timing, the support polygon, static and dynamic stability, and the foot-placement rule that Strido's trot generator uses.

In Strido

The scripted gait is TrotGait in packages/strido-core/src/strido/gait.py, shared by MuJoCo, Gazebo and the real robot (via ros2/strido_control/strido_control/gait_node.py). The learned policy (packages/strido-sim/) receives a clock with the same 0.4s period (GAIT_PERIOD_S in packages/strido-core/src/strido/policy.py). Practical usage is in Kinematics and gaits.

Gaits as timing patterns ​

A gait is a periodic pattern of foot contacts. Each leg i runs through one cycle of period T and is described by a phase ϕi∈[0,1):

ϕi(t)=(tT+δi)mod1

where δi is that leg's phase offset. The leg is in stance (foot on the ground, pushing) while ϕi<β and in swing (foot in the air, returning) otherwise. The duty factor β is the fraction of the cycle spent in stance:

β=TstanceT,Tstance=βT,Tswing=(1−β)T

Gaits differ only in β and the offsets δi:

GaitDuty factor βOffsets (FL, FR, RL, RR)Feet on ground
Walk (crawl)≥0.750,12,34,14always ≥3
Trot≈0.50,12,12,02 (a diagonal pair)
Pace≈0.50,12,0,122 (a lateral pair)
Bound≈0.50,0,12,122 (front or rear pair)

With β≥0.75 only one leg is ever in the air, so the walk can be statically stable. With β=0.5 two legs are always in the air; the trot relies on dynamic stability: the body would tip if frozen, but each pair lands before it falls far.

Centre of mass and the support polygon ​

The centre of mass (CoM) of bodies with masses mk at positions pk is

pCoM=∑kmkpk∑kmk

The support polygon is the convex hull of the contact points projected onto the ground. A robot standing still (or moving slowly enough that inertia is negligible) is statically stable if the ground projection of the CoM lies inside this polygon: gravity then produces no net tipping moment about any polygon edge.

The static stability margin is the shortest distance from the projected CoM to the polygon's boundary:

S=mine∈edgesd(pCoMxy,e)

S>0 means stable; larger S tolerates bigger pushes and modelling errors. In a trot the support "polygon" degenerates to the line segment between the two stance feet, so S≤0 almost always: static stability is impossible and the gait must be dynamic.

Beyond statics: ZMP and the capture point ​

When the body accelerates, inertial forces add to gravity. The zero-moment point (ZMP) is the point on the ground where the horizontal moments of gravity plus inertia vanish. For a point mass at height h with horizontal acceleration x¨ (the linear inverted pendulum model, constant height):

pZMP=xCoM−hgx¨CoM

The contact forces can only push, so the ZMP must stay inside the support polygon; if the plan demands a ZMP outside it, a foot rolls or lifts and the robot tips. ZMP planning is the classic tool for walking humanoids.

The same pendulum gives the capture point (instantaneous capture point, divergent component of motion). Its dynamics x¨=ω2(x−p) with ω=g/h have an unstable mode, and the point

ξ=xCoM+x˙CoMω

is where a foot must be placed for the body to come to rest above it. Intuition: the faster you are moving, the further ahead you must step to stop.

Worked example. Strido's default body height is h=0.17m (hip axis above the feet, GaitConfig.body_height). Then

ω=9.810.17≈7.6s−1,1ω≈0.13s

At the maximum forward command v=0.30m/s the capture point is about 0.30×0.13≈0.04m ahead of the CoM. The pendulum's time constant (0.13s) is comparable to the stance time (0.2s, below), which is why the gait has to keep stepping: a frozen trot would tip within a fraction of a second.

Raibert-style foot placement ​

Marc Raibert's hopping and running machines decomposed control into three parts: hopping height, body attitude, and forward speed via foot placement. The idea: during stance the body moves a distance vTstance over the foot. If the foot lands at the centre of that path, the body passes symmetrically over it and speed is preserved (the neutral point):

xf=vTstance2+k(v−vdes)

The feedback term k(v−vdes) moves the foot further forward to brake and further back to accelerate. It is a capture-point rule in disguise.

How Strido's trot generator works ​

TrotGait is a deliberately simple, deterministic, open-loop version of the above (no feedback term, k=0). Its defaults in GaitConfig:

ParameterValueMeaning
periodT=0.40sfull cycle
dutyβ=0.5trot: stance and swing equal
step_heighths=0.035mswing apex
body_height0.17mhip axis above the feet
max_linear|vx|≤0.30, |vy|≤0.15m/scommand clamp
max_yaw_rate|ωz|≤1.0rad/scommand clamp

PHASE_OFFSET gives FL and RR δ=0 and FR and RL δ=12: the diagonals alternate.

Per-foot velocity. For a command (vx,vy,ωz) and a foot's nominal position (px,py) in the body frame, the body moves over that foot with the rigid-body velocity v+ω×p, so the stance foot moves at −vi relative to the body:

vi=(vx−ωzpyvy+ωzpx0),si=viβT

where si is the stride over one stance.

Stance. With normalised stance progress s=ϕ/β∈[0,1), the foot slides from half a stride ahead to half a stride behind:

pi=pinom+si(12−s)

Swing. With s=(ϕ−β)/(1−β), the foot returns and lifts on a half-sine:

pi=pinom+si(s−12)+(00hssin⁡(πs))

So each foot lands at +si/2: exactly Raibert's neutral point vTstance/2. Foot targets are then converted to 12 joint angles by inverse kinematics (see Kinematics) and clamped to the joint and knee-crank limits (clamp_leg). With a zero command the feet stay at their nominal stance.

Worked example. Forward command vx=0.30m/s:

Tstance=0.5×0.40=0.20s,sx=0.30×0.20=0.06m

Each foot sweeps from +30mm to −30mm about its nominal position, then swings back in 0.20s peaking 35mm up. Its swing speed relative to the body is 0.06/0.20=0.30m/s on average and π2×0.035/0.10≈0.55m/s peak vertical speed.

For a pure turn, ωz=1.0rad/s: the front-left foot sits at px≈0.120m, py≈0.039+0.038=0.077m (hip and thigh offsets from packages/strido-core/src/strido/geometry.py), so v=(−0.077,0.120)m/s and the stride is (−15,24)mm: the feet sweep along a circle about the body centre.

Rendering diagram…

Limitations. Being open-loop, the generator does not react to pushes, slips or tilt: nothing moves the foot further forward when the body is too fast. That is the gap the learned policy fills — it sees the IMU and can learn feedback (see Reinforcement learning).

Check yourself ​

  1. A gait has β=0.8. How many feet are on the ground at any instant, and can it be statically stable?

    Answer

    Each leg is airborne for 20 % of the cycle; with staggered offsets only one leg swings at a time, so at least three feet are down. Yes, if the CoM stays inside the support triangle.

  2. Why is the static stability margin of a trot almost always non-positive?

    Answer

    Only two diagonal feet support the body, so the support polygon is a line segment; the CoM projection lies on it only by chance, never strictly inside it.

  3. In TrotGait, what is the stride length at vx=0.15m/s, and where does the foot land?

    Answer

    s=0.15×0.20=0.03m; the foot lands 15mm ahead of nominal.

  4. What does raising body_height do to the capture-point time constant?

    Answer

    1/ω=h/g grows, so the body tips more slowly but the capture point lies further ahead for the same speed.

  5. Which Raibert term is missing from Strido's trot, and what does that mean?

    Answer

    The speed-feedback term k(v−vdes). The gait cannot correct speed errors or disturbances.

Further reading ​

  • M. H. Raibert, Legged Robots That Balance, MIT Press, 1986.
  • B. Siciliano and O. Khatib (eds.), Springer Handbook of Robotics, 2nd ed., 2016 — chapters on legged robots and walking.
  • J. Pratt, J. Carff, S. Drakunov and A. Goswami, "Capture Point: A Step toward Humanoid Push Recovery", IEEE-RAS Humanoids, 2006.
  • M. Vukobratović and B. Borovac, "Zero-Moment Point — Thirty Five Years of Its Life", International Journal of Humanoid Robotics, 2004.
  • R. B. McGhee and A. A. Frank, "On the stability properties of quadruped creeping gaits", Mathematical Biosciences, 1968.

MIT licence. Mechanical design derived from Yertle by Jerome Graves. CAD, simulation and native tests are not hardware evidence — see Verification.