mjlab.scene#

Classes

Scene#

class mjlab.scene.Scene[source]#
__init__(scene_cfg: SceneCfg, device: str) None[source]#
write(output_dir: Path, *, zip: bool = False) None[source]#

Write the scene XML and mesh assets to a directory.

Creates scene.xml and an assets/ subdirectory containing mesh files referenced by the scene. When zip is True the directory is compressed into a .zip archive and the directory is removed. Operates on a copy of the spec to avoid mutation.

Parameters:
  • output_dir – Destination directory (created if it doesn’t exist).

  • zip – If True, produce <output_dir>.zip instead of a directory.

to_zip(path: Path) None[source]#

Deprecated. Use write(output_dir, zip=True) instead.

property sensor_context: SensorContext | None#

Shared sensing resources, or None if no cameras/raycasts.

class mjlab.scene.SceneCfg[source]#

Configuration for a simulation scene.

num_envs: int = 1#

Number of parallel environments.

env_spacing: float = 2.0#

Spacing between environment origins in meters.

terrain: TerrainEntityCfg | None = None#

Terrain configuration. If None, no terrain is added.

entities: dict[str, EntityCfg]#

Mapping of entity names to their configurations.

sensors: tuple[SensorCfg, ...]#

Sensor configurations to attach to the scene.

extent: float | None = None#

Override for mjModel.stat.extent. If None, MuJoCo computes it automatically.

spec_fn: Callable[[MjSpec], None] | None = None#

Optional callback to modify the MjSpec after entities and sensors have been added but before compilation.