unilab.envs.locomotion.common.terrain_spawn

Spawn-origin managers for locomotion envs.

BaseSpawnManager is a no-op default: every env spawns at the world origin (plus the existing per-env xy jitter from the dr_provider). Used whenever the env has no procedural terrain — flat scenes don’t need spatial separation

TerrainSpawnManager overrides this for terrain scenes: it indexes terrain_origins[level, type_col] so each env spawns on a specific cell, and optionally promotes/demotes level per-env on episode end. With enabled=True levels start at 0; with enabled=False levels are uniformly distributed and never change — but spawn still uses cell-aware xyz so robots land on the correct surface height.

Classes

BaseSpawnManager

Default no-op spawn manager: returns zeros, records nothing.

TerrainCurriculumCfg

TerrainCurriculumCfg(enabled: 'bool' = False, promote_frac: 'float' = 0.5, demote_frac: 'float' = 0.25, cycle_top_frac: 'float' = 0.5, spawn_height_margin: 'float' = 0.05, seed: 'int | None' = None)

TerrainSpawnManager

class unilab.envs.locomotion.common.terrain_spawn.BaseSpawnManager[source]

Bases: object

Default no-op spawn manager: returns zeros, records nothing.

origins_for(env_ids)[source]
Parameters:

env_ids (ndarray)

Return type:

ndarray

apply_spawn(env_ids, qpos_xyz, *, yaw=None)[source]
Parameters:
Return type:

ndarray

record_episode_start(env_ids, qpos_xyz)[source]
Parameters:
Return type:

None

update_on_done(done_indices, current_xyz)[source]
Parameters:
Return type:

dict[str, float]

class unilab.envs.locomotion.common.terrain_spawn.TerrainCurriculumCfg[source]

Bases: object

TerrainCurriculumCfg(enabled: ‘bool’ = False, promote_frac: ‘float’ = 0.5, demote_frac: ‘float’ = 0.25, cycle_top_frac: ‘float’ = 0.5, spawn_height_margin: ‘float’ = 0.05, seed: ‘int | None’ = None)

Parameters:
enabled: bool = False

If True, levels start at 0 and evolve via promote/demote.

promote_frac: float = 0.5

Walked distance > promote_frac * cell_size promotes one level.

demote_frac: float = 0.25

Walked distance < demote_frac * cell_size demotes one level.

cycle_top_frac: float = 0.5

When level overflows the top row, resample uniformly in [num_rows * cycle_top_frac, num_rows - 1].

spawn_height_margin: float = 0.05

Extra z added on top of the sampled terrain surface height.

seed: int | None = None
__init__(enabled=False, promote_frac=0.5, demote_frac=0.25, cycle_top_frac=0.5, spawn_height_margin=0.05, seed=None)
Parameters:
class unilab.envs.locomotion.common.terrain_spawn.TerrainSpawnManager[source]

Bases: BaseSpawnManager

Parameters:
__init__(num_envs, terrain_origins, cell_size, cfg, terrain_surface_sampler=None, spawn_height_points=None)[source]
Parameters:
property enabled: bool
origins_for(env_ids)[source]
Parameters:

env_ids (ndarray)

Return type:

ndarray

apply_spawn(env_ids, qpos_xyz, *, yaw=None)[source]
Parameters:
Return type:

ndarray

record_episode_start(env_ids, qpos_xyz)[source]
Parameters:
Return type:

None

update_on_done(done_indices, current_xyz)[source]
Parameters:
Return type:

dict[str, float]