Getting Started

The ZED ROS wrapper lets you use the ZED stereo cameras with ROS. It provides access to the following data:

  • Left and right rectified/unrectified images
  • Depth map
  • Colored 3D point cloud
  • Visual odometry: position and orientation of the camera
  • Pose tracking: position and orientation of the camera fixed and fused with IMU data (only on ZED Mini)

Installation

First, download and install the latest version of the ZED SDK and its ROS wrapper.

Prerequisites

Note: if you are using a ZEDm and you want to visualize the IMU information using Rviz you need to install the “Rviz IMU plugin”: sudo apt-get install ros-kinetic-rviz-imu-plugin

Build the package

The zed_ros_wrapper is a catkin package. It depends on the following ROS packages:

  • tf2_ros
  • tf2_geometry_msgs
  • nav_msgs
  • roscpp
  • rosconsole
  • sensor_msgs
  • stereo_msgs
  • opencv
  • image_transport
  • dynamic_reconfigure
  • urdf
  • nodelet
  • message_generation
  • message_runtime
  • opencv3

Place the package folder zed_wrapper in your catkin workspace source folder ~/catkin_ws/src. If you haven’t initialized your workspace yet, please follow this short tutorial. Open a terminal and build the package:

cd ~/catkin_ws/
catkin_make
echo source $(pwd)/devel/setup.bash >> ~/.bashrc
source ~/.bashrc

Note: If you are using a different console interface like zsh, you have to change the source command like this : echo source $(pwd)/devel/setup.zsh >> ~/.zshrc and source ~/.zshrc.

Error: If an error about /usr/lib/x86_64-linux-gnu/libEGL.so is blocking the compilation, simply use the following command to repair the libEGl symlink. Then restart the catkin_make command.

#Only on libEGL error
sudo rm /usr/lib/x86_64-linux-gnu/libEGL.so; sudo ln /usr/lib/x86_64-linux-gnu/libEGL.so.1 /usr/lib/x86_64-linux-gnu/libEGL.so

Starting the ZED node

The ZED is available in ROS as a node that publishes its data to topics. See the full list of available topics here. Open a terminal and use roslaunch to start the ZED node:

roslaunch zed_wrapper zed.launch

You can set your own configuration parameters in the zed_camera.launch file available here.

Displaying ZED data

Using RVIZ

RVIZ is a useful visualization tool in ROS. Using RVIZ, you can visualize the ZED left and right images, depth, point cloud and 3D trajectory.

Launch the ZED wrapper along with RVIZ using the following command:

roslaunch zed_display_rviz display.launch

If you are using a ZED Mini camera you can visualize additional information about IMU data using the following command:

roslaunch zed_display_rviz display_zedm.launch

Displaying Images

The ZED node publishes both original and stereo rectified (aligned) left and right images. In RVIZ, select a topic you and use the image preview mode. Here the list of the available image topics:

  • /zed/rgb/image_rect_color : Color rectified image (left image by default).
  • /zed/rgb/image_raw_color : Color unrectified image (left image by default).
  • /zed/rgb/camera_info : Left camera calibration data.
  • /zed/right/image_rect_color : Color rectified right image.
  • /zed/right/image_raw_color : Color unrectified right image.
  • /zed/right/camera_info : Right sensor calibration data.
  • /zed/confidence/confidence_image : Confidence map as image

Note: The Confidence Map is also available as 32bit floating point image subscribing to the topic /zed/confidence/confidence_map

Displaying Depth

The depth map can be displayed in RVIZ with the following topic:

  • /zed/depth/depth_registered : 32-bit depth values in meters. RVIZ will normalize the depth map on 8-bit and display it as a grayscale depth image.

Note: An OpenNI compatibility mode is available in the launch/zed_camera.launch file. Set openni_depth_mode to 1 to get a depth in millimeters and 16-bit precision, and restart the ZED node.

Displaying Disparity

The Disparity Image is available subscribing to the topics:

  • /zed/disparity/disparity_image

Launch the Disparity Viewer to visualize it:

rosrun image_view disparity_view image:=/zed/disparity/disparity_image

Displaying Point cloud

A 3D colored point cloud can be displayed in RVIZ with the following topic:

  • /zed/point_cloud/cloud_registered

Add it in RVIZ with point_cloud->cloud->PointCloud2. Note that displaying point clouds slows down RVIZ, so open a new instance if you want to display other topics.

Displaying Odometry

The ZED position and orientation in space over time is published to the following topics:

  • zed/odom : pose referred to Odometry frame (only visual odometry is applied)
  • zed/map : pose referred to Map frame (complete data fusion algorithm is applied)

Important: By default, RVIZ does not display odometry data correctly. Open the newly created Odometry object in the left list, and set Position tolerance and Angle Tolerance to 0, and Keep to1.

Launching with recorded SVO video

With the ZED, you can record and playback stereo video using the .svo file format. To record a sequence, open the ZED Explorer and click on the REC button.

To launch the ROS wrapper with an SVO file, set an svo_file path in the command line when starting the package. For other launch parameters, see the full list here.

roslaunch zed_wrapper zed.launch svo_file:=/path/to/file.svo

Dynamic reconfigure

You can dinamically change many configuration parameter during the execution of the ZED node:

  • confidence threshold : confidence is a threshold filtering the values of the depth or the point cloud. With a confidence threshold set to 100, all the depth values will be written in the depth and the point cloud. You need to lower the threshold (80 by default) to remove the least accurate values.
  • auto_exposure : enable/disable automatic gain and exposure
  • exposure : set camera exposure only if auto_exposure is false
  • gain : set camera gain only if auto_exposure is false
  • mat_resize_factor : set the scale factor of the output images and depth map. Note : camera will acquire data at the dimension set by resolution parameter, they will be resized before sending the data to user.

You can set the parameters using the command dynparam set, e.g.:

rosrun dynamic_reconfigure dynparam set /zed/zed_wrapper_node confidence 80