Skip to content
News
Mar 12, 2019.

Introducing ROS 2 Wrapper for ZED

It’s a little more than a year since the first official release of ROS 2 has been released.

It’s a little more than a year since the first official release of ROS 2 has been released. While the new version of the Robotic Operating System was promising, many features were still under development.

With the release of ROS 2 Crystal Clemmys in December 2018, ROS 2 has gained a lot of maturity and we felt it was time to add support in ROS 2 for the ZED and its 3D computer vision software stack.

One year after Crystal, in December 2019, ROS 2 Eloquent Elusor has been released with many changes and improvements on stability.

What’s new in ROS 2 respect to ROS

ROS 2 introduces a lot of changes with respect to the ten-year-old ROS. The official ROS 2 design post presents these changes in detail.
The biggest step forward is in the development languages. ROS 2 supports Python v3.5, C++11, C++14 and C++17. The “Boost” library is not a dependency anymore.
Also, while ROS was created with the PR2 robot in mind, ROS 2’s design targets every kind of robot, with an emphasis on robot security, real-time control, and distributed control.

Multiple nodes in one process

In ROS, you can write your code either as a ROS node or as a ROS nodelet. ROS nodes are being compiled into executables. ROS nodelets on the other hand are being compiled into a shared library which is then being loaded at runtime by a container process.
In ROS 2 the concepts of node and nodelet have been unified and each not is now a Component, very similar to the nodelet in ROS. In ROS 2 a single process can execute more than one node, using Composition, exploiting the intra-process communication feature.

Communication middleware

ROS communication infrastructure is based on a custom serialization format, a custom transport protocol and a custom central discovery mechanism. ROS needs a “master node” running on one of the machines of the robot infrastructure to relay all messages between the different nodes..This means that that if the communication with the “master” node fails, the whole system collapses.
ROS 2 has an abstract middleware interface that provides serialization, transport, and discovery. Currently, all implementations of this interface are based on the DDS standard. This enables ROS 2 to provide various Quality of Service policies (QoS) that improve communication over different networks. Playing with QoS parameters gives direct control over the reliability, latency and lifespan of each published message. You can reduce the latency of a sensor message that does not need reliability, but guarantee that a message will remain available until it does not reach its destination.
Yuya Maruyama’s “Exploring the Performance of ROS 2” provides an excellent analysis of the communication improvements in ROS 2.

Components with life cycle

In ROS, most nodes have their own main functions. In ROS 2, components can be subclassed from a life cycle component. The life cycle can be used by tools like roslaunch to start a system composed of many components in a deterministic way, knowing the real state of each node in every moment of its “life”.

Python-based launch system

ROS launch files are based on XML tags with very limited capabilities. In ROS 2, the launch files are written in Python, which enables more complex logic like conditionals. The Python launch system gives complete control over life cycle components. Users can start each node when a well-defined situation occurs. For example, the file could start the motor control node only when all the sensor nodes are ready to provide information.

Decentralized parameter system

In ROS, a single global server takes care of all the parameters available in the whole system. Users must instantiate a node-specific dynamic reconfigure server for each node in order to handle real-time changes.

ROS 2 eliminates the concept of global parameters. Each node has its own parameter set. When a parameter changes, it notifies the node about the event, which can handle the new value.
Users can’t define the parameters in the launch file like in ROS. But as they need to provide one or more YAML files, parameter management is still simple and organized.

Future support for real-time

ROS does not support writing real-time code, instead relying on external frameworks like Orocos. In ROS 2, it will eventually be possible to write real-time nodes when using a proper RTOS.

ROS 2 ZED wrapper features

The ZED wrapper for ROS 2 exploits many of the new functionalities offered by ROS 2. The primary features include:

  • Configuration using YAML files: There are four different YAML files that define the node parameters: a common file, a file for the ZED camera, a file for the ZED-M camera, and a file for the ZED2 camera.
  • Python launch scripts: the classical “XML” launch file of ROS has been replaced by powerful Python launch files that allow starting ROS 2 nodes while performing many other operations.
  • RGB streams publishing: The plugin publishes left, right RGB, and Stereo sync pair streams on their own topics using the image_transport package.
  • Depth streams publishing: The plugin publishes the depth map, confidence map, and disparity map on their own topics.
  • Pointcloud publishing: The plugin now provides a colored point cloud.
  • Positional tracking: The plugin publishes the position of the camera in real-time, relative to its own center.
  • 3D Camera models for RVIZ2
  • Rviz2 launch Python scripts: We provide pre-configured Python launch files to launch the ZED node, and the RVIZ2 GUI to easily get access to all visual information.
  • Dynamically reconfiguring runtime parameters: Users can now change runtime parameters (e.g. gain, exposure, white balance) during node execution using Command Line Instructions.
  • Object Detection: The plugin fully supports all the features of the Object Detection module of the ZED SDK
  • Rviz2 plugin for Object Detection: to correctly visualize the results of the Object Detection and Tracking processing a new Rviz2 plugin is available to display the bounding boxes of the objects and the skeletons in the case of People Tracking.

Point clouds, RGB and depth streams, stereo sync stream, objects bounding boxes and skeletons… everything available in Rviz2.

Tutorials

The wrapper comes with a complete guide describing all available features, plus C++ tutorials and examples about how to retrieve the main information from a ZED camera connected to the ROS 2 network.

A dedicated GitHub repository is available with many tutorials and examples:

Colored point cloud and RGB stream in RVIZ2

Known Limitations

The current version of the ZED ROS 2 Wrapper only supports ROS 2 Eloquent Elusor running on Ubuntu 18 machines.

Download ZED wrapper for ROS 2

To get started with the ZED in ROS 2, download the new ROS 2 wrapper and read the online documentation. If you test it, please let us know what you think by submitting issues and suggestions on GitHub.