Camera#
Configuration#
The CameraCfg class defines the configuration for camera sensors. It inherits from SensorCfg and controls resolution, clipping planes, intrinsics, and active data modalities.
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Width of the captured image. |
|
|
|
Height of the captured image. |
|
|
|
Camera intrinsics |
|
|
|
Pose configuration (see below). |
|
|
|
Near clipping plane distance. |
|
|
|
Far clipping plane distance. |
|
|
|
Enable RGBA image capture. |
|
|
|
Enable depth map capture. |
|
|
|
Enable segmentation mask capture. |
|
|
|
Enable surface normal capture. |
|
|
|
Enable 3D position map capture. |
Camera Extrinsics#
The ExtrinsicsCfg class defines the position and orientation of the camera.
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Name of the link to attach to (e.g., |
|
|
|
Position offset |
|
|
|
Orientation quaternion |
|
|
|
(Optional) Camera eye position for look-at mode. |
|
|
|
(Optional) Target position for look-at mode. |
|
|
|
(Optional) Up vector for look-at mode. |
Usage#
You can create a camera sensor using sim.add_sensor() with a CameraCfg object.
Code Example#
from embodichain.lab.sim.sensors import Camera, CameraCfg
# 1. Define Configuration
camera_cfg = CameraCfg(
width=640,
height=480,
intrinsics=(600, 600, 320.0, 240.0),
extrinsics=CameraCfg.ExtrinsicsCfg(
parent="ee_link", # Attach to robot end-effector
pos=[0.09, 0.05, 0.04], # Relative position
quat=[0, 0, 0, 1], # Relative rotation [x, y, z, w]
),
enable_color=True,
enable_depth=True,
)
# 2. Add Sensor to Simulation
camera: Camera = sim.add_sensor(sensor_cfg=camera_cfg)
Observation Data#
Retrieve sensor data using camera.get_data(). The data is returned as a dictionary of tensors on the specified device.
Key |
Data Type |
Shape |
Description |
|---|---|---|---|
|
|
|
RGBA image data. |
|
|
|
Depth map in meters. |
|
|
|
Segmentation mask / Instance IDs. |
|
|
|
Surface normal vectors. |
|
|
|
3D Position map (OpenGL coords). |
Note: B represents the number of environments (batch size).