Skip to content

simulo.Scene

The scene authoring contract — a declarative description of what exists.

This is the surface a build(scene) method may rely on: adding robots, terrain, lights, sensors, and objects at logical paths; grouping them; and reading the environment layout. A scene describes what exists, not what happens.

Real usage, from the shipped cartpole training app’s build — every Task/Scenario shapes its scene the same way: shared items (per_environment=False) added once, then a robot added per environment:

def build(self, scene: simulo.Scene) -> None:
scene.add(simulo.Terrain.plane(name="ground"), at="/", per_environment=False)
scene.add(
simulo.Light.dome(name="light", intensity=2000.0, color=(0.75, 0.75, 0.75)),
at="/",
per_environment=False,
)
self.robot = simulo.Robot(asset=cartpole, initial_pose=simulo.Pose.identity())
scene.add(self.robot, at="/World/Robot")
Scene.num_envs: int

Number of parallel environment instances the scene spawns.

Scene.env_spacing: float

Spacing between environment origins, in meters.

Scene.root: str

property

The scene root path, discovered from the first path passed to add.

Defaults to "/World" when no items have been added yet.

Scene.add(item: Any, at: str = ..., per_environment: bool = ...) -> None

Add an item — robot, terrain, light, sensor, actuator, entity, marker — to the scene at a logical path.

per_environment=True (the default) clones the item per environment when num_envs > 1; pass per_environment=False for shared items like ground planes and global lights.

Scene.group(name: str, at: str = ...) -> SceneGroupProtocol

Create or fetch a named group under at for organizing related items.

Scene.get_items() -> List[Dict[str, Any]]

Return a copy of everything added to the scene so far.

Scene.clear() -> None

Remove all items and groups from the scene.

Scene.reset() -> None

Reset all scene entities, clearing their internal buffers.

Scene.env_origins: Optional[TensorLike]

property

Per-environment origin positions, shape (num_envs, 3).

None until the simulation runtime has attached the scene.

Scene.flush_pending_commands() -> None

Flush queued robot and actuator commands to the simulation.

Called automatically once per step by the runtime before physics — authoring code does not need to call it directly.


Declared as:

@runtime_checkable
class SceneProtocol(Protocol)