The “zed_msgs” Package

Open in ClaudeOpen in ChatGPT

The zed_msgs package provides all the custom interfaces (topics, services) used by the ZED ROS 2 Wrapper and the ZED ROS 2 Examples. The definitions are maintained in the zed-ros2-interfaces repository.

The zed_msgs package does not depend on CUDA or the ZED SDK. You can install it on any ROS 2 machine — even without an NVIDIA GPU — to subscribe to or publish ZED interfaces from a remote node.

Installation

Binary installation

The package is available as a binary for the supported ROS 2 distributions:

$sudo apt install ros-<ros2-distro>-zed-msgs

where <ros2-distro> is your ROS 2 distribution (e.g. humble or jazzy).

Build from source

You can also clone and build the package in your colcon workspace:

$cd ~/ros2_ws/src/
$git clone https://github.com/stereolabs/zed-ros2-interfaces.git
$cd ..
$sudo apt update
$rosdep install --from-paths src --ignore-src -r -y
$colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release
$source ~/ros2_ws/install/local_setup.bash

Topics (messages)

The package defines the custom messages published by the ZED nodes, covering node status, positional tracking, GNSS fusion, plane detection, object detection, and body tracking.

The available message types are:

  • zed_msgs/Heartbeat
  • zed_msgs/HealthStatusStamped
  • zed_msgs/SvoStatus
  • zed_msgs/PosTrackStatus
  • zed_msgs/GnssFusionStatus
  • zed_msgs/MagHeadingStatus
  • zed_msgs/DepthInfoStamped
  • zed_msgs/PlaneStamped
  • zed_msgs/ObjectsStamped / zed_msgs/Object
  • zed_msgs/BoundingBox2Df / zed_msgs/BoundingBox2Di / zed_msgs/BoundingBox3D
  • zed_msgs/Keypoint2Df / zed_msgs/Keypoint2Di / zed_msgs/Keypoint3D
  • zed_msgs/Skeleton2D / zed_msgs/Skeleton3D

For the full field-by-field definition of each message, see the Custom Message Types page.

Magnetic Heading status

The zed_msgs/MagHeadingStatus message reports the reliability of the magnetometer-based heading (ZED 2, ZED 2i):

$# Status constants
$# GOOD The heading is reliable and not affected by iron interferences.
$# OK The heading is reliable, but affected by slight iron interferences.
$# NOT_GOOD The heading is not reliable because affected by strong iron interferences.
$# NOT_CALIBRATED The magnetometer has not been calibrated.
$# MAG_NOT_AVAILABLE The magnetometer sensor is not available.
$
$uint8 GOOD=0
$uint8 OK = 1
$uint8 NOT_GOOD = 2
$uint8 NOT_CALIBRATED = 3
$uint8 MAG_NOT_AVAILABLE = 4
$
$# Status
$uint8 status

Services

The package also defines the services exposed by the ZED node. All services follow the standard ROS 2 response pattern, returning a bool success flag and a string message with additional information.

SetPose

Restart positional tracking from a new pose expressed in the camera_link frame.

$# Translation XYZ [meters]
$float32[3] pos
$# Orientation RPY [radians]
$float32[3] orient
$---
$bool success # indicate successful run of service
$string message # informational, e.g. for error messages

SetROI

Set the Region of Interest used by the ZED SDK for processing. See the Region of Interest module for details.

$# Region of interest polygon as an array of normalized vertices.
$# e.g. "[[0.5,0.25],[0.75,0.5],[0.5,0.75],[0.25,0.5]]"
$string roi
$---
$bool success # indicate successful run of service
$string message # informational, e.g. for error messages

SaveAreaMemory

Save the current area memory (spatial memory map) to a file for later reuse. See the Positional Tracking module.

$# Path of an area localization file that describes the surroundings. Use ".area" extension.
$string area_file_path
$---
$bool success # indicate successful run of service
$string message # informational, e.g. for error messages

StartSvoRec

Start recording the camera stream to an SVO file. See Record and Replay Data.

$# Bitrate - 0 or [1000,60000]
$uint32 bitrate
$
$# Compression Mode - [0,2]
$uint8 compression_mode
$
$# Target Framerate
$# Allowed framerates are 0,15,30, 60 or 100.
$# Any other values will be discarded and camera FPS will be taken.
$uint32 target_framerate
$
$# Input Transcode
$bool input_transcode
$
$# Filename
$string svo_filename
$---
$bool success # indicate successful run of service
$string message # informational, e.g. for error messages

SetSvoFrame

Jump to a specific frame while replaying an SVO file.

$# Frame ID
$int32 frame_id
$---
$bool success
$string message