LeRobot documentation
Cameras
Cameras
Cameras supply the image observations a policy sees. Every backend — OpenCV, Intel RealSense, Reachy 2 —
implements the Camera interface, so swapping hardware does not change the code that reads frames.
See the Cameras guide for choosing and configuring a camera, and Third-Party Cameras & Sensors for devices outside the core set.
Camera
class lerobot.cameras.Camera
< source >( config: CameraConfig )
Base class for camera implementations.
Defines a standard interface for camera operations across different backends. Subclasses must implement all abstract methods.
Manages basic camera properties (FPS, resolution) and core operations:
- Connection/disconnection
- Frame capture (sync/async/latest)
connect
< source >( warmup: bool = True )
Establish connection to the camera.
Disconnect from the camera and release resources.
Capture and return a single frame from the camera synchronously.
This is a blocking call that will wait for the hardware and its SDK.
async_read
< source >( timeout_ms: float = Ellipsis ) → np.ndarray
Return the most recent new frame.
This method retrieves the latest frame captured by the background thread. If a new frame is already available in the buffer (captured since the last call), it returns it immediately.
It blocks up to timeout_ms only if the buffer is empty or if the latest frame
was already consumed by a previous async_read call.
Essentially, this method return the latest unconsumed frame, waiting if necessary for a new one to arrive within the specified timeout.
Usage:
- Ideal for control loops where you want to ensure every processed frame is fresh, effectively synchronizing your loop to the camera’s FPS.
- Causes of a timeout usually include: very low camera FPS, heavy processing load, or if the camera is disconnected.
find_cameras
< source >( ) → List[Dict[str, Any]]
Returns
List[Dict[str, Any]]
A list of dictionaries, where each dictionary contains information about a detected camera.
Detects available cameras connected to the system.
CameraConfig
class lerobot.cameras.CameraConfig
< source >( fps: int | None = Nonewidth: int | None = Noneheight: int | None = None )