Skip to content

VorteX-co/zed-ros2-wrapper

 
 

Repository files navigation

Stereolabs ZED Camera - ROS2 Eloquent Elusor

This package lets you use the ZED stereo cameras with ROS2. It provides access to the following data:

  • Left and right rectified/unrectified images
  • Depth data
  • Colored 3D point cloud
  • Position and Mapping
  • Sensors data (if available)
  • Detected objects (if available)
  • Persons skeleton (if available)

More information

Installation

Prerequisites

Build the package

The zed_ros2_wrapper is a colcon package.

Note: If you haven’t set up your colcon workspace yet, please follow this short tutorial.

To install the zed_ros2_wrapper, open a bash terminal, clone the package from Github, and build it:

$ cd ~/ros2_ws/src/ #use your current ros2 workspace folder
$ git clone https://github.com/stereolabs/zed-ros2-wrapper.git
$ cd ..
$ rosdep install --from-paths src --ignore-src -r -y
$ colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release
$ echo source $(pwd)/install/local_setup.bash >> ~/.bashrc
$ source ~/.bashrc

Note: The option --symlink-install is very important, it allows to use symlinks instead of copying files to the ROS2 folders during the installation, where possible. Each package in ROS2 must be installed and all the files used by the nodes must be copied into the installation folders. Using symlinks allows you to modify them in your workspace, reflecting the modification during the next executions without the needing to issue a new colcon build command. This is true only for all the files that don't need to be compiled (Python scripts, configurations, etc.).

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

Starting the ZED node

To start the ZED node, open a terminal and use the CLI command ros2 launch:

ZED:

$ ros2 launch zed_wrapper zed.launch.py

ZED Mini:

$ ros2 launch zed_wrapper zedm.launch.py

ZED 2:

$ ros2 launch zed_wrapper zed2.launch.py

The zed.launch.py, zedm.launch.py and zed2.launch.py are three Python scripts that automatically start the ZED node using "manual composition", loading the parameters from the correct "YAML files" and creating the camera model from the correct "URDF file".

Note: You can set your own configurations modifying the parameters in the files common.yaml, zed.yaml and zedm.yaml available in the folder zed_wrapper/config. For full descriptions of each parameter, follow the complete guide here.

Rviz visualization

Example launch files to start a pre-configured Rviz environment to visualize the data of ZED, ZED Mini and ZED 2 cameras are provided in the zed-ros2-examples repository

SVO recording

SVO recording can be started and stopped while the ZED node is running using the service start_svo_recording and the service stop_svo_recording. More information

Object Detection

The SDK v3.0 introduces the Object Detection and Tracking module. The Object Detection module is available only with a ZED 2 camera.

The Object Detection can be enabled automatically when the node start setting the parameter object_detection/od_enabled to true in the file zed2.yaml.

The Object Detection can be enabled/disabled manually calling the services enable_obj_det.

Spatial Mapping

The Spatial Mapping can be enabled automatically when the node start setting the parameter mapping/mapping_enabled to true in the file common.yaml. The Spatial Mapping can be enabled/disabled manually calling the services enable_mapping.

2D mode

For robots moving on a planar surface it is possible to activate the "2D mode" (parameter pos_tracking/two_d_mode in common.yaml). The value of the coordinate Z for odometry and pose will have a fixed value (parameter pos_tracking/fixed_z_value in common.yaml). Roll and pitch and relative velocities will be fixed to zero.

Examples and Tutorials

Examples and tutorials are provided to better understand how to use the ZED wrapper and how to integrate it in the ROS2 framework. See the zed-ros2-examples repository

Rviz2 visualization examples

  • Example launch files to start a preconfigured instance of Rviz displaying all the ZED Wrapper node information: zed_display_rviz2
  • ROS2 plugin for ZED2 to visualize the results of the Object Detection module (bounding boxes and skeletons): rviz-plugin-zed-od

Tutorials

About

ROS 2 wrapper beta for the ZED SDK

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 93.3%
  • CMake 3.6%
  • Python 2.1%
  • C 1.0%