Skip to content
NewsTutorials
Sep 7, 2015.

Using the ZED Camera with ROS

The ROS wrapper is an interface between the ZED SDK and the ROS framework.

Note: This is for ZED SDK 1.2 only. Please see the latest SDK guide for ROS here.

The ROS wrapper is an interface between the ZED SDK and the ROS framework. This wrapper lets you access ZED stereo images, depth map, 3D point cloud and 6-DoF motion tracking in the ROS environment.

Prerequisites

The wrapper is a catkin package that publish ZED measurements such as depth and odometry on ROS topics. You will need to match the following ROS dependencies:

  • tf2_ros
  • nav_msgs
  • roscpp
  • rosconsole
  • sensor_msgs
  • opencv
  • image_transport
  • dynamic_reconfigure
  • urdf

You also need to install the ZED SDK with CUDA and OpenCV, as described on our Getting Started page.

Build the application

The latest ROS wrapper can be found on our GitHub page. Download and extract the content of the .zip file. Once extracted, rename and copy the folder zed-ros-wrapper in the catkin workspace source directory ~/catkin_ws/src. If you haven’t created your workspace yet, follow this short tutorial on ROS wiki.

Now you just need to compile the wrapper from your catkin workspace source directory ~/catkin_ws/src.

To do so, open a terminal and execute the following commands:

cd ~/catkin_ws
catkin_make
source ./devel/setup.bash
Launch the application

To run the program, you need to use a launch file which contains different parameters such as camera resolution or depth map mode.

Open a terminal and execute the following command:

roslaunch zed_wrapper zed.launch

The wrapper is now running and the ZED camera outputs are now accessible on the published ROS topics.

ZED ROS topics

A topic is a bus over which data is exchanged or published. For example, you can access ZED left image data on the /zed/left/image_rect_color topic.

Here is the full list of published topics:

  • Left camera
    • /zed/rgb/image_rect_color: Color rectified image (left RGB image by default).
    • /zed/rgb/image_raw_color: Color unrectified image (left RGB image by default).
    • /zed/rgb/camera_info: Camera calibration data.
    • /zed/left/image_rect_color: Color rectified left image.
    • /zed/left/image_raw_color: Color unrectified left image.
    • /zed/left/camera_info: Left camera calibration data.
  • Right camera
    • /zed/right/image_rect_color: Color rectified right image.
    • /zed/right/image_raw_color: Color unrectified right image.
    • /zed/right/camera_info: Right camera calibration data.
  • Depth and point cloud
    • /zed/depth/depth_registered: Depth map image registered on left image (by default 32 bits float, in meters).
    • /zed/point_cloud/cloud_registered: Registered color point cloud.
  • Visual odometry
    • /zed/odom: Absolute 3D position and orientation relative to zed_initial_frame.
Display images and depth

You can easily display ZED images and depth using rviz or rqt_image_view. Just select a topic in the rqt GUI to display it in the main window.

Display point cloud

To display the point cloud, launch the rviz visualizer with the following command:

rosrun rviz rviz

Now move your mouse to the top left of the rviz window and select zed_initial_frame in Displays->Global Options->Fixed Frame.

Click on add (bottom left), choose the ‘By Topic’ tab, and select point_cloud->cloud->PointCloud2.

Display odometry

To visualize the odometry in rviz, click on the Add button (bottom left), and select the ZED odom topic under the By topic tab. To display odometry data correctly, make sure to select the newly created Odometry object in the left list, set Position tolerance and Angle Tolerance to 0, and Keep to 1.

Using multiple ZED with ROS

It is possible to use multiple ZED cameras with ROS. Simply launch zed_multi_cam using the roslaunch command:

roslaunch zed_wrapper zed_multi_cam.launch

Note: The ZED camera uses the full USB 3.0 bandwidth to output video. When using multiple ZED, you may need to reduce camera framerate and resolution to avoid corrupted frames (green or purple frames). You can also use multiple GPUs to load-balance computations and improve performance.

For more information, read the ZED ROS wiki page.