Skip to content

simulo.Camera

The camera authoring contract — an RGB-D camera sensor.

Captures visual data (color, depth, surface normals, semantic labels) configured at authoring time; after the simulation has stepped, the typed readers return the captured tensors.

Real usage, from the shipped cartpole_eval app’s recorded rollout — a static side-view camera attached to a link on the robot:

self.robot.add_sensor(
simulo.Camera(
width=640,
height=480,
data_types=["rgb"],
update_period=1.0 / 30.0,
offset=simulo.SensorOffset.look_at(pos=(-5.0, 0.0, 0.5), target=(0.0, 0.0, 0.5)),
),
attach_to="slider/side_cam",
)
scene.add(self.robot, at="/World/Robot")

Ordering matters: attach every sensor with add_sensor before scene.add(robot, ...) — the scene reads the robot’s sensors once, during that call, so a sensor attached afterward is silently stranded.

Camera.width: int

Image width in pixels.

Camera.height: int

Image height in pixels.

Camera.data_types: List[str]

Data types to capture (e.g. "rgb", "depth", "normals", "semantic").

Camera.offset: Optional[Any]

Optional sensor placement relative to the attachment frame.

Camera.spawn: Any

Camera optics configuration.

Camera.read_rgb() -> TensorLike

Color image, shape (num_envs, H, W, 3) (or (H, W, 3) for a single environment), unsigned 8-bit values.

Raises a runtime error when "rgb" is not captured or the sensor is not initialized.

Camera.read_depth() -> TensorLike

Depth image (distance to image plane) in meters, shape (num_envs, H, W).

Raises a runtime error when depth is not captured or the sensor is not initialized.

Camera.read_normals() -> TensorLike

Surface normals as unit vectors, shape (num_envs, H, W, 3).

Raises a runtime error when "normals" is not captured or the sensor is not initialized.

Camera.read_semantic() -> TensorLike

Semantic segmentation class labels, shape (num_envs, H, W).

Raises a runtime error when semantic data is not captured or the sensor is not initialized.


Declared as:

@runtime_checkable
class CameraProtocol(SensorProtocol, Protocol)