Skip to content

Types

All types are NamedTuple subclasses, which gives automatic JAX pytree registration. This means they can be passed through jit, vmap, and grad without additional setup.

Batching model: SimState is vmapped across a population. SpringTopology, PhysicsConstants, and ActuatorInfo are shared (unbatched) across the batch.


The core mutable state passed through every simulation step. Vmapped across population during training.

FieldShapedtypeDescription
positions(n_points, 2)float32Current point positions in world space (x, y)
velocities(n_points, 2)float32Current point velocities
positions_last(n_points, 2)float32Positions from the previous timestep, used by the integrator
velocities_true(n_points, 2)float32Finite-difference velocities, used for observation and reward
masses(n_points, 2)float32Per-point mass (broadcast across x/y)
fixed(n_points, 2)boolWhether each point is pinned (zero velocity applied)
point_mask(n_points,)boolActive point mask; padded points are False
spring_rest_length(n_springs,)float32Current rest length used by the spring force computation
spring_rest_length_goal(n_springs,)float32Target rest length that actuators drive toward
spring_init_rest_length(n_springs,)float32Rest length at spawn time; reference for deformation measurement
spring_const(n_springs,)float32Spring stiffness coefficient
spring_mask(n_springs,)boolActive spring mask; padded springs are False
rigid_spring_mask(n_springs,)boolTrue for springs eligible for Phase 2 PBD. Current builders mark RIGID springs and FIXED springs that remain in dynamic mixed objects.
external_forces(n_points, 2)float32Per-point external forces applied before integration
tangential_deformation(n_points, 2)float32Optional tangential memory for non-slope static friction models
friction_anchor(n_points, 2)float32Optional world-space PBD anchor for non-slope terrain friction
friction_anchor_active(n_points,)boolActive mask for friction anchors
friction_anchor_no_contact_count(n_points,)int32Persistence counter for friction anchors
static_manifold_*variesmixedLegacy static-contact memory fields; slope manifold behavior is inactive in the stable boundary

These are constructed once per world and shared (not vmapped) across a population batch.

Scalar hyperparameters that govern the simulation.

FielddtypeDescription
dtfloatTimestep duration in seconds
gravityfloatGravitational acceleration (positive = downward)
viscous_dragfloatLinear drag coefficient applied to all velocities
collision_const_groundfloatImpulse strength for robot-ground collisions
collision_const_objfloatImpulse strength for robot-object collisions
collision_vel_dampingfloatVelocity damping applied on collision contact
ground_vel_dampingfloatGround-plane normal damping extension
collision_base_distfloatMinimum separation distance before collision response
dynamic_friction_constfloatFriction coefficient for dynamic contacts
friction_constfloatObject-object friction constant (default 1200)
ground_friction_constfloatGround friction constant (default 10)
actuator_convergencefloatRate at which spring rest length converges toward goal
integratorintIntegration scheme: 0 = RK4, 1 = symplectic Euler
static_friction_constfloatOpt-in non-slope terrain stiction coefficient
terrain_stiction_stiffnessfloatOpt-in non-slope terrain stiction stiffness
ground_stiction_stiffnessfloatOpt-in ground-plane stiction stiffness
floor_static_friction_constfloatOpt-in flat floor stiction coefficient independent of terrain stiction
floor_stiction_stiffnessfloatOpt-in flat floor stiction stiffness
ground_static_friction_constfloatOpt-in ground-plane static-friction coefficient
terrain_stiction_scopeintScope selector for non-slope static terrain stiction; slope-only scope is currently inert
friction_modelintCompatibility selector for projected friction memory on non-slope stiction contacts
friction_constraint_modeintOptional terrain PBD anchor mode for non-slope stiction contacts
slope_contact_*mixedCompatibility fields retained as no-ops for geometry-only experimental slopes
slope_grip_*mixedCompatibility fields retained as no-ops for geometry-only experimental slopes

Use default_physics_constants() to get the standard configuration. Flat ground and flat static-terrain friction are stable. Experimental slope terrain does not use tangential friction/support fields.

The fixed connectivity graph of the spring-mass system. Shared across batch.

FieldShapedtypeDescription
a_idx(n_springs,)int32Index of the first endpoint point for each spring
b_idx(n_springs,)int32Index of the second endpoint point for each spring

Maps actuator cells to the springs they control. Shared across batch.

FieldShapedtypeDescription
cell_spring_indices(n_actuator_cells, 2)int32Indices of the two springs controlled by each actuator cell
spring_act_count(n_springs,)float32Number of actuator cells sharing each spring (for averaging)
actuated_spring_mask(n_springs,)boolTrue for springs that belong to at least one actuator cell

Extended actuator bookkeeping that separates horizontal and vertical springs, used by controllers that apply axis-aligned actions.

FieldShapedtypeDescription
h_spring_pairs(H*W, 2)int32Horizontal spring pair indices for every grid cell
v_spring_pairs(H*W, 2)int32Vertical spring pair indices for every grid cell
h_compact_cell_indices(N_compact_max,)int32Indices of cells with active horizontal actuators
v_compact_cell_indices(N_compact_max,)int32Indices of cells with active vertical actuators
h_compact_spring_pairs(N_compact_max, 2)int32Horizontal spring pairs for compact actuator cells only
v_compact_spring_pairs(N_compact_max, 2)int32Vertical spring pairs for compact actuator cells only
h_compact_count()int32Number of active horizontal actuator cells
v_compact_count()int32Number of active vertical actuator cells
actuated_spring_mask(n_springs,)boolTrue for springs controlled by any actuator
spring_act_count(n_springs,)float32Actuator cell share count per spring

Precomputed dynamic collision structures for robot-terrain and robot-robot contacts. Built once from the world geometry and reused each step.

FieldShapedtypeDescription
boxel_corners(n_boxels, 4)int32Corner point indices for each collision boxel
boxel_edge_a(n_boxels, 4)int32First endpoint index of each boxel edge
boxel_edge_b(n_boxels, 4)int32Second endpoint index of each boxel edge
boxel_mask(n_boxels,)boolActive boxel mask
surface_edge_mask(n_boxels, 4)boolTrue for edges that face outward (participate in contact)
boxel_object_id(n_boxels,)int32Object identifier for each boxel
boxel_is_robot(n_boxels,)boolTrue if the boxel belongs to the robot
boxel_world_vy(n_boxels,)int32Grid row of the boxel in world space
boxel_world_vx(n_boxels,)int32Grid column of the boxel in world space
corner_edge_indices(4, 2)int32Lookup table: for each corner, which two edges share it
n_real_pointsintCount of non-padded points
triple_i/j/k(MAX_TRIPLES,)int32Point-edge-point triples for dynamic collision pairs
triple_active(MAX_TRIPLES,)boolActive mask for each collision triple
triple_pair_slot(MAX_TRIPLES,)int32Broadphase slot that produced each triple
self_triple_i/j/k(MAX_SELF_TRIPLES,)int32Self-collision triples (robot against itself)
self_triple_active(MAX_SELF_TRIPLES,)boolActive mask for self-collision triples
candidate_pair_i/j(MAX_TRIPLES,)int32Broadphase candidate pairs before narrowphase
candidate_pair_active(MAX_TRIPLES,)boolActive mask for candidate pairs
n_triplesintDiagnostic count of active collision triples
n_self_triplesintDiagnostic count of active self-collision triples
n_candidate_pairsintDiagnostic count of broadphase candidate pairs

Precomputed collision representation of fixed terrain. Points are constant throughout simulation.

FieldShapedtypeDescription
point_positions(n_static_points, 2)float32Fixed world-space positions of terrain vertices
cell_vertices(n_static_cells, 4)int32Vertex indices for each static cell (padded to 4)
cell_vertex_count(n_static_cells,)int32Actual vertex count per cell (3 for triangles, 4 for quads)
cell_edge_a(n_static_cells, 4)int32First endpoint index of each cell edge
cell_edge_b(n_static_cells, 4)int32Second endpoint index of each cell edge
surface_edge_mask(n_static_cells, 4)boolTrue for outward-facing (collidable) edges
cell_types(n_static_cells,)int32Voxel type constant for each static cell
cell_aabb_min(n_static_cells, 2)float32Static cell AABB minimum
cell_aabb_max(n_static_cells, 2)float32Static cell AABB maximum
column_cell_indices(n_columns, max_cells_per_column)int32Column acceleration structure
column_cell_count(n_columns,)int32Active static cells per column

Describes a single object (robot or terrain block) before it is instantiated into a world. Holds 35+ fields covering the grid layout, voxel types, spring topology, mass and stiffness assignments, point masks, and axis-aligned actuator metadata. You generally do not construct this directly — it is produced by the robot/terrain loaders and consumed by the world builder.

A complete description of a world layout, ready to be built into a BuiltWorld.

FieldTypeDescription
grid_hintTotal world grid height in voxels
grid_wintTotal world grid width in voxels
robot_namestrIdentifier string for the robot morphology
object_templatestuple[ObjectTemplate, ...]Ordered sequence of all objects in the world
robot_template_indexintIndex into object_templates identifying the robot

Pairs a primary world with an optional mirror for symmetric training.

FieldTypeDescription
primaryWorldTemplateThe canonical world
mirrorWorldTemplate | NoneHorizontally mirrored world, or None if unused
mirror_modeLiteral["none", "paired"]How the mirror is used during training

The fully instantiated, ready-to-simulate world. All arrays are sized and padded; this is what environments hold at construction time.

FieldTypeDescription
sim_stateSimStateInitial simulation state at spawn
topologySpringTopologyFixed spring connectivity graph
constantsPhysicsConstantsPhysics hyperparameters
collision_dataCollisionDataDynamic collision structures
static_collider_dataStaticColliderDataStatic terrain collision data
actuator_infoActuatorInfoActuator-to-spring mapping
per_axis_infoPerAxisActuatorInfoPer-axis actuator bookkeeping
deformation_infoDeformationInfoRobot deformation measurement data
robot_point_indicesjnp.ndarrayIndices into sim_state.positions for robot points
robot_point_maskjnp.ndarrayBoolean mask over all points identifying robot points
dynamic_terrain_point_indicesjnp.ndarrayIndices for moveable terrain points
fixed_terrain_sample_positionsjnp.ndarrayStatic sample positions used for terrain observations
render_infoRenderInfoStatic rendering metadata
grid_hintWorld grid height
grid_wintWorld grid width

Each environment carries a sim_state plus the minimal bookkeeping needed to compute rewards and detect episode termination.

Used by the locomotion (walker) environment.

FieldShapedtypeDescription
sim_stateSimStateFull simulation state
step_count()int32Steps elapsed in the current episode
done()boolWhether the episode has ended
prev_com_x()float32Robot centre-of-mass x from the previous step, for velocity reward

Used by shape (height / wingspan) environments. Rewards are based on the robot’s spatial extent rather than locomotion.

FieldShapedtypeDescription
sim_stateSimStateFull simulation state
step_count()int32Steps elapsed
done()boolEpisode ended flag
prev_span()float32Previous step’s height or wingspan measurement

Used by environments that penalise deviating from the robot’s initial orientation (e.g. balance or directed locomotion tasks).

FieldShapedtypeDescription
sim_stateSimStateFull simulation state
step_count()int32Steps elapsed
done()boolEpisode ended flag
prev_com_x()float32Previous centre-of-mass x
initial_robot_positions(n_robot_points, 2)float32Spawn positions used as orientation reference

Used by the jump environment. Tracks both x and y components of the centre of mass.

FieldShapedtypeDescription
sim_stateSimStateFull simulation state
step_count()int32Steps elapsed
done()boolEpisode ended flag
prev_com_x()float32Previous centre-of-mass x
prev_com_y()float32Previous centre-of-mass y, for vertical reward

Used by the climb environment. Rewards upward movement only.

FieldShapedtypeDescription
sim_stateSimStateFull simulation state
step_count()int32Steps elapsed
done()boolEpisode ended flag
prev_com_y()float32Previous centre-of-mass y

The raw grid-aligned spring-mass layout for a single object before it is merged into a world. Produced by the object builder.

FieldShapedtypeDescription
positions((H+1)*(W+1), 2)float32Initial vertex positions on the grid lattice
spring_a_idx(n_springs,)int32First endpoint index of each spring
spring_b_idx(n_springs,)int32Second endpoint index of each spring
spring_rest_length(n_springs,)float32Rest length of each spring
spring_types(n_springs,)int32Spring orientation: 0 = horizontal, 1 = vertical, 2 = diagonal
spring_cell_a(n_springs,)int32Primary cell owning each spring
spring_cell_b(n_springs,)int32Secondary cell sharing each spring (if any)
cell_corner_indices(H*W, 4)int32Corner point indices per cell: [BL, BR, TR, TL]
cell_grid_vy(H*W,)int32Grid row of each cell
cell_grid_vx(H*W,)int32Grid column of each cell
cell_horiz_bottom(H*W,)int32Bottom horizontal spring index for each cell
cell_horiz_top(H*W,)int32Top horizontal spring index for each cell
cell_vert_left(H*W,)int32Left vertical spring index for each cell
cell_vert_right(H*W,)int32Right vertical spring index for each cell
cell_diag1(H*W,)int32First diagonal spring index for each cell
cell_diag2(H*W,)int32Second diagonal spring index for each cell
HintGrid height in voxels
WintGrid width in voxels

Indices needed to compute per-voxel deformation observations from spring rest lengths.

FieldShapedtypeDescription
voxel_horiz_springs(n_robot_voxels, 2)int32Indices of the top and bottom horizontal springs per voxel; -1 if missing
voxel_vert_springs(n_robot_voxels, 2)int32Indices of the left and right vertical springs per voxel; -1 if missing
n_robot_voxelsintNumber of active robot voxels

Static, Python-side metadata built once and used each render call. Contains numpy arrays (not JAX).

FieldShapedtypeDescription
cell_vertices(n_cells, 4)int32Vertex indices per cell
cell_vertex_count(n_cells,)int32Actual vertex count (3 or 4) per cell
cell_types(n_cells,)int32Voxel type constant for each cell
cell_mask(n_cells,)boolActive cell mask
surface_edge_mask(n_cells, 4)boolOutward-facing edge mask for rendering borders
cell_is_robot(n_cells,)boolTrue for robot cells
cell_is_dynamic(n_cells,)boolTrue for non-static cells
cell_object_id(n_cells,)int32Object identifier per cell
robot_point_indices(n_robot_points,)int32Which global points belong to the robot
grid_hintWorld grid height
grid_wintWorld grid width
actuator_cell_indices(n_actuator_cells,)int32Cell indices for actuator colouring
cell_h_spring_pairs(n_cells, 2)int32Horizontal spring pair indices per cell
cell_v_spring_pairs(n_cells, 2)int32Vertical spring pair indices per cell
spring_init_rest_length(n_springs,)float32Initial rest lengths for deformation visualisation
static_point_positions(n_static_points, 2)float32Fixed terrain vertex positions

The minimal slice of simulation state returned by env.step() when rendering is enabled.

FieldShapedtypeDescription
positions(n_points, 2)float32Current point positions
spring_rest_length(n_springs,)float32Current spring rest lengths (for deformation colour)
reward()float32Reward received this step
done()boolWhether the episode ended

The full output of env.step() during training (no rendering overhead).

FieldShapedtypeDescription
obs(obs_dim,)float32Observation vector for the current step
reward()float32Reward received this step
done()boolWhether the episode ended
positions(n_points, 2)float32Current point positions (for logging / visualisation)

A @dataclass (not a NamedTuple) controlling the renderer. All fields have defaults.

FieldDefaultDescription
enabledFalseWhether to render at all
width / heightOutput frame dimensions in pixels
fpsTarget playback frame rate
real_timeFalseThrottle rendering to wall-clock time
frame_skip1Render every N-th simulation step
show_gridFalseOverlay the voxel grid
show_edgesTrueDraw cell border edges
dynamic_actuator_colorsFalseColour actuators by current activation level
camera_paddingFraction of frame to pad around the robot
viewport_widthWorld-space units visible horizontally
camera_mode"follow" or "fixed"
camera_smoothingExponential smoothing factor for follow camera
supersample1Anti-aliasing multiplier (render at N× then downscale)
grid_major_everyDraw a heavier grid line every N cells
show_minor_gridFalseDraw minor grid lines
edge_width_pxEdge stroke width in pixels
output_dirDirectory for saved frames or video
target_framesStop recording after this many frames
max_colorsPalette size cap for GIF optimisation
optimizeTrueApply output file optimisation
ditherFalseEnable dithering in GIF output

from jax_evogym import default_physics_constants
constants = default_physics_constants()

Returns a PhysicsConstants instance with the standard simulation parameters. Slope contact/grip fields remain present on the tuple for compatibility, but they are no-ops under the current geometry-only slope boundary. Override individual fields using ._replace():

constants = default_physics_constants()._replace(integrator=1)