unilab.terrains.terrain_generator.TerrainGenerator¶
- class unilab.terrains.terrain_generator.TerrainGenerator[source]¶
Bases:
objectGenerates procedural terrain grids with configurable difficulty.
Creates a grid of terrain patches where each patch can be a different terrain type. Supports two modes:
- Random mode (curriculum=False): Every patch independently samples a
terrain type weighted by proportions. Results in random variety across all patches.
- Curriculum mode (curriculum=True): Each terrain type gets exactly one column
(the generator uses
len(sub_terrains)columns regardless ofnum_cols). Difficulty increases along rows. Theproportionfield controls robot spawning distribution, not column count.
Terrain types are weighted by proportion and their geometry is generated based on a difficulty value in the configured range. The grid is centered at the world origin. A border can be added around the entire grid along with optional overhead lighting.
- Parameters:
cfg (
TerrainGeneratorCfg)device (
str)
Methods
__init__(cfg[, device])generate()Generate the full terrain as one backend-agnostic merged hfield.
write_png(path)- __init__(cfg, device='cpu')[source]¶
- Parameters:
cfg (
TerrainGeneratorCfg)device (
str)