Camera Operations
Launch the camera node
Start the RGB camera driver and publish image data.
Launch the camera driver to start streaming images. The driver publishes sensor data on the /camera/image_raw topic.
cd ~/repos/common_platform/common_platform_ws
source install/setup.bash
ros2 launch sensors camera.launch.py
Verify camera topics
Check that the camera node is streaming images and at the expected frame rate.
After launching the camera driver you should verify that images are being published at a reasonable rate. The commands below display images and measure the frequency of the /camera/image_raw topic.
ros2 topic echo /${ROS_NAME}/camera/image_raw
ros2 topic hz /${ROS_NAME}/camera/image_raw
ros2 topic list
Record images to RAM disk
Build the data_recorder package and record still images.
You can capture still images from the camera using the data_recorder package. Build the package, then launch the ramdisk_recorder to save snapshots to a RAM disk.
cd ~/repos/common_platform/common_platform_ws
colcon build --packages-select data_recorder
source install/setup.bash
ros2 launch data_recorder ramdisk_recorder.launch.py
Record video from the camera
Use the image_view utility to record a video file from the camera topic.
To capture a video file from the camera stream, use the image_view package’s video_recorder utility. Specify the output filename using a ROS parameter.
ros2 run image_view video_recorder --ros-args -p filename:=/tmp/robot_video.avi
View the live camera feed
Use rqt_image_view to display images from the camera topic.
The rqt_image_view application lets you preview the live camera feed. This is useful for verifying image quality and alignment.
ros2 run rqt_image_view rqt_image_view
Visualize camera transforms
Use TF tools to inspect the camera’s position relative to the robot base.
For many applications you need to know the transform between the robot’s base_link frame and the camera frame. Use TF tools to visualise and echo this transform.
ros2 run tf2_tools view_frames
ros2 run tf2_ros tf2_echo base_link camera_link
Diagnose the camera
Verify USB connectivity, test the generic usb_cam node and inspect hardware.
If the camera isn’t producing images, run these diagnostics. They help confirm that the USB device is detected and allow you to test with a generic usb_cam driver.
lsusb | grep -i camera
ls /dev/video*
ros2 run usb_cam usb_cam_node --ros-args -p video_device:=/dev/video0
cam -l