Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

BipedalWalker

State space

The SVector<f32, 24> observation contains, in order: hull angle; scaled hull angular, horizontal, and vertical velocity; left hip angle/speed; left knee angle-plus-one/speed; left foot contact; the corresponding five right-leg values; and 10 normalized lidar hit fractions. If lidar_count differs from 10, values are copied into the fixed 24-vector up to its capacity and remaining elements are zero.

Action space

The continuous SVector<f32, 4> controls left hip, left knee, right hip, and right knee. Values are clipped to \([-1,1]\) when applied. With control_speed=false, sign chooses target direction and magnitude scales maximum motor torque. With control_speed=true, the value scales target speed while maximum torque stays fixed. There is no discrete mode.

Dynamics and reward

Rapier advances one step with \(\Delta t=1/\text{fps}\). Joint motors and contact constraints enter the shared rigid-body equation from the backend chapter. Define

\[ H_t=130x_t/\text{scale}-5|\theta_t|. \]

The ordinary reward is

\[ r_t=H_t-H_{t-1}-0.00035,\tau_{motor}\sum_i\operatorname{clip}(|a_i|,0,1). \]

Hull contact or movement behind \(x=0\) overrides it with \(-100\).

Episode end

Termination occurs on hull contact, \(x<0\), or reaching the end of the generated track. Truncation occurs at max_episode_steps.

Configuration

FieldsDefaultsMeaning
fps, scale50, 30Simulation rate and geometry scale
motors_torque80Joint motor authority
speed_hip, speed_knee4, 6Motor target-speed scales
lidar_range, lidar_count160/scale, 10Terrain ray sensors
initial_random5Initial perturbation magnitude
hull_verticesfive default pointsHull polygon before scaling
leg_down, leg_w, leg_h-8/scale, 8/scale, 34/scaleLeg geometry
viewport_w/h600, 400Velocity normalization dimensions
terrain_step/length/height14/scale, 200, viewport_h/scale/4Track geometry
terrain_grass/startpad10, 20Terrain generation parameters
friction2.5Terrain friction
hardcorefalseGenerate harder terrain obstacles
control_speedfalseSelect motor interpretation
max_episode_steps1600Truncation horizon

All fields are public; builders cover the common mode, rate, horizon, scale, and hull changes. Info is ().

Reference: Gymnasium BipedalWalker.