gs.morphs.Terrain#
- class genesis.options.morphs.Terrain(*, pos: tuple = (0.0, 0.0, 0.0), euler: tuple | None = None, quat: tuple | None = None, visualization: bool = True, collision: bool = True, requires_jac_and_IK: bool = False, is_free: bool | None = None, randomize: bool = False, n_subterrains: Tuple[int, int] = (3, 3), subterrain_size: Tuple[float, float] = (12.0, 12.0), horizontal_scale: float = 0.25, vertical_scale: float = 0.005, uv_scale: float = 1.0, subterrain_types: Any = [['flat_terrain', 'random_uniform_terrain', 'stepping_stones_terrain'], ['pyramid_sloped_terrain', 'discrete_obstacles_terrain', 'wave_terrain'], ['random_uniform_terrain', 'pyramid_stairs_terrain', 'sloped_terrain']], height_field: Any = None, name: str | None = None, from_stored: Any = None, subterrain_parameters: dict[str, dict] | None = None)[source]#
Morph for creating a rigid terrain. This can be instantiated from two choices: 1) a grid of subterrains generated using the given configurations 2) a terrain generated using the given height field.
If randomize is True, subterrain type that involves randomness will have random parameters. Otherwise, they will use fixed random seed 0.
Users can easily configure the subterrain types by specifying the subterrain_types parameter. If using a single string, it will be repeated for all subterrains. If it’s a 2D list, it should have the same shape as n_subterrains. The supported subterrain types are:
‘flat_terrain’: flat terrain
‘random_uniform_terrain’: random uniform terrain
‘sloped_terrain’: sloped terrain
‘pyramid_sloped_terrain’: pyramid sloped terrain
‘discrete_obstacles_terrain’: discrete obstacles terrain
‘wave_terrain’: wave terrain
‘stairs_terrain’: stairs terrain
‘pyramid_stairs_terrain’: pyramid stairs terrain
‘stepping_stones_terrain’: stepping stones terrain
Note
Rigid terrain will also be represented as SDF for collision checking, but its resolution is auto-computed and ignores the value specified in gs.materials.Rigid().
- Parameters:
file (str) – The path to the file.
scale (float or tuple, optional) – The scaling factor for the size of the entity. If a float, it scales uniformly. If a 3-tuple, it scales along each axis. Defaults to 1.0. Note that 3-tuple scaling is only supported for gs.morphs.Mesh.
pos (tuple, shape (3,), optional) – The position of the entity in meters. Defaults to (0.0, 0.0, 0.0).
visualization (bool, optional) – Whether the entity needs to be visualized. Set it to False if you need a invisible object only for collision purposes. Defaults to True. visualization and collision cannot both be False.
collision (bool, optional) – Whether the entity needs to be considered for collision checking. Defaults to True. visualization and collision cannot both be False.
randomize (bool, optional) – Whether to randomize the subterrains that involve randomness. Defaults to False.
n_subterrains (tuple of int, optional) – The number of subterrains in x and y directions. Defaults to (3, 3).
subterrain_size (tuple of float, optional) – The size of each subterrain in meters. Defaults to (12.0, 12.0).
horizontal_scale (float, optional) – The size of each cell in the subterrain in meters. Defaults to 0.25.
vertical_scale (float, optional) – The height of each step in the subterrain in meters. Defaults to 0.005.
uv_scale (float, optional) – The scale of the UV mapping for the terrain. Defaults to 1.0.
subterrain_types (str or 2D list of str, optional) – The types of subterrains to generate. If a string, it will be repeated for all subterrains. If a 2D list, it should have the same shape as n_subterrains.
height_field (array-like, optional) – The height field to generate the terrain. If specified, all other configurations will be ignored. Defaults to None.
name (str, optional) – The name of the terrain. If specified, the terrain will only be generated once for a given set of options and later loaded from cache, instead of being re-generated systematically when building the scene. This holds true no matter if randomize is True.
from_stored (str, optional) – This parameter is deprecated.
subterrain_parameters (dictionary, optional) – Lets users pick their own subterrain parameters.