mjlab.scene#

Scene management.

class mjlab.scene.Scene[source]#

Bases: object

__init__(scene_cfg: SceneCfg, device: str) None[source]#
compile() MjModel[source]#
property device: str#
property entities: dict[str, Entity]#
property env_origins: Tensor#
property env_spacing: float#
initialize(mj_model: MjModel, model: mujoco_warp.Model, data: mujoco_warp.Data)[source]#
property num_envs: int#
reset(env_ids: Tensor | slice | None = None) None[source]#
property sensor_context: SensorContext | None#

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

property sensors: dict[str, Sensor]#
property spec: MjSpec#
property terrain: TerrainImporter | None#
to_zip(path: Path) None[source]#

Export the scene to a zip file.

Warning: The generated zip may require manual adjustment of asset paths to be reloadable. Specifically, you may need to add assetdir=”assets” to the compiler directive in the XML.

Parameters:

path – Output path for the zip file.

TODO: Verify if this is fixed in future MuJoCo releases.

update(dt: float) None[source]#
write_data_to_sim() None[source]#
class mjlab.scene.SceneCfg[source]#

Bases: object

__init__(*, num_envs: int = 1, env_spacing: float = 2.0, terrain: ~mjlab.terrains.terrain_importer.TerrainImporterCfg | None = None, entities: dict[str, ~mjlab.entity.entity.EntityCfg] = <factory>, sensors: tuple[~mjlab.sensor.sensor.SensorCfg, ...] = <factory>, extent: float | None = None, spec_fn: ~typing.Callable[[~mujoco._specs.MjSpec], None] | None = None) None#
env_spacing: float = 2.0#
extent: float | None = None#
num_envs: int = 1#
spec_fn: Callable[[MjSpec], None] | None = None#
terrain: TerrainImporterCfg | None = None#
entities: dict[str, EntityCfg]#
sensors: tuple[SensorCfg, ...]#