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: intImage width in pixels.
height
Section titled “height”Camera.height: intImage height in pixels.
data_types
Section titled “data_types”Camera.data_types: List[str]Data types to capture (e.g. "rgb", "depth", "normals",
"semantic").
offset
Section titled “offset”Camera.offset: Optional[Any]Optional sensor placement relative to the attachment frame.
Camera.spawn: AnyCamera optics configuration.
read_rgb()
Section titled “read_rgb()”Camera.read_rgb() -> TensorLikeColor 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.
read_depth()
Section titled “read_depth()”Camera.read_depth() -> TensorLikeDepth 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.
read_normals()
Section titled “read_normals()”Camera.read_normals() -> TensorLikeSurface 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.
read_semantic()
Section titled “read_semantic()”Camera.read_semantic() -> TensorLikeSemantic 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_checkableclass CameraProtocol(SensorProtocol, Protocol)