mujoco_camera

MuJoCo camera backend.

This module defines a MuJoCo-backed RGB camera wrapper that implements the shared camera interface. It provides image capture from MuJoCo scene cameras, configurable resolution and frame-rate settings, and optional intrinsics handling for simulation-based perception workflows. The implementation enables simulated camera streams to be used interchangeably with hardware camera backends.

Key functionalities include: - MuJoCo scene camera integration through the RGBCamera interface. - Configurable camera selection, resolution, and frame-rate parameters. - RGB frame capture and retrieval in float and uint8 formats. - Optional camera intrinsics matrix support for simulated calibration compatibility. - Context-manager hooks for integration in resource-managed workflows. - Standardized behavior aligned with other robotblockset camera backends.

class robotblockset.cameras.mujoco_camera.MujocoCam(scene: Any, mujoco_camera_id: int = 0, scene_option: Any | None = None, intrinsics_matrix: ndarray | None = None, resolution: Tuple[int, int] = (640, 480), fps: int = 30)[source]

Bases: RGBCamera

MuJoCo camera wrapper implementing the RGB camera interface.

Create a MuJoCo camera wrapper.

Parameters:
  • scene (Any) – MuJoCo scene handle.

  • mujoco_camera_id (int, optional) – int, default=0 Index of the camera in the MuJoCo model.

  • scene_option (Any, optional) – Optional MuJoCo scene options for rendering.

  • intrinsics_matrix (CameraIntrinsicsMatrixType, optional) – Camera intrinsics matrix with shape (3, 3).

  • resolution (CameraResolutionType, optional) – CameraResolutionType, default=RESOLUTION_480 Image resolution (width, height) in pixels.

  • fps (int, optional) – int, default=30 Target frame rate.

RESOLUTION_1080 = (1920, 1080)
RESOLUTION_720 = (1280, 720)
RESOLUTION_960 = (1280, 960)
RESOLUTION_768 = (1024, 768)
RESOLUTION_480 = (640, 480)
__init__(scene: Any, mujoco_camera_id: int = 0, scene_option: Any | None = None, intrinsics_matrix: ndarray | None = None, resolution: Tuple[int, int] = (640, 480), fps: int = 30) None[source]

Create a MuJoCo camera wrapper.

Parameters:
  • scene (Any) – MuJoCo scene handle.

  • mujoco_camera_id (int, optional) – int, default=0 Index of the camera in the MuJoCo model.

  • scene_option (Any, optional) – Optional MuJoCo scene options for rendering.

  • intrinsics_matrix (CameraIntrinsicsMatrixType, optional) – Camera intrinsics matrix with shape (3, 3).

  • resolution (CameraResolutionType, optional) – CameraResolutionType, default=RESOLUTION_480 Image resolution (width, height) in pixels.

  • fps (int, optional) – int, default=30 Target frame rate.

property fps: int

The frames per second of the camera.

property resolution: Tuple[int, int]

The resolution of the camera, in pixels.

intrinsics_matrix() ndarray[source]

Obtain the camera intrinsics matrix.

Returns:

Camera intrinsics matrix with shape (3, 3).

Return type:

CameraIntrinsicsMatrixType

Raises:

RuntimeError – If intrinsics were not provided.

Classes

MujocoCam(scene[, mujoco_camera_id, ...])

MuJoCo camera wrapper implementing the RGB camera interface.