This workspace contains the Intel RealSense ROS2 packages for working with RealSense cameras in ROS2 Humble.
- ROS2 Humble
- Intel RealSense camera (D400 series)
Use the provided ros_exec script to build:
./ros_exec buildTo clean build artifacts:
./ros_exec cleanWith ros2 run:
./ros_exec ros2 run realsense2_camera realsense2_camera_nodeWith parameters (e.g., enable temporal and spatial filters):
./ros_exec ros2 run realsense2_camera realsense2_camera_node --ros-args \
-p enable_color:=false \
-p spatial_filter.enable:=true \
-p temporal_filter.enable:=trueWith ros2 launch:
./ros_exec ros2 launch realsense2_camera rs_launch.pyWith parameters:
./ros_exec ros2 launch realsense2_camera rs_launch.py \
depth_module.depth_profile:=1280x720x30 \
pointcloud.enable:=trueWith parameters file:
./ros_exec ros2 launch realsense2_camera rs_launch.py \
params_file:=config/camera_params.yaml \
camera_namespace:=robot1 \
camera_name:=D455_1Set camera namespace and name to distinguish between cameras and platforms.
Example with ros2 launch:
./ros_exec ros2 launch realsense2_camera rs_launch.py \
camera_namespace:=robot1 \
camera_name:=D455_1Example with ros2 run:
./ros_exec ros2 run realsense2_camera realsense2_camera_node \
--ros-args \
-r __node:=D455_1 \
-r __ns:=/robot1After launching with camera_namespace:=robot1 camera_name:=D455_1:
Nodes:
/robot1/D455_1
Topics:
/robot1/D455_1/color/camera_info
/robot1/D455_1/color/image_raw
/robot1/D455_1/color/metadata
/robot1/D455_1/depth/camera_info
/robot1/D455_1/depth/image_rect_raw
/robot1/D455_1/depth/metadata
/robot1/D455_1/extrinsics/depth_to_color
/robot1/D455_1/extrinsics/depth_to_depth
Services:
/robot1/D455_1/calib_config_read
/robot1/D455_1/calib_config_write
/robot1/D455_1/device_info
/robot1/D455_1/hw_reset
enable_color: true
rgb_camera.color_profile: 1280x720x30
enable_depth: true
depth_module.depth_profile: 1280x720x30
align_depth.enable: true
enable_sync: true
publish_tf: true
tf_publish_rate: 1.0
pointcloud.enable: truePre-configured RViz2 setup for visualizing:
- Color camera stream
- Depth camera stream
- Point cloud (if enabled)
- TF frames
Start RViz2 with config:
./ros_exec rviz2 -d config/realsense.rviz1. Start RViz2:
./ros_exec rviz22. Add Display for Color Image:
- Click "Add" button (or press
Ctrl+N) - Select "Image" and click "OK"
- Set Image Topic to:
/robot1/D455_1/color/image_raw - Optional: Set Transport Hint to "raw"
3. Add Display for Depth Image:
- Click "Add" button
- Select "Image" and click "OK"
- Set Image Topic to:
/robot1/D455_1/depth/image_rect_raw - Optional: Set Transport Hint to "raw"
4. Add Display for Point Cloud (if enabled):
- Click "Add" button
- Select "PointCloud2" and click "OK"
- Set Topic to:
/robot1/D455_1/depth/points(if pointcloud.enable:=true) - Set Size (m): 0.01 or desired size
- Set Color Transformer to "RGB8" or "Intensity"
5. Optional - Add Camera Display:
- Click "Add" button
- Select "Camera" and click "OK"
- Set Image Topic to:
/robot1/D455_1/color/image_raw - Set Camera Info Topic to:
/robot1/D455_1/color/camera_info - Adjust visibility and clipping distance as needed
The ros_exec script automatically:
- Uses system Python
- Sources ROS environment if
install/setup.bashexists - Supports
build,clean, and custom commands
- realsense-ros - Intel RealSense ROS2 wrapper