Stereo Camera#
Configuration#
The StereoCameraCfg class defines the configuration for stereo camera sensors. It inherits from CameraCfg and includes additional settings for the right camera and stereo-specific features like disparity computation.
In addition to the standard CameraCfg parameters, it supports the following:
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
The intrinsics for the right camera |
|
|
|
Position offset |
|
|
|
Rotation offset |
|
|
|
Enable disparity map computation. Note: Requires |
Usage#
You can create a stereo camera sensor using sim.add_sensor() with a StereoCameraCfg object.
Code Example#
from embodichain.lab.sim.sensors import StereoCamera, StereoCameraCfg
# 1. Define Configuration
stereo_cfg = StereoCameraCfg(
width=640,
height=480,
# Intrinsics for Left (inherited) and Right cameras
intrinsics=(600, 600, 320.0, 240.0),
intrinsics_right=(600, 600, 320.0, 240.0),
# Baseline configuration (e.g., 5cm baseline)
left_to_right_pos=(0.05, 0.0, 0.0),
extrinsics=StereoCameraCfg.ExtrinsicsCfg(
parent="head_link",
pos=[0.1, 0.0, 0.0],
),
# Data modalities
enable_color=True,
enable_depth=True,
enable_disparity=True,
)
# 2. Add Sensor to Simulation
stereo_camera: StereoCamera = sim.add_sensor(sensor_cfg=stereo_cfg)