← Back to Docs

Camera Operations

Launch the camera node, verify image streams, record images and video, preview the feed, calibrate transforms and perform diagnostics.
1

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.

bash
cd ~/repos/common_platform/common_platform_ws
source install/setup.bash
ros2 launch sensors camera.launch.py
2

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.

bash
ros2 topic echo /${ROS_NAME}/camera/image_raw
bash
ros2 topic hz /${ROS_NAME}/camera/image_raw
bash
ros2 topic list
3

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.

bash
cd ~/repos/common_platform/common_platform_ws
colcon build --packages-select data_recorder
source install/setup.bash
bash
ros2 launch data_recorder ramdisk_recorder.launch.py
4

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.

bash
ros2 run image_view video_recorder --ros-args -p filename:=/tmp/robot_video.avi
5

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.

bash
ros2 run rqt_image_view rqt_image_view
6

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.

bash
ros2 run tf2_tools view_frames
bash
ros2 run tf2_ros tf2_echo base_link camera_link
7

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.

bash
lsusb | grep -i camera
bash
ls /dev/video*
bash
ros2 run usb_cam usb_cam_node --ros-args -p video_device:=/dev/video0
bash
cam -l

Subscribe to our newsletter

The latest educational robotics news and articles, sent to your inbox weekly.