cameras_ros2
ROS 2 camera backends.
This module defines ROS2-based camera backends that implement the shared robotblockset camera interfaces. It provides ROS2 node wrappers for RGB and depth camera streams, including subscription management, image conversion, intrinsics extraction from camera info messages, optional point-cloud handling, and threaded executor control. The module enables ROS2 camera topics to be consumed through a unified API consistent with other camera backends.
Key functionalities include:
- ROS2 Node-based camera wrappers compatible with RGBCamera and depth interfaces.
- Subscription handling for RGB, depth, camera info, and optional point-cloud topics.
- Conversion of ROS image messages to standardized NumPy/OpenCV image formats.
- Intrinsics matrix and resolution extraction from CameraInfo messages.
- Threaded ROS2 spinning, synchronization, and graceful node shutdown management.
- Unified camera data access for downstream calibration and perception workflows.
- class robotblockset.cameras.cameras_ros2.camera_ros2(*args: Any, **kwargs: Any)[source]
Bases:
Node,RGBCameraGeneric ROS2 RGB camera.
- Parameters:
name (str) – Node name.
namespace (str, optional) – ROS2 namespace.
rgb_topic (str) – RGB image topic.
camera_info_topic (str | None) – Camera info topic (for intrinsics). If None, intrinsics are unavailable.
wait_for_first_frame (bool) – Whether to wait for the first RGB frame before returning from _grab_images.
timeout_sec (float) – Timeout for waiting on the first RGB frame.
auto_spin (bool) – Start spinning thread automatically.
rgb_encoding (str | None) – Override encoding for RGB conversion.
Initialize the base object state.
- Returns:
This constructor initializes the object name and verbosity level.
- Return type:
None
- Name = 'camera_ros2'
- intrinsics_matrix() ndarray[source]
returns the intrinsics matrix of the camera:
- [[fx, 0, cx],
[0, fy, cy], [0, 0, 1]]
where all values are defined in pixels.
- property fps: float
The frames per second of the camera.
- property resolution: Tuple[int, int]
The resolution of the camera, in pixels.
- class robotblockset.cameras.cameras_ros2.Realsense(*args: Any, **kwargs: Any)[source]
Bases:
camera_ros2,DepthCameraROS2 RGBD RealSense camera wrapper based on ROS2 topics.
- Parameters:
depth_topic (str) – Depth image topic.
pointcloud_topic (str | None) – Point cloud topic. If None, point clouds are computed from RGBD using Open3D.
depth_scale (float | None) – Scale from depth units to meters for 16UC1 depth images. Defaults to 0.001.
enable_depth (bool) – Enable depth subscription and depth retrieval.
enable_pointcloud (bool) – Enable point cloud subscription if a topic is provided and sensor_msgs_py is available.
Initialize the base object state.
- Returns:
This constructor initializes the object name and verbosity level.
- Return type:
None
- Name = 'realsense_ros2'
- get_colored_point_cloud() PointCloud[source]
Classes
|
ROS2 RGBD RealSense camera wrapper based on ROS2 topics. |
|
Generic ROS2 RGB camera. |