├── images ├── foo.txt └── Picto+STEREOLABS_Black.jpg ├── isaac_ros ├── zed_isaac_ros_april_tag │ ├── config │ │ ├── foo.txt │ │ ├── zed_isaac_ros_april_tag.yaml │ │ └── zed_params.yaml │ ├── launch │ │ └── foo.txt │ ├── README.md │ ├── package.xml │ └── CMakeLists.txt ├── zed_isaac_ros_multi_camera │ ├── image │ │ └── frames.png │ ├── package.xml │ ├── CMakeLists.txt │ └── urdf │ │ └── zed_multi.urdf.xacro ├── zed_isaac_ros_nitros_sub │ ├── README.md │ ├── config │ │ └── example_params.yaml │ ├── package.xml │ ├── src │ │ └── include │ │ │ └── nitros_sub_visibility_control.hpp │ └── launch │ │ └── zed_nitros_sub_example.launch.py └── README.md ├── .vscode ├── settings.json ├── tasks.json └── c_cpp_properties.json ├── zed_display_rviz2 ├── images │ ├── ZED-Rviz.jpg │ ├── ZEDM-Rviz.jpg │ └── depthcloud-RGB.jpg ├── package.xml ├── README.md ├── CMakeLists.txt └── launch │ └── display_zed_cam.launch.py ├── rviz-plugin-zed-od ├── icons │ └── ZedObjDet.png ├── images │ ├── rviz2_od_params.png │ └── rviz2_od_result.png ├── plugins_description.xml ├── package.xml ├── src │ ├── include │ │ └── visibility_control.hpp │ └── plugin │ │ └── include │ │ ├── zed_od_display.hpp │ │ └── zed_od_info.hpp └── README.md ├── tutorials ├── zed_multi_camera │ ├── image │ │ └── frames.png │ ├── package.xml │ ├── CMakeLists.txt │ └── urdf │ │ └── zed_multi.urdf.xacro ├── zed_robot_integration │ ├── images │ │ ├── robot_viz.jpg │ │ ├── no_zed_loc.jpg │ │ ├── use_zed_loc.jpg │ │ ├── robot_viz_dual.jpg │ │ ├── no_zed_loc_dual.jpg │ │ └── use_zed_loc_dual.jpg │ ├── CMakeLists.txt │ ├── package.xml │ ├── urdf │ │ ├── zed_robot_mono.urdf.xacro │ │ └── zed_robot_dual.urdf.xacro │ └── launch │ │ ├── view_mono_zed.launch.py │ │ └── view_dual_zed.launch.py ├── zed_video_tutorial │ ├── README.md │ ├── package.xml │ ├── src │ │ └── zed_video_sub_tutorial.cpp │ └── CMakeLists.txt ├── zed_pose_tutorial │ ├── README.md │ ├── package.xml │ ├── CMakeLists.txt │ └── src │ │ └── zed_tutorial_pos_tracking.cpp ├── zed_depth_tutorial │ ├── README.md │ ├── package.xml │ ├── src │ │ └── zed_depth_sub_tutorial.cpp │ └── CMakeLists.txt ├── zed_rgb_convert │ ├── README.md │ ├── .gitignore │ ├── package.xml │ ├── src │ │ ├── component │ │ │ ├── include │ │ │ │ └── zed_rgb_convert_component.hpp │ │ │ └── src │ │ │ │ └── zed_rgb_convert_component.cpp │ │ ├── include │ │ │ └── cvt_visibility_control.hpp │ │ └── container │ │ │ └── zed_rgb_convert.cpp │ └── launch │ │ └── zed_rgb_convert.launch.py ├── zed_ipc │ ├── package.xml │ ├── src │ │ ├── components │ │ │ ├── include │ │ │ │ ├── winavg.hpp │ │ │ │ └── pointcloud_component.hpp │ │ │ └── src │ │ │ │ └── winavg.cpp │ │ └── include │ │ │ └── ipc_visibility_control.hpp │ └── launch │ │ └── zed_ipc.launch.py └── README.md ├── zed_display_foxglove ├── images │ └── foxglove_zed.webp └── README.md ├── examples ├── zed_depth_to_laserscan │ ├── images │ │ ├── laserscan.jpg │ │ └── pointcloud_scan.jpg │ ├── config │ │ └── zed_depth_to_laserscan.yaml │ ├── package.xml │ ├── CMakeLists.txt │ └── README.md ├── README.md └── zed_aruco_localization │ ├── .gitignore │ ├── config │ └── aruco_loc.yaml │ ├── markers │ ├── 6x6_1000-19.svg │ └── 6x6_1000-43.svg │ ├── package.xml │ ├── src │ ├── include │ │ └── aruco_loc_visibility_control.hpp │ └── component │ │ └── include │ │ └── zed_aruco_localization_component.hpp │ └── README.md ├── tools ├── zed_benchmark │ ├── README.md │ ├── package.xml │ ├── src │ │ └── topic_benchmark_container.cpp │ └── CMakeLists.txt ├── zed_benchmark_interfaces │ ├── msg │ │ └── BenchmarkStatsStamped.msg │ ├── package.xml │ └── CMakeLists.txt ├── zed_benchmark_component │ ├── package.xml │ ├── src │ │ ├── component │ │ │ ├── include │ │ │ │ ├── winavg.hpp │ │ │ │ └── topic_benchmark_component.hpp │ │ │ └── src │ │ │ │ └── winavg.cpp │ │ └── include │ │ │ └── visibility_control.hpp │ └── CMakeLists.txt └── README.md ├── .gitignore ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── 1_feature_request.yml │ └── 2_bug_report.yml └── workflows │ └── stale_issues.yml ├── CONTRIBUTING.md └── README.md /images/foo.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_april_tag/config/foo.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_april_tag/launch/foo.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/Picto+STEREOLABS_Black.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/images/Picto+STEREOLABS_Black.jpg -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.autoComplete.extraPaths": [ 3 | "/opt/ros/noetic/lib/python3/dist-packages" 4 | ] 5 | } -------------------------------------------------------------------------------- /zed_display_rviz2/images/ZED-Rviz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/zed_display_rviz2/images/ZED-Rviz.jpg -------------------------------------------------------------------------------- /rviz-plugin-zed-od/icons/ZedObjDet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/rviz-plugin-zed-od/icons/ZedObjDet.png -------------------------------------------------------------------------------- /zed_display_rviz2/images/ZEDM-Rviz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/zed_display_rviz2/images/ZEDM-Rviz.jpg -------------------------------------------------------------------------------- /tutorials/zed_multi_camera/image/frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/tutorials/zed_multi_camera/image/frames.png -------------------------------------------------------------------------------- /zed_display_rviz2/images/depthcloud-RGB.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/zed_display_rviz2/images/depthcloud-RGB.jpg -------------------------------------------------------------------------------- /rviz-plugin-zed-od/images/rviz2_od_params.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/rviz-plugin-zed-od/images/rviz2_od_params.png -------------------------------------------------------------------------------- /rviz-plugin-zed-od/images/rviz2_od_result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/rviz-plugin-zed-od/images/rviz2_od_result.png -------------------------------------------------------------------------------- /zed_display_foxglove/images/foxglove_zed.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/zed_display_foxglove/images/foxglove_zed.webp -------------------------------------------------------------------------------- /examples/zed_depth_to_laserscan/images/laserscan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/examples/zed_depth_to_laserscan/images/laserscan.jpg -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/images/robot_viz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/tutorials/zed_robot_integration/images/robot_viz.jpg -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_multi_camera/image/frames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/isaac_ros/zed_isaac_ros_multi_camera/image/frames.png -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/images/no_zed_loc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/tutorials/zed_robot_integration/images/no_zed_loc.jpg -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/images/use_zed_loc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/tutorials/zed_robot_integration/images/use_zed_loc.jpg -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/images/robot_viz_dual.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/tutorials/zed_robot_integration/images/robot_viz_dual.jpg -------------------------------------------------------------------------------- /examples/zed_depth_to_laserscan/images/pointcloud_scan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/examples/zed_depth_to_laserscan/images/pointcloud_scan.jpg -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/images/no_zed_loc_dual.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/tutorials/zed_robot_integration/images/no_zed_loc_dual.jpg -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/images/use_zed_loc_dual.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereolabs/zed-ros2-examples/HEAD/tutorials/zed_robot_integration/images/use_zed_loc_dual.jpg -------------------------------------------------------------------------------- /tools/zed_benchmark/README.md: -------------------------------------------------------------------------------- 1 | # ZED Benchmark 2 | 3 | This package contains a set of benchmarks to test the performances of the ZED ROS2 Wrapper 4 | 5 | ## Usage 6 | 7 | ``` bash 8 | $ ros2 run zed_topic_benchmark zed_topic_benchmark --ros-args -p topic_name:= 9 | ``` -------------------------------------------------------------------------------- /tools/zed_benchmark_interfaces/msg/BenchmarkStatsStamped.msg: -------------------------------------------------------------------------------- 1 | # Standard Header 2 | std_msgs/Header header 3 | 4 | # Instant Frequency 5 | float32 topic_freq 6 | # Average Frequency 7 | float32 topic_avg_freq 8 | 9 | # Instant Bandwidth 10 | float32 topic_bw 11 | # Average Bandwidth 12 | float32 topic_avg_bw -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "colcon", 6 | "args": [ 7 | "--workspace", 8 | "/home/walter/devel/ros2_ws/src/zed-ros2-examples", 9 | "build" 10 | ], 11 | "group": "build", 12 | "problemMatcher": [], 13 | "label": "colcon: build" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_april_tag/README.md: -------------------------------------------------------------------------------- 1 | # ZED + Isaac ROS AprilTag Example 2 | 3 | This example creates an Isaac ROS graph to detect AprilTags in the ZED camera feed using Isaac ROS nodes. 4 | 5 | Details about the examples are available in the [Isaac ROS with ZED documentation](https://docs.stereolabs.com/isaac-ros/tutorial_apriltag). 6 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | How to use the ZED ROS 2 nodes alongside other ROS 2 packages or nodes. 4 | 5 | - [zed_aruco_localization](./zed_aruco_localization): use localized ArUco tag as a reference for localization. 6 | - [zed_depth_to_laserscan](./zed_depth_to_laserscan): convert ZED Depth maps into virtual Laser Scans using 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tutorials/zed_video_tutorial/README.md: -------------------------------------------------------------------------------- 1 | # TUTORIAL - ZED video subscription 2 | 3 | In this tutorial you will learn how to write a simple node that subscribes to messages of type sensor_msgs/Image to retrieve the Left and Right rectified images published by the ZED node. 4 | 5 | The complete documentation is available on the [Stereolabs website](https://www.stereolabs.com/docs/ros2/040_video) 6 | -------------------------------------------------------------------------------- /tutorials/zed_pose_tutorial/README.md: -------------------------------------------------------------------------------- 1 | # TUTORIAL - ZED pose subscription 2 | 3 | In this tutorial, you will learn how to write a simple node that subscribes to messages of type `nav_msgs/Odometry` and `geometry_msgs/PoseStamped` to retrieve the Odometry and Pose referred to `base_line` frame. 4 | 5 | The complete documentation is available on the [Stereolabs website](https://www.stereolabs.com/docs/ros2/060_positional-tracking) 6 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_nitros_sub/README.md: -------------------------------------------------------------------------------- 1 | # ZED Nitros Subscriber Example 2 | 3 | This is an example that subscribes to ZED camera topics using NITROS and displays communication benchmarks. 4 | 5 | The example shows the difference in performance when using NITROS compared to standard ROS2 communication. 6 | 7 | Details about the examples are available in the [Isaac ROS with ZED documentation](https://docs.stereolabs.com/isaac-ros). 8 | -------------------------------------------------------------------------------- /tutorials/zed_depth_tutorial/README.md: -------------------------------------------------------------------------------- 1 | # TUTORIAL - Depth subscription 2 | 3 | In this tutorial, you will learn how to write a simple node that subscribes to messages of type sensor_msgs/Image to retrieve the depth images published by the ZED node and to get the measured distance at the center of the image 4 | 5 | The complete documentation is available on the [Stereolabs website](https://www.stereolabs.com/docs/ros2/050_depth-sensing) 6 | 7 | 8 | -------------------------------------------------------------------------------- /tutorials/zed_rgb_convert/README.md: -------------------------------------------------------------------------------- 1 | # TUTORIAL - ROS 2 Composition 2 | 3 | In this tutorial, you will learn how to take advantage of the ROS 2 Composition and Intra Process Communication concepts to write a new component that subscribes to 4 channels BGRA ZED images and re-publishes them as 3 channels BGR images. 4 | 5 | The complete documentation is available on the [Stereolabs website](https://www.stereolabs.com/docs/ros2/130_ros2-composition/) 6 | -------------------------------------------------------------------------------- /rviz-plugin-zed-od/plugins_description.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | Displays the results of the Object Detection module of the Stereolabs ZED SDK. 7 | 8 | zed_msgs/msg/Objects 9 | 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | 3 | *.slo 4 | *.lo 5 | *.o 6 | *.a 7 | *.la 8 | *.lai 9 | *.so 10 | *.dll 11 | *.dylib 12 | 13 | # Qt-es 14 | 15 | /.qmake.cache 16 | /.qmake.stash 17 | *.pro.user 18 | *.pro.user.* 19 | *.qbs.user 20 | *.qbs.user.* 21 | *.moc 22 | moc_*.cpp 23 | moc_*.h 24 | qrc_*.cpp 25 | ui_*.h 26 | Makefile* 27 | *build-* 28 | 29 | # QtCreator 30 | 31 | *.autosave 32 | 33 | # QtCtreator Qml 34 | *.qmlproject.user 35 | *.qmlproject.user.* 36 | 37 | # QtCtreator CMake 38 | CMakeLists.txt.user* 39 | 40 | #VSCode 41 | .vscode 42 | -------------------------------------------------------------------------------- /tutorials/zed_rgb_convert/.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | 3 | *.slo 4 | *.lo 5 | *.o 6 | *.a 7 | *.la 8 | *.lai 9 | *.so 10 | *.dll 11 | *.dylib 12 | 13 | # Qt-es 14 | 15 | /.qmake.cache 16 | /.qmake.stash 17 | *.pro.user 18 | *.pro.user.* 19 | *.qbs.user 20 | *.qbs.user.* 21 | *.moc 22 | moc_*.cpp 23 | moc_*.h 24 | qrc_*.cpp 25 | ui_*.h 26 | Makefile* 27 | *build-* 28 | 29 | # QtCreator 30 | 31 | *.autosave 32 | 33 | # QtCtreator Qml 34 | *.qmlproject.user 35 | *.qmlproject.user.* 36 | 37 | # QtCtreator CMake 38 | CMakeLists.txt.user* 39 | 40 | -------------------------------------------------------------------------------- /examples/zed_aruco_localization/.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | 3 | *.slo 4 | *.lo 5 | *.o 6 | *.a 7 | *.la 8 | *.lai 9 | *.so 10 | *.dll 11 | *.dylib 12 | 13 | # Qt-es 14 | 15 | /.qmake.cache 16 | /.qmake.stash 17 | *.pro.user 18 | *.pro.user.* 19 | *.qbs.user 20 | *.qbs.user.* 21 | *.moc 22 | moc_*.cpp 23 | moc_*.h 24 | qrc_*.cpp 25 | ui_*.h 26 | Makefile* 27 | *build-* 28 | 29 | # QtCreator 30 | 31 | *.autosave 32 | 33 | # QtCtreator Qml 34 | *.qmlproject.user 35 | *.qmlproject.user.* 36 | 37 | # QtCtreator CMake 38 | CMakeLists.txt.user* 39 | 40 | -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_robot_integration) 3 | 4 | # Default to C99 5 | if(NOT CMAKE_C_STANDARD) 6 | set(CMAKE_C_STANDARD 99) 7 | endif() 8 | 9 | # Default to C++17 10 | if(NOT CMAKE_CXX_STANDARD) 11 | set(CMAKE_CXX_STANDARD 17) 12 | endif() 13 | 14 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 15 | add_compile_options(-Wall -Wextra -Wpedantic) 16 | endif() 17 | 18 | find_package(ament_cmake REQUIRED) 19 | 20 | install(DIRECTORY launch urdf rviz2 21 | DESTINATION share/${PROJECT_NAME}/) 22 | 23 | ament_package() -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Online Documentation 4 | url: https://www.stereolabs.com/docs/ 5 | about: Check out the Stereolabs documentation for answers to common questions. 6 | - name: Stereolabs Community 7 | url: https://community.stereolabs.com/ 8 | about: Ask questions, request features & discuss with other users and developers. 9 | - name: Stereolabs Twitter 10 | url: https://twitter.com/Stereolabs3D 11 | about: The official Stereolabs Twitter account to ask questions, comment our products and share your projects with the ZED community. 12 | 13 | -------------------------------------------------------------------------------- /zed_display_foxglove/README.md: -------------------------------------------------------------------------------- 1 | # Stereolabs ZED Camera - Foxglove Display package 2 | 3 | This package contains resources and layouts in order to use the ZED ROS2 Wrapper with [Foxglove Studio](https://foxglove.dev/product). 4 | 5 | ## Import a layout 6 | 7 | To import a layout in Foxglove Studio, click on the "Import from file..." button in the top right corner in Foxglove in the layouts menu, and select one of Stereolabs' [layouts](./layouts/) (in JSON format). 8 | 9 | ![ZED rendering on Foxglove Studio](images/foxglove_zed.webp) 10 | 11 | ## For more information 12 | 13 | Please take a look at our guide in our [documentation](https://www.stereolabs.com/docs/ros2/foxglove) to connect the ZED ROS2 Wrapper with Foxglove. 14 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_april_tag/config/zed_isaac_ros_april_tag.yaml: -------------------------------------------------------------------------------- 1 | # config/zed_isaac_ros_april_tag.yaml 2 | # Parameters for AprilTag detection 3 | --- 4 | /**: 5 | ros__parameters: 6 | size: 0.155 # The tag edge size in meters, assuming square markers. For example, 0.22 7 | max_tags: 64 # The maximum number of tags to be detected. For example, 64 8 | tile_size: 4 # Tile/window size used for adaptive thresholding in pixels. For example, 4 9 | tag_family: 'tag36h11' # Tag family to detect. CUDA backend only supports tag36h11. CPU and PVA backends support tag36h11, tag16h5, tag25h9, tag36h10, tag36h11, circle21h7, circle49h12, custom48h12, standard41h12, standard52h13 10 | backends: 'CUDA' # Backend to perform detection with. Options include CPU, CUDA, PVA -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_april_tag/config/zed_params.yaml: -------------------------------------------------------------------------------- 1 | # config/zed_params.yaml 2 | # Stereolabs ZED Stereo camera parameters override file 3 | # This file is used to override the default parameters of the ZED camera. 4 | 5 | /**: 6 | ros__parameters: 7 | general: 8 | grab_resolution: 'HD1080' # The native camera grab resolution. 'HD2K', 'HD1200', 'HD1080', 'HD720', 'SVGA', 'AUTO' 9 | grab_frame_rate: 30 # ZED SDK internal grabbing rate (HD1200/HD1080: 60, 30, 15 - SVGA: 120, 60, 30, 15) 10 | pub_resolution: 'CUSTOM' # The resolution used for image and depth map publishing. 'NATIVE' to use the same `general.grab_resolution` - `CUSTOM` to apply the `general.pub_downscale_factor` downscale factory to reduce bandwidth in transmission 11 | pub_downscale_factor: 2.0 # rescale factor used to rescale image before publishing when 'pub_resolution' is 'CUSTOM' 12 | pub_frame_rate: 30.0 -------------------------------------------------------------------------------- /examples/zed_depth_to_laserscan/config/zed_depth_to_laserscan.yaml: -------------------------------------------------------------------------------- 1 | # config/depth_to_scan.yaml 2 | # Parameters for Depth image to laser scan conversion 3 | --- 4 | /**: 5 | ros__parameters: 6 | scan_time: 0.033 # The time in seconds between scans to report to the consumer of the LaserScan message. This is set directly in the published message. Defaults to 0.033 seconds. 7 | range_min: 0.3 # The minimum distance in meters a projected point should be. Points closer than this are discarded. Defaults to 0.3 meters. 8 | range_max: 10.0 # The maximum distance in meters a projected point should be. Points further than this are discarded. Defaults to 10.0 meters. 9 | scan_height: 1 # The row from the depth image to use for the laser projection. Defaults to 1. 10 | output_frame: "camera_depth_frame" # [Normally overwritten by launch file] The frame id to publish in the LaserScan message. Defaults to "camera_depth_frame". -------------------------------------------------------------------------------- /isaac_ros/README.md: -------------------------------------------------------------------------------- 1 | # Isaac ROS Examples 2 | 3 | This repository contains example applications that demonstrate how to use the [Isaac ROS](https://developer.nvidia.com/isaac-ros) SDK with the [ZED ROS2 Wrapper](https://github.com/stereolabs/zed-ros2-wrapper). 4 | 5 | ## Prerequisites 6 | 7 | - [NVIDIA Isaac ROS with NITROS](https://docs.stereolabs.com/isaac-ros) 8 | - [ZED ROS2 Wrapper](https://docs.stereolabs.com/ros2) 9 | 10 | ## Available Examples 11 | 12 | - [zed_isaac_ros_nitros_sub](https://github.com/stereolabs/zed-ros2-examples/tree/main/isaac_ros/zed_isaac_ros_nitros_sub): An example that shows how to subscribe to ZED camera topics using NITROS and displays communication benchmarks comparing NITROS and standard ROS2 communication. 13 | - [zed_isaac_ros_april_tag](https://github.com/stereolabs/zed-ros2-examples/tree/main/isaac_ros/zed_isaac_ros_april_tag): An example that creates an Isaac ROS graphs to detects AprilTags in the ZED camera feed using Isaac ROS nodes. 14 | -------------------------------------------------------------------------------- /tutorials/zed_video_tutorial/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_tutorial_video 5 | 5.1.0 6 | This package is a tutorial showing how to subscribe to ZED video streams 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | rclcpp 15 | sensor_msgs 16 | 17 | ament_cmake 18 | 19 | 20 | -------------------------------------------------------------------------------- /.github/workflows/stale_issues.yml: -------------------------------------------------------------------------------- 1 | name: 'Stale issue handler' 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: '00 00 * * *' 6 | 7 | jobs: 8 | stale: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/stale@main 12 | id: stale 13 | with: 14 | stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment otherwise it will be automatically closed in 5 days' 15 | stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment otherwise it will be automatically closed in 5 days' 16 | days-before-stale: 30 17 | days-before-close: 5 18 | operations-per-run: 1500 19 | exempt-issue-labels: 'feature_request' 20 | exempt-pr-labels: 'feature_request' 21 | enable-statistics: 'true' 22 | close-issue-label: 'closed_for_stale' 23 | close-pr-label: 'closed_for_stale' 24 | -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_robot_integration 5 | 5.1.0 6 | Scout Mini URDF with ZED Description 7 | 8 | TODO 9 | TODO 10 | 11 | Apache License 2.0 12 | 13 | ament_cmake 14 | ament_cmake_auto 15 | 16 | zed_wrapper 17 | zed_msgs 18 | scout_description 19 | xacro 20 | 21 | ament_lint_auto 22 | ament_lint_common 23 | 24 | 25 | ament_cmake 26 | 27 | 28 | -------------------------------------------------------------------------------- /tutorials/zed_multi_camera/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_multi_camera 5 | 5.1.0 6 | This package is a tutorial showing how to configure a multi-camera system. 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | zed_wrapper 15 | ament_lint_auto 16 | ament_lint_common 17 | ament_cmake_clang_format 18 | 19 | ament_cmake 20 | 21 | 22 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_multi_camera/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_isaac_ros_multi_camera 5 | 5.1.0 6 | This package is a tutorial showing how to configure a multi-camera system. 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | zed_wrapper 15 | ament_lint_auto 16 | ament_lint_common 17 | ament_cmake_clang_format 18 | 19 | ament_cmake 20 | 21 | 22 | -------------------------------------------------------------------------------- /tutorials/zed_depth_tutorial/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_tutorial_depth 5 | 5.1.0 6 | This package is a tutorial showing how to subscribe to ZED depth streams 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | rclcpp 15 | sensor_msgs 16 | ament_lint_auto 17 | ament_lint_common 18 | ament_cmake_clang_format 19 | 20 | ament_cmake 21 | 22 | 23 | -------------------------------------------------------------------------------- /tutorials/zed_pose_tutorial/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_tutorial_pos_tracking 5 | 5.1.0 6 | This package is a tutorial showing how to subscribe to ZED pose and odometry messages 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | rclcpp 15 | geometry_msgs 16 | nav_msgs 17 | tf2 18 | tf2_ros 19 | ament_lint_auto 20 | ament_lint_common 21 | ament_cmake_clang_format 22 | 23 | ament_cmake 24 | 25 | 26 | -------------------------------------------------------------------------------- /tools/zed_benchmark_component/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_topic_benchmark_component 5 | 5.1.0 6 | This package contains tools to test the performance of the ZED ROS2 Wrapper 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | zed_topic_benchmark_interfaces 15 | rclcpp 16 | zed_topic_benchmark_interfaces 17 | rclcpp 18 | ament_lint_auto 19 | ament_lint_common 20 | ament_cmake_clang_format 21 | 22 | ament_cmake 23 | 24 | 25 | -------------------------------------------------------------------------------- /tutorials/zed_ipc/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_ipc 5 | 5.1.0 6 | Contains a tutorial to leverage IPC to subscribe to point cloud topics 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | 13 | ament_cmake 14 | 15 | ament_cmake_auto 16 | rclcpp 17 | rclcpp_components 18 | rcutils 19 | builtin_interfaces 20 | sensor_msgs 21 | 22 | zed_multi_camera 23 | 24 | ament_lint_auto 25 | ament_lint_common 26 | ament_cmake_clang_format 27 | 28 | ament_cmake 29 | 30 | 31 | -------------------------------------------------------------------------------- /tools/zed_benchmark/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_topic_benchmark 5 | 5.1.0 6 | This package contains tools to test the performance of the ZED ROS2 Wrapper 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | zed_topic_benchmark_component 15 | rclcpp 16 | rclcpp_components 17 | zed_topic_benchmark_component 18 | rclcpp 19 | rclcpp_components 20 | ament_lint_auto 21 | ament_lint_common 22 | ament_cmake_clang_format 23 | 24 | ament_cmake 25 | 26 | 27 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_april_tag/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_isaac_ros_april_tag 5 | 5.1.0 6 | Contains an example to integrate ZED camera with Isaac ROS for AprilTag detection leveraging NITROS communication. 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | rcutils 15 | builtin_interfaces 16 | 17 | zed_components 18 | zed_wrapper 19 | launch_ros 20 | rcutils 21 | builtin_interfaces 22 | 23 | ament_lint_common 24 | ament_cmake_clang_format 25 | 26 | ament_cmake 27 | 28 | 29 | -------------------------------------------------------------------------------- /zed_display_rviz2/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_display_rviz2 5 | 5.1.0 6 | "zed_display_rviz2" is a ROS 2 package to visualize in RVIZ2 the information from the "zed_wrapper" node 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | rviz2 15 | launch_ros 16 | robot_state_publisher 17 | zed_wrapper 18 | zed_msgs 19 | zed_components 20 | grid_map_rviz_plugin 21 | ament_lint_auto 22 | ament_lint_common 23 | ament_cmake_clang_format 24 | 25 | ament_cmake 26 | 27 | 28 | -------------------------------------------------------------------------------- /tools/zed_benchmark_interfaces/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_topic_benchmark_interfaces 5 | 5.1.0 6 | Contains message and service definitions used by the ZED ROS2 topic benchmark tool. 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | builtin_interfaces 15 | std_msgs 16 | rosidl_default_generators 17 | std_msgs 18 | rosidl_default_runtime 19 | ament_lint_auto 20 | ament_lint_common 21 | ament_cmake_clang_format 22 | rosidl_interface_packages 23 | 24 | ament_cmake 25 | 26 | 27 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "browse": { 5 | "limitSymbolsToIncludedHeaders": true, 6 | "path": [ 7 | "/opt/ros/foxy/include/**", 8 | "/usr/include/**", 9 | "/usr/local/zed/include/**", 10 | "${workspaceFolder}" 11 | ] 12 | }, 13 | "includePath": [ 14 | "/opt/ros/noetic/include/**", 15 | "/usr/include/**", 16 | "/usr/local/zed/include/**" 17 | ], 18 | "name": "ROS", 19 | "macFrameworkPath": [], 20 | "compilerArgs": [], 21 | "cStandard": "c11", 22 | "cppStandard": "c++14", 23 | "intelliSenseMode": "linux-clang-x64", 24 | "compilerPath": "/usr/bin/clang" 25 | }, 26 | { 27 | "name": "ROS2", 28 | "includePath": [ 29 | "/opt/ros/foxy/include/**", 30 | "/usr/include/**", 31 | "/usr/local/zed/include/**", 32 | "/home/walter/devel/ros2_ws/build/**", 33 | "./**" 34 | ], 35 | "defines": [], 36 | "compilerPath": "/usr/bin/clang", 37 | "cStandard": "c11", 38 | "cppStandard": "c++14", 39 | "intelliSenseMode": "linux-clang-x64" 40 | } 41 | ], 42 | "version": 4 43 | } -------------------------------------------------------------------------------- /rviz-plugin-zed-od/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rviz_plugin_zed_od 5 | 5.1.0 6 | Plugin to display Object Detection results on RVIZ2 7 | STEREOLABS 8 | 9 | Apache License 2.0 10 | 11 | https://www.stereolabs.com/ 12 | https://github.com/stereolabs/zed-ros2-wrapper 13 | https://github.com/stereolabs/zed-ros2-wrapper/issues 14 | 15 | ament_cmake 16 | ament_cmake_auto 17 | 18 | qtbase5-dev 19 | rviz_ogre_vendor 20 | 21 | rviz_ogre_vendor 22 | 23 | libqt5-core 24 | libqt5-gui 25 | libqt5-opengl 26 | libqt5-widgets 27 | rviz_ogre_vendor 28 | 29 | zed_msgs 30 | 31 | ament_lint_auto 32 | ament_lint_common 33 | ament_cmake_clang_format 34 | 35 | 36 | ament_cmake 37 | 38 | 39 | -------------------------------------------------------------------------------- /tutorials/zed_ipc/src/components/include/winavg.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef WINAVG_HPP_ 16 | #define WINAVG_HPP_ 17 | 18 | #include // size_t 19 | #include // std::dequeue 20 | #include 21 | 22 | namespace stereolabs 23 | { 24 | 25 | class WinAvg 26 | { 27 | public: 28 | explicit WinAvg(size_t win_size = 500); 29 | virtual ~WinAvg(); 30 | 31 | double setNewSize(size_t win_size); 32 | double addValue(double val); 33 | 34 | /// @brief Get the current average of the stored values 35 | /// @return average of the stored values 36 | double getAvg(); 37 | 38 | inline size_t size() {return mVals.size();} 39 | 40 | private: 41 | size_t mWinSize; 42 | 43 | std::deque 44 | mVals; // The values in the queue used to calculate the windowed average 45 | double mSumVals = 0.0; // The updated sum of the values in the queue 46 | 47 | std::mutex mQueueMux; 48 | }; 49 | 50 | } // namespace stereolabs 51 | 52 | #endif // WINAVG_HPP_ 53 | -------------------------------------------------------------------------------- /tools/zed_benchmark_component/src/component/include/winavg.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef WINAVG_HPP_ 16 | #define WINAVG_HPP_ 17 | 18 | #include // size_t 19 | #include // std::dequeue 20 | #include 21 | 22 | namespace stereolabs 23 | { 24 | 25 | class WinAvg 26 | { 27 | public: 28 | explicit WinAvg(size_t win_size = 15); 29 | ~WinAvg(); 30 | 31 | double setNewSize(size_t win_size); 32 | double addValue(double val); 33 | 34 | /// @brief Get the current average of the stored values 35 | /// @return average of the stored values 36 | double getAvg(); 37 | 38 | inline size_t size() {return mVals.size();} 39 | 40 | private: 41 | size_t mWinSize; 42 | 43 | std::deque 44 | mVals; // The values in the queue used to calculate the windowed average 45 | double mSumVals = 0.0; // The updated sum of the values in the queue 46 | 47 | std::mutex mQueueMux; 48 | }; 49 | 50 | } // namespace stereolabs 51 | 52 | #endif // WINAVG_HPP_ 53 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_nitros_sub/config/example_params.yaml: -------------------------------------------------------------------------------- 1 | # config/example_params.yaml 2 | 3 | --- 4 | /**: 5 | ros__parameters: 6 | general: 7 | grab_resolution: 'HD1200' # The native camera grab resolution. 'HD1200', 'HD2K', 'HD1080', 'HD720', 'SVGA', 'VGA', 'AUTO' 8 | grab_frame_rate: 60 # ZED SDK internal grabbing rate 9 | pub_resolution: 'NATIVE' # The resolution used for image and depth map publishing. 'NATIVE' to use the same `general.grab_resolution` - `CUSTOM` to apply the `general.pub_downscale_factor` downscale factory to reduce bandwidth in transmission 10 | pub_downscale_factor: 2.0 # rescale factor used to rescale image before publishing when 'pub_resolution' is 'CUSTOM' 11 | pub_frame_rate: 60.0 # [DYNAMIC] Frequency of publishing of visual images and depth data (not the Point Cloud, see 'depth.point_cloud_freq'). This value must be equal or less than the camera framerate. 12 | 13 | benchmark: 14 | tot_samples: 100 # Total number of samples to process before exiting 15 | cpu_gpu_load_period: 10 # Period in milliseconds to retrieve CPU and GPU load statistics 16 | cpu_gpu_load_avg_wnd_size: 5 # Number of samples to use to compute the average CPU and GPU load average 17 | csv_log_file: 'zed_nitros_benchmark.csv' # If not empty, log the benchmark results in a CSV file with the specified name 18 | 19 | debug: 20 | debug_nitros: false # Enable Nitros debug information 21 | use_pub_timestamps: true # Used to measure the real communication latency. -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_nitros_sub/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_isaac_ros_nitros_sub 5 | 5.1.0 6 | Contains an example to subscribe to ZED camera topics using NITROS and display communication benchmarks. 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | rclcpp 15 | rclcpp_components 16 | rcutils 17 | builtin_interfaces 18 | sensor_msgs 19 | zed_components 20 | zed_components 21 | launch_ros 22 | rclcpp 23 | rclcpp_components 24 | rcutils 25 | builtin_interfaces 26 | sensor_msgs 27 | ament_lint_auto 28 | ament_lint_common 29 | ament_cmake_clang_format 30 | 31 | ament_cmake 32 | 33 | 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/1_feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 🧭 2 | description: Suggest an idea for this project. 3 | labels: "feature request" 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | # Welcome 👋 9 | 10 | Thanks for taking the time to fill out this feature request module. 11 | Please fill out each section below. This info allows Stereolabs developers to correctly evaluate your request. 12 | 13 | Useful Links: 14 | - Documentation: https://www.stereolabs.com/docs/ 15 | - Stereolabs support: https://support.stereolabs.com/hc/en-us/ 16 | - type: checkboxes 17 | attributes: 18 | label: Preliminary Checks 19 | description: Please make sure that you verify each checkbox and follow the instructions for them. 20 | options: 21 | - label: "This issue is not a duplicate. Before opening a new issue, please search existing issues." 22 | required: true 23 | - label: "This issue is not a question, bug report, or anything other than a feature request directly related to this project." 24 | required: true 25 | - type: textarea 26 | attributes: 27 | label: Proposal 28 | description: "What would you like to have as a new feature?" 29 | placeholder: "A clear and concise description of what you want to happen." 30 | validations: 31 | required: true 32 | - type: textarea 33 | attributes: 34 | label: Use-Case 35 | description: "How would this help you?" 36 | placeholder: "Tell us more what you'd like to achieve." 37 | validations: 38 | required: false 39 | - type: textarea 40 | id: anything-else 41 | attributes: 42 | label: Anything else? 43 | description: "Let us know if you have anything else to share" 44 | -------------------------------------------------------------------------------- /tutorials/zed_rgb_convert/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_rgb_convert 5 | 5.1.0 6 | Contains a ros2 examples node that subscribes to a ZED BGRA image topic and converts it to BGR 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | rclcpp 15 | rclcpp_components 16 | rcutils 17 | builtin_interfaces 18 | sensor_msgs 19 | image_transport 20 | zed_components 21 | zed_components 22 | launch_ros 23 | rclcpp 24 | rclcpp_components 25 | rcutils 26 | builtin_interfaces 27 | sensor_msgs 28 | image_transport 29 | ament_lint_auto 30 | ament_lint_common 31 | ament_cmake_clang_format 32 | 33 | ament_cmake 34 | 35 | 36 | -------------------------------------------------------------------------------- /tutorials/zed_rgb_convert/src/component/include/zed_rgb_convert_component.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ZED_RGB_CONVERT_COMPONENT_HPP_ 16 | #define ZED_RGB_CONVERT_COMPONENT_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "cvt_visibility_control.hpp" 28 | 29 | namespace stereolabs 30 | { 31 | 32 | class ZedRgbCvtComponent : public rclcpp::Node 33 | { 34 | public: 35 | ZED_CVT_COMPONENT_PUBLIC 36 | explicit ZedRgbCvtComponent(const rclcpp::NodeOptions & options); 37 | 38 | virtual ~ZedRgbCvtComponent() {} 39 | 40 | protected: 41 | void camera_callback( 42 | const sensor_msgs::msg::Image::ConstSharedPtr & img, 43 | const sensor_msgs::msg::CameraInfo::ConstSharedPtr & cam_info); 44 | 45 | private: 46 | // Publisher 47 | image_transport::CameraPublisher mPubBgr; 48 | 49 | // Subscriber 50 | image_transport::CameraSubscriber mSubBgra; 51 | 52 | // QoS parameters 53 | rclcpp::QoS mDefaultQoS; 54 | }; 55 | 56 | } // namespace stereolabs 57 | 58 | #endif // ZED_RGB_CONVERT_COMPONENT_HPP_ 59 | -------------------------------------------------------------------------------- /rviz-plugin-zed-od/src/include/visibility_control.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef VISIBILITY_CONTROL_HPP_ 16 | #define VISIBILITY_CONTROL_HPP_ 17 | 18 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki: 19 | // https://gcc.gnu.org/wiki/Visibility 20 | 21 | #if defined _WIN32 || defined __CYGWIN__ 22 | #ifdef __GNUC__ 23 | #define ZED_OD_PLUGIN_EXPORT __attribute__((dllexport)) 24 | #define ZED_OD_PLUGIN_IMPORT __attribute__((dllimport)) 25 | #else 26 | #define ZED_OD_PLUGIN_EXPORT __declspec(dllexport) 27 | #define ZED_OD_PLUGIN_IMPORT __declspec(dllimport) 28 | #endif 29 | #ifdef ZED_OD_PLUGIN_BUILDING_LIBRARY 30 | #define ZED_OD_PLUGIN_PUBLIC ZED_OD_PLUGIN_EXPORT 31 | #else 32 | #define ZED_OD_PLUGIN_PUBLIC ZED_OD_PLUGIN_IMPORT 33 | #endif 34 | #define ZED_OD_PLUGIN_PUBLIC_TYPE ZED_OD_PLUGIN_PUBLIC 35 | #define ZED_OD_PLUGIN_LOCAL 36 | #else 37 | #define ZED_OD_PLUGIN_EXPORT __attribute__((visibility("default"))) 38 | #define ZED_OD_PLUGIN_IMPORT 39 | #if __GNUC__ >= 4 40 | #define ZED_OD_PLUGIN_PUBLIC __attribute__((visibility("default"))) 41 | #define ZED_OD_PLUGIN_LOCAL __attribute__((visibility("hidden"))) 42 | #else 43 | #define ZED_OD_PLUGIN_PUBLIC 44 | #define ZED_OD_PLUGIN_LOCAL 45 | #endif 46 | #define ZED_OD_PLUGIN_PUBLIC_TYPE 47 | #endif 48 | 49 | #endif // VISIBILITY_CONTROL_HPP_ 50 | -------------------------------------------------------------------------------- /examples/zed_aruco_localization/config/aruco_loc.yaml: -------------------------------------------------------------------------------- 1 | # config/aruco_loc.yaml 2 | # Parameters for ArUco localization 3 | 4 | --- 5 | /**: 6 | ros__parameters: 7 | 8 | general: 9 | marker_count: 2 # Number of markers in the World 10 | marker_size: 0.16 # Width/Height of the ArUco markers [m] 11 | maximum_distance: 2.0 # Maximum distance of the target from the camera to consider it valid 12 | detection_rate: 0.5 # Maximum detection frequency for pose update 13 | camera_name: 'zed' # Name of the camera to relocate 14 | world_frame_id: 'map' # Frame id of the world frame 15 | refine_detection: false # If enabled the corners of the detected markers will be processed to obtain sub-pixel precision 16 | 17 | debug: 18 | active: true # Enable debug messages 19 | 20 | marker_000: 21 | aruco_id: 40 # ID of the ArUco tag as retrieved by the ArUco Detector code 22 | position: [0.0,0.0,0.0] # Pose with respect to the World origin [m] 23 | orientation: [0.0,0.0,0.0] # Orientation with respect to the World origin [rad] 24 | 25 | marker_001: 26 | aruco_id: 19 # ID of the ArUco tag as retrieved by the ArUco Detector code 27 | position: [0.0,0.0,1.09] # Pose with respect to the World origin [m] 28 | orientation: [0.0,0.0,0.0] # Orientation with respect to the World origin [rad] 29 | 30 | # Add a number of marker definitions equal to the number of markers in the World according to the `marker_count` value 31 | 32 | #marker_xxx: 33 | # aruco_id: YYY # ID of the ArUco tag as retrieved by the ArUco Detector code 34 | # position: [x.x,y.y,z.z] # Pose with respect to the World origin [m] 35 | # orientation: [R.R,P.P,Y.Y] # Orientation with respect to the World origin [rad] -------------------------------------------------------------------------------- /tools/zed_benchmark/src/topic_benchmark_container.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include "zed_topic_benchmark_component/topic_benchmark_component.hpp" 18 | 19 | int main(int argc, char * argv[]) 20 | { 21 | // Force flush of the stdout buffer. 22 | setvbuf(stdout, NULL, _IONBF, BUFSIZ); 23 | 24 | // Initialize any global resources needed by the middleware and the client 25 | // library. This will also parse command line arguments one day (as of Beta 1 26 | // they are not used). You must call this before using any other part of the 27 | // ROS system. This should be called once per process. 28 | rclcpp::init(argc, argv); 29 | 30 | // Create an executor that will be responsible for execution of callbacks for 31 | // a set of nodes. With this version, all callbacks will be called from within 32 | // this thread (the main one). 33 | rclcpp::executors::SingleThreadedExecutor exec; 34 | rclcpp::NodeOptions options; 35 | 36 | // Add topic_benchmark node 37 | auto node = std::make_shared(options); 38 | exec.add_node(node); 39 | 40 | // spin will block until work comes in, execute work as it becomes available, 41 | // and keep blocking. It will only be interrupted by Ctrl-C. 42 | exec.spin(); 43 | 44 | rclcpp::shutdown(); 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /tutorials/zed_ipc/src/components/src/winavg.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "winavg.hpp" 16 | 17 | #include 18 | 19 | namespace stereolabs 20 | { 21 | 22 | WinAvg::WinAvg(size_t win_size) 23 | { 24 | mWinSize = win_size; 25 | mSumVals = 0.0; 26 | } 27 | 28 | WinAvg::~WinAvg() {} 29 | 30 | double WinAvg::setNewSize(size_t win_size) 31 | { 32 | std::lock_guard guard(mQueueMux); 33 | 34 | mWinSize = win_size; 35 | while (mVals.size() > mWinSize) { 36 | double val = mVals.back(); 37 | mVals.pop_back(); 38 | mSumVals -= val; 39 | } 40 | 41 | return mSumVals / mVals.size(); 42 | } 43 | 44 | double WinAvg::addValue(double val) 45 | { 46 | std::lock_guard guard(mQueueMux); 47 | if (mVals.size() == mWinSize) { 48 | double older = mVals.back(); 49 | mVals.pop_back(); 50 | mSumVals -= older; 51 | } 52 | 53 | mVals.push_front(val); 54 | mSumVals += val; 55 | 56 | auto avg = mSumVals / mVals.size(); 57 | 58 | // std::cout << "New val: " << val << " - Size: " << mVals.size() 59 | // << " - Sum: " << mSumVals << " - Avg: " << avg << std::endl; 60 | 61 | return avg; 62 | } 63 | 64 | double WinAvg::getAvg() 65 | { 66 | std::lock_guard guard(mQueueMux); 67 | 68 | double avg = mSumVals / mVals.size(); 69 | 70 | return avg; 71 | } 72 | 73 | } // namespace stereolabs 74 | -------------------------------------------------------------------------------- /tools/zed_benchmark_component/src/include/visibility_control.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef VISIBILITY_CONTROL_HPP_ 16 | #define VISIBILITY_CONTROL_HPP_ 17 | 18 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki: 19 | // https://gcc.gnu.org/wiki/Visibility 20 | 21 | #if defined _WIN32 || defined __CYGWIN__ 22 | #ifdef __GNUC__ 23 | #define TOPIC_BENCHMARK_EXPORT __attribute__((dllexport)) 24 | #define TOPIC_BENCHMARK_IMPORT __attribute__((dllimport)) 25 | #else 26 | #define TOPIC_BENCHMARK_EXPORT __declspec(dllexport) 27 | #define TOPIC_BENCHMARK_IMPORT __declspec(dllimport) 28 | #endif 29 | #ifdef TOPIC_BENCHMARK_BUILDING_DLL 30 | #define TOPIC_BENCHMARK_PUBLIC TOPIC_BENCHMARK_EXPORT 31 | #else 32 | #define TOPIC_BENCHMARK_PUBLIC TOPIC_BENCHMARK_IMPORT 33 | #endif 34 | #define TOPIC_BENCHMARK_PUBLIC_TYPE TOPIC_BENCHMARK_PUBLIC 35 | #define TOPIC_BENCHMARK_LOCAL 36 | #else 37 | #define TOPIC_BENCHMARK_EXPORT __attribute__((visibility("default"))) 38 | #define TOPIC_BENCHMARK_IMPORT 39 | #if __GNUC__ >= 4 40 | #define TOPIC_BENCHMARK_PUBLIC __attribute__((visibility("default"))) 41 | #define TOPIC_BENCHMARK_LOCAL __attribute__((visibility("hidden"))) 42 | #else 43 | #define TOPIC_BENCHMARK_PUBLIC 44 | #define TOPIC_BENCHMARK_LOCAL 45 | #endif 46 | #define TOPIC_BENCHMARK_PUBLIC_TYPE 47 | #endif 48 | 49 | #endif // VISIBILITY_CONTROL_HPP_ 50 | -------------------------------------------------------------------------------- /tools/zed_benchmark_component/src/component/src/winavg.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "winavg.hpp" 16 | 17 | #include 18 | 19 | namespace stereolabs 20 | { 21 | 22 | WinAvg::WinAvg(size_t win_size) 23 | { 24 | mWinSize = win_size; 25 | mSumVals = 0.0; 26 | } 27 | 28 | WinAvg::~WinAvg() {} 29 | 30 | double WinAvg::setNewSize(size_t win_size) 31 | { 32 | std::lock_guard guard(mQueueMux); 33 | 34 | mWinSize = win_size; 35 | while (mVals.size() > mWinSize) { 36 | double val = mVals.back(); 37 | mVals.pop_back(); 38 | mSumVals -= val; 39 | } 40 | 41 | return mSumVals / mVals.size(); 42 | } 43 | 44 | double WinAvg::addValue(double val) 45 | { 46 | std::lock_guard guard(mQueueMux); 47 | if (mVals.size() == mWinSize) { 48 | double older = mVals.back(); 49 | mVals.pop_back(); 50 | mSumVals -= older; 51 | } 52 | 53 | mVals.push_front(val); 54 | mSumVals += val; 55 | 56 | auto avg = mSumVals / mVals.size(); 57 | 58 | // std::cout << "New val: " << val << " - Size: " << mVals.size() 59 | // << " - Sum: " << mSumVals << " - Avg: " << avg << std::endl; 60 | 61 | return avg; 62 | } 63 | 64 | double WinAvg::getAvg() 65 | { 66 | std::lock_guard guard(mQueueMux); 67 | 68 | double avg = mSumVals / mVals.size(); 69 | 70 | return avg; 71 | } 72 | 73 | } // namespace stereolabs 74 | -------------------------------------------------------------------------------- /examples/zed_aruco_localization/markers/6x6_1000-19.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tutorials/zed_ipc/src/include/ipc_visibility_control.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef VISIBILITY_CONTROL_HPP_ 16 | #define VISIBILITY_CONTROL_HPP_ 17 | 18 | /* *INDENT-OFF* */ 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | /* *INDENT-ON* */ 23 | 24 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki: 25 | // https://gcc.gnu.org/wiki/Visibility 26 | 27 | #if defined _WIN32 || defined __CYGWIN__ 28 | #ifdef __GNUC__ 29 | #define IPC_COMPONENT_EXPORT __attribute__((dllexport)) 30 | #define IPC_COMPONENT_IMPORT __attribute__((dllimport)) 31 | #else 32 | #define IPC_COMPONENT_EXPORT __declspec(dllexport) 33 | #define IPC_COMPONENT_IMPORT __declspec(dllimport) 34 | #endif 35 | #ifdef IPC_COMPONENT_BUILDING_DLL 36 | #define IPC_COMPONENT_PUBLIC IPC_COMPONENT_EXPORT 37 | #else 38 | #define IPC_COMPONENT_PUBLIC IPC_COMPONENT_IMPORT 39 | #endif 40 | #define IPC_COMPONENT_PUBLIC_TYPE IPC_COMPONENT_PUBLIC 41 | #define IPC_COMPONENT_LOCAL 42 | #else 43 | #define IPC_COMPONENT_EXPORT __attribute__((visibility("default"))) 44 | #define IPC_COMPONENT_IMPORT 45 | #if __GNUC__ >= 4 46 | #define IPC_COMPONENT_PUBLIC __attribute__((visibility("default"))) 47 | #define IPC_COMPONENT_LOCAL __attribute__((visibility("hidden"))) 48 | #else 49 | #define IPC_COMPONENT_PUBLIC 50 | #define IPC_COMPONENT_LOCAL 51 | #endif 52 | #define IPC_COMPONENT_PUBLIC_TYPE 53 | #endif 54 | 55 | /* *INDENT-OFF* */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | /* *INDENT-ON* */ 60 | 61 | #endif // CVT_VISIBILITY_CONTROL_HPP_ 62 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | ## Submitting your code changes 3 | 4 | Code contributions should be made via pull requests to the appropriate repositories: 5 | * [zed-ros2-wrapper](https://github.com/stereolabs/zed-ros2-wrapper/pulls) 6 | * [zed-ros2-interfaces](https://github.com/stereolabs/zed-ros2-interfaces/pulls) 7 | * [zed-ros2-examples](https://github.com/stereolabs/zed-ros2-examples/pulls) 8 | 9 | We ask all contributors to follow the practices explained in [ROS 2 documentation](https://docs.ros.org/en/humble/The-ROS2-Project/Contributing/Code-Style-Language-Versions.html). 10 | 11 | Before submitting a pull request please perform this list of tasks from the root of your ROS 2 workspace: 12 | 13 | 1. Automatic code formatting: 14 | 15 | `$ ament_uncrustify --reformat src` 16 | 17 | 2. Build the packages to check for compile errors: 18 | 19 | `$ colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release` 20 | 21 | 3. Perform the automatic build tests: 22 | 23 | `$ colcon test` 24 | 25 | 4. Analyze and solve eventually reported errors: 26 | 27 | `$ colcon test-result --verbose` 28 | 29 | 5. Repeat steps (1) -> (4) until all reported formatting errors have been resolved. 30 | 31 | ## License 32 | 33 | Any contribution that you make to this repository will 34 | be under the Apache 2 License, as dictated by that 35 | [license](http://www.apache.org/licenses/LICENSE-2.0.html): 36 | 37 | ~~~ 38 | 5. Submission of Contributions. Unless You explicitly state otherwise, 39 | any Contribution intentionally submitted for inclusion in the Work 40 | by You to the Licensor shall be under the terms and conditions of 41 | this License, without any additional terms or conditions. 42 | Notwithstanding the above, nothing herein shall supersede or modify 43 | the terms of any separate license agreement you may have executed 44 | with Licensor regarding such Contributions. 45 | ~~~ 46 | 47 | Contributors must sign-off each commit by adding a `Signed-off-by: ...` 48 | line to commit messages to certify that they have the right to submit 49 | the code they are contributing to the project according to the 50 | [Developer Certificate of Origin (DCO)](https://developercertificate.org/). -------------------------------------------------------------------------------- /tutorials/zed_rgb_convert/src/include/cvt_visibility_control.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef CVT_VISIBILITY_CONTROL_HPP_ 16 | #define CVT_VISIBILITY_CONTROL_HPP_ 17 | 18 | /* *INDENT-OFF* */ 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | /* *INDENT-ON* */ 23 | 24 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki: 25 | // https://gcc.gnu.org/wiki/Visibility 26 | 27 | #if defined _WIN32 || defined __CYGWIN__ 28 | #ifdef __GNUC__ 29 | #define ZED_CVT_COMPONENT_EXPORT __attribute__((dllexport)) 30 | #define ZED_CVT_COMPONENT_IMPORT __attribute__((dllimport)) 31 | #else 32 | #define ZED_CVT_COMPONENT_EXPORT __declspec(dllexport) 33 | #define ZED_CVT_COMPONENT_IMPORT __declspec(dllimport) 34 | #endif 35 | #ifdef ZED_CVT_COMPONENT_BUILDING_DLL 36 | #define ZED_CVT_COMPONENT_PUBLIC ZED_CVT_COMPONENT_EXPORT 37 | #else 38 | #define ZED_CVT_COMPONENT_PUBLIC ZED_CVT_COMPONENT_IMPORT 39 | #endif 40 | #define ZED_CVT_COMPONENT_PUBLIC_TYPE ZED_CVT_COMPONENT_PUBLIC 41 | #define ZED_CVT_COMPONENT_LOCAL 42 | #else 43 | #define ZED_CVT_COMPONENT_EXPORT __attribute__((visibility("default"))) 44 | #define ZED_CVT_COMPONENT_IMPORT 45 | #if __GNUC__ >= 4 46 | #define ZED_CVT_COMPONENT_PUBLIC __attribute__((visibility("default"))) 47 | #define ZED_CVT_COMPONENT_LOCAL __attribute__((visibility("hidden"))) 48 | #else 49 | #define ZED_CVT_COMPONENT_PUBLIC 50 | #define ZED_CVT_COMPONENT_LOCAL 51 | #endif 52 | #define ZED_CVT_COMPONENT_PUBLIC_TYPE 53 | #endif 54 | 55 | /* *INDENT-OFF* */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | /* *INDENT-ON* */ 60 | 61 | #endif // CVT_VISIBILITY_CONTROL_HPP_ 62 | -------------------------------------------------------------------------------- /tutorials/zed_rgb_convert/src/container/zed_rgb_convert.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include "zed_components/zed_camera_component.hpp" 18 | #include "zed_rgb_convert_component.hpp" 19 | 20 | int main(int argc, char * argv[]) 21 | { 22 | // Force flush of the stdout buffer. 23 | setvbuf(stdout, NULL, _IONBF, BUFSIZ); 24 | 25 | // Initialize any global resources needed by the middleware and the client 26 | // library. This will also parse command line arguments one day (as of Beta 1 27 | // they are not used). You must call this before using any other part of the 28 | // ROS system. This should be called once per process. 29 | rclcpp::init(argc, argv); 30 | 31 | // Create an executor that will be responsible for execution of callbacks for 32 | // a set of nodes. With this version, all callbacks will be called from within 33 | // this thread (the main one). 34 | rclcpp::executors::MultiThreadedExecutor exec; 35 | rclcpp::NodeOptions options; 36 | 37 | // Enable intraprocess communication 38 | options.use_intra_process_comms(true); 39 | 40 | // Add ZedCamera node 41 | auto zed_node = std::make_shared(options); 42 | exec.add_node(zed_node); 43 | 44 | // Add ZedRgbCvtComponent node 45 | auto zed_cvt_node = std::make_shared(options); 46 | exec.add_node(zed_cvt_node); 47 | 48 | // spin will block until work comes in, execute work as it becomes available, 49 | // and keep blocking. It will only be interrupted by Ctrl-C. 50 | exec.spin(); 51 | 52 | rclcpp::shutdown(); 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /examples/zed_aruco_localization/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_aruco_localization 5 | 5.1.0 6 | Contains a ros2 examples node that subscribes to a ZED BGRA image topic and converts it to BGR 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | rclcpp 15 | rclcpp_components 16 | rcutils 17 | builtin_interfaces 18 | sensor_msgs 19 | image_transport 20 | tf2 21 | tf2_ros 22 | tf2_geometry_msgs 23 | zed_components 24 | zed_msgs 25 | 26 | zed_components 27 | launch_ros 28 | rclcpp 29 | rclcpp_components 30 | rcutils 31 | builtin_interfaces 32 | sensor_msgs 33 | image_transport 34 | tf2 35 | tf2_ros 36 | tf2_geometry_msgs 37 | zed_msgs 38 | ament_lint_auto 39 | ament_lint_common 40 | ament_cmake_clang_format 41 | 42 | ament_cmake 43 | 44 | 45 | -------------------------------------------------------------------------------- /rviz-plugin-zed-od/README.md: -------------------------------------------------------------------------------- 1 | # Stereolabs ZED Camera - ROS 2 Object Detection Plugin 2 | 3 | This package lets you visualize in the [ROS 2 RViz application](https://github.com/ros2/rviz/tree/foxy) all the 4 | information provided by the Object Detection module of the ZED SDK used together with a ZED2 camera. 5 | 6 | **Note:** The main package [zed-ros2-wrapper](https://github.com/stereolabs/zed-ros2-wrapper) 7 | is required to correctly execute the ROS node to acquire data from a Stereolabs 3D camera. 8 | 9 | ## Getting started 10 | 11 | - First, be sure to have installed the main ROS package to integrate the ZED cameras in the ROS framework: [zed-ros2-wrapper](https://github.com/stereolabs/zed-ros2-wrapper/#build-the-package) 12 | - [Install](#Installation) the package 13 | - Read the online documentation for [More information](https://www.stereolabs.com/docs/ros2/) 14 | 15 | ### Prerequisites 16 | 17 | - ROS 2 Foxy Fitxroy or ROS 2 Humble Hawksbill: 18 | - [Foxy on Ubuntu 20.04](https://docs.ros.org/en/foxy/Installation/Linux-Install-Debians.html) 19 | - [Humble on Ubuntu 22.04](https://docs.ros.org/en/humble/Installation/Linux-Install-Debians.html) 20 | 21 | ### Installation 22 | 23 | The *zed_display_rviz2* is a colcon package. 24 | 25 | Install the [zed-ros2-wrapper](https://www.stereolabs.com/documentation/guides/using-zed-with-ros/introduction.html) package 26 | following the [installation guide](https://github.com/stereolabs/zed-ros2-wrapper#build-the-package) 27 | 28 | Install the [zed-ros2-examples](https://github.com/stereolabs/zed-ros2-examples) package following the [installation guide](https://github.com/stereolabs/zed-ros2-examples#build-the-package) 29 | 30 | ### Execution 31 | 32 | $ ros2 launch zed_display_rviz2 display_zed_cam.launch.py camera_model:= 33 | 34 | Please replace `` with the model of the camera that you are using: `'zedm'`, `'zed2'`, `'zed2i'`, `'zedx'`, `'zedxm'`, `'virtual'`. 35 | 36 | **Note**: Object Detection and Body Tracking are not available with the "ZED" Gen.1 camera. 37 | 38 | ![Object Detection parameters](images/rviz2_od_params.png) 39 | ![Bounding boxes and Skeleton visualization](images/rviz2_od_result.png) 40 | 41 | [Detailed information](https://www.stereolabs.com/docs/ros2/object-detection/) 42 | -------------------------------------------------------------------------------- /examples/zed_aruco_localization/src/include/aruco_loc_visibility_control.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ARUCO_LOC_VISIBILITY_CONTROL_HPP_ 16 | #define ARUCO_LOC_VISIBILITY_CONTROL_HPP_ 17 | 18 | /* *INDENT-OFF* */ 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | /* *INDENT-ON* */ 23 | 24 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki: 25 | // https://gcc.gnu.org/wiki/Visibility 26 | 27 | #if defined _WIN32 || defined __CYGWIN__ 28 | #ifdef __GNUC__ 29 | #define ZED_ARUCO_LOC_COMPONENT_EXPORT __attribute__((dllexport)) 30 | #define ZED_ARUCO_LOC_COMPONENT_IMPORT __attribute__((dllimport)) 31 | #else 32 | #define ZED_ARUCO_LOC_COMPONENT_EXPORT __declspec(dllexport) 33 | #define ZED_ARUCO_LOC_COMPONENT_IMPORT __declspec(dllimport) 34 | #endif 35 | #ifdef ZED_ARUCO_LOC_COMPONENT_BUILDING_DLL 36 | #define ZED_ARUCO_LOC_COMPONENT_PUBLIC ZED_ARUCO_LOC_COMPONENT_EXPORT 37 | #else 38 | #define ZED_ARUCO_LOC_COMPONENT_PUBLIC ZED_ARUCO_LOC_COMPONENT_IMPORT 39 | #endif 40 | #define ZED_ARUCO_LOC_COMPONENT_PUBLIC_TYPE ZED_ARUCO_LOC_COMPONENT_PUBLIC 41 | #define ZED_ARUCO_LOC_COMPONENT_LOCAL 42 | #else 43 | #define ZED_ARUCO_LOC_COMPONENT_EXPORT __attribute__((visibility("default"))) 44 | #define ZED_ARUCO_LOC_COMPONENT_IMPORT 45 | #if __GNUC__ >= 4 46 | #define ZED_ARUCO_LOC_COMPONENT_PUBLIC __attribute__((visibility("default"))) 47 | #define ZED_ARUCO_LOC_COMPONENT_LOCAL __attribute__((visibility("hidden"))) 48 | #else 49 | #define ZED_ARUCO_LOC_COMPONENT_PUBLIC 50 | #define ZED_ARUCO_LOC_COMPONENT_LOCAL 51 | #endif 52 | #define ZED_ARUCO_LOC_COMPONENT_PUBLIC_TYPE 53 | #endif 54 | 55 | /* *INDENT-OFF* */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | /* *INDENT-ON* */ 60 | 61 | #endif // ARUCO_LOC_VISIBILITY_CONTROL_HPP_ 62 | -------------------------------------------------------------------------------- /tutorials/zed_ipc/src/components/include/pointcloud_component.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef POINTCLOUD_COMPONENT_HPP_ 16 | #define POINTCLOUD_COMPONENT_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include 23 | #include 24 | 25 | #include "ipc_visibility_control.hpp" 26 | #include "winavg.hpp" 27 | 28 | namespace stereolabs 29 | { 30 | 31 | class PointCloudComponent : public rclcpp::Node 32 | { 33 | public: 34 | IPC_COMPONENT_PUBLIC 35 | explicit PointCloudComponent(const rclcpp::NodeOptions & options); 36 | 37 | virtual ~PointCloudComponent() {} 38 | 39 | protected: 40 | void callback_pointcloud( 41 | const sensor_msgs::msg::PointCloud2::SharedPtr msg, 42 | const std::string & topic_name); 43 | 44 | void readParameters(); 45 | void createSubscribers(); 46 | 47 | private: 48 | // ----> QoS 49 | // https://github.com/ros2/ros2/wiki/About-Quality-of-Service-Settings 50 | rclcpp::QoS _qos; 51 | rclcpp::SubscriptionOptions _subOpt; 52 | // <---- QoS 53 | 54 | // ----> Parameters 55 | int _camCount; 56 | // <---- Parameters 57 | 58 | // ----> Topics 59 | std::string _pcTopicPrefix = "pointcloud_"; 60 | // <---- Topics 61 | 62 | // ----> Subscribers 63 | std::vector>> _pcSubs; 64 | // <---- Subscribers 65 | 66 | // ----> Statistics 67 | std::vector> _stats; 68 | std::vector _times; 69 | std::vector _counters; 70 | std::vector _firsts; 71 | // <---- Statistics 72 | }; 73 | 74 | } // namespace stereolabs 75 | 76 | #endif // POINTCLOUD_COMPONENT_HPP_ 77 | -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/urdf/zed_robot_mono.urdf.xacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_nitros_sub/src/include/nitros_sub_visibility_control.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef NITROS_SUB_VISIBILITY_CONTROL_HPP_ 16 | #define NITROS_SUB_VISIBILITY_CONTROL_HPP_ 17 | 18 | /* *INDENT-OFF* */ 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | /* *INDENT-ON* */ 23 | 24 | // This logic was borrowed (then namespaced) from the examples on the gcc wiki: 25 | // https://gcc.gnu.org/wiki/Visibility 26 | 27 | #if defined _WIN32 || defined __CYGWIN__ 28 | #ifdef __GNUC__ 29 | #define ZED_NITROS_SUB_COMPONENT_EXPORT __attribute__((dllexport)) 30 | #define ZED_NITROS_SUB_COMPONENT_IMPORT __attribute__((dllimport)) 31 | #else 32 | #define ZED_NITROS_SUB_COMPONENT_EXPORT __declspec(dllexport) 33 | #define ZED_NITROS_SUB_COMPONENT_IMPORT __declspec(dllimport) 34 | #endif 35 | #ifdef ZED_NITROS_SUB_COMPONENT_BUILDING_DLL 36 | #define ZED_NITROS_SUB_COMPONENT_PUBLIC ZED_NITROS_SUB_COMPONENT_EXPORT 37 | #else 38 | #define ZED_NITROS_SUB_COMPONENT_PUBLIC ZED_NITROS_SUB_COMPONENT_IMPORT 39 | #endif 40 | #define ZED_NITROS_SUB_COMPONENT_PUBLIC_TYPE ZED_NITROS_SUB_COMPONENT_PUBLIC 41 | #define ZED_NITROS_SUB_COMPONENT_LOCAL 42 | #else 43 | #define ZED_NITROS_SUB_COMPONENT_EXPORT __attribute__((visibility("default"))) 44 | #define ZED_NITROS_SUB_COMPONENT_IMPORT 45 | #if __GNUC__ >= 4 46 | #define ZED_NITROS_SUB_COMPONENT_PUBLIC __attribute__((visibility("default"))) 47 | #define ZED_NITROS_SUB_COMPONENT_LOCAL __attribute__((visibility("hidden"))) 48 | #else 49 | #define ZED_NITROS_SUB_COMPONENT_PUBLIC 50 | #define ZED_NITROS_SUB_COMPONENT_LOCAL 51 | #endif 52 | #define ZED_NITROS_SUB_COMPONENT_PUBLIC_TYPE 53 | #endif 54 | 55 | /* *INDENT-OFF* */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | /* *INDENT-ON* */ 60 | 61 | #endif // NITROS_SUB_VISIBILITY_CONTROL_HPP_ 62 | -------------------------------------------------------------------------------- /examples/zed_depth_to_laserscan/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zed_depth_to_laserscan 5 | 5.1.0 6 | Contains a ros2 examples launch file to subscribes to a ZED Depth map and generates a virtual laser scan 7 | STEREOLABS 8 | Apache License 2.0 9 | https://www.stereolabs.com/ 10 | https://github.com/stereolabs/zed-ros2-wrapper 11 | https://github.com/stereolabs/zed-ros2-wrapper/issues 12 | ament_cmake 13 | ament_cmake_auto 14 | rclcpp 15 | rclcpp_components 16 | rcutils 17 | builtin_interfaces 18 | sensor_msgs 19 | image_transport 20 | tf2 21 | tf2_ros 22 | tf2_geometry_msgs 23 | zed_components 24 | zed_msgs 25 | depthimage_to_laserscan 26 | 27 | zed_components 28 | zed_wrapper 29 | launch_ros 30 | rclcpp 31 | rclcpp_components 32 | rcutils 33 | builtin_interfaces 34 | sensor_msgs 35 | image_transport 36 | tf2 37 | tf2_ros 38 | tf2_geometry_msgs 39 | zed_msgs 40 | depthimage_to_laserscan 41 | 42 | ament_lint_auto 43 | ament_lint_common 44 | ament_cmake_clang_format 45 | 46 | ament_cmake 47 | 48 | 49 | -------------------------------------------------------------------------------- /tutorials/README.md: -------------------------------------------------------------------------------- 1 | # Tutorials 2 | 3 | A series of tutorials are provided to better understand how to use the ZED nodes in the ROS 2 environment : 4 | 5 | - [Video subscribing](./zed_video_tutorial) : `zed_video_tutorial` - in this tutorial you will learn how to write a simple node that subscribes to messages of type `sensor_msgs/Image` to retrieve the Left and Right rectified images published by the ZED node. 6 | - [Depth subscribing](./zed_depth_tutorial) : `zed_depth_tutorial` - in this tutorial you will learn how to write a simple node that subscribes to messages of type `sensor_msgs/Image` to retrieve the depth images published by the ZED node and to get the measured distance at the center of the image. 7 | - [Pose/Odometry subscribing](./zed_pose_tutorial) : `zed_pose_tutorial` - in this tutorial you will learn how to write a simple node that subscribes to messages of type `geometry_msgs/PoseStamped` and `nav_msgs/Odometry` to retrieve the position and the odometry of the camera while moving in the world. 8 | - [ROS 2 Composition + BGRA2BGR conversion](./zed_rgb_convert) : `zed_rgb_convert` - in this tutorial you will learn how to use the concept of "ROS 2 Composition" and "Intra Process Communication" to write a ROS 2 component that gets a 4 channel BGRA image as input and re-publishes it as 3 channels BGR image. 9 | - [ROS 2 Multi-Camera](./zed_multi_camera) : `zed_multi_camera` - in this tutorial you will learn how to use the provided launch file to start a multi-camera robot configuration. 10 | - [ROS 2 Multi-Camera + Intra Process Communication](./zed_ipc) : `zed_ipc - in this tutorial you will learn how to use the provided launch file to start a multi-camera configuration, and load a new processing node in the same process to leverage Intra Process Communication with ROS 2composition. 11 | - [Robot integration](./zed_robot_integration): `zed_robot_integration` - in this tutorial you will learn how to add one ore more ZED cameras to a robot configuration. 12 | 13 | For a complete explanation of the tutorials please refer to the Stereolabs ZED online documentation: 14 | 15 | - [Video](https://www.stereolabs.com/docs/ros2/video/) 16 | - [Depth](https://www.stereolabs.com/docs/ros2/depth_sensing/) 17 | - [Pose/Odometry](https://www.stereolabs.com/docs/ros2/position/) 18 | - [Composition + BGRA to BGR conversion](https://www.stereolabs.com/docs/ros2/ros2_composition/) 19 | - [Robot integration](https://www.stereolabs.com/docs/ros2/ros2_zed_integration/) 20 | -------------------------------------------------------------------------------- /zed_display_rviz2/README.md: -------------------------------------------------------------------------------- 1 | # Stereolabs ZED Camera - ROS 2 Display package 2 | 3 | This package lets you visualize in the [ROS 2 RViz application](https://github.com/ros2/rviz/tree/foxy) all the 4 | possible information that can be acquired using a Stereolabs camera. 5 | The package provides the launch files for ZED, ZED Mini and ZED 2 camera models. 6 | 7 | **Note:** The main package [zed-ros2-wrapper](https://github.com/stereolabs/zed-ros2-wrapper) 8 | is required to correctly execute the ROS node to acquire data from a Stereolabs 3D camera. 9 | 10 | ## Getting started 11 | 12 | - First, be sure to have installed the main ROS package to integrate the ZED cameras in the ROS framework: [zed-ros2-wrapper](https://github.com/stereolabs/zed-ros2-wrapper/#build-the-package) 13 | - [Install](#Installation) the package 14 | - Read the online documentation for [More information](https://www.stereolabs.com/docs/ros2/) 15 | 16 | ### Prerequisites 17 | 18 | - ROS 2 Foxy Fitzroy (deprecated), ROS 2 Humble Hawksbill, or ROS 2 Jazzy Jalisco: 19 | - [Foxy on Ubuntu 20.04](https://docs.ros.org/en/foxy/Installation/Linux-Install-Debians.html) - [**Not recommended. EOL reached**] 20 | - [Humble on Ubuntu 22.04](https://docs.ros.org/en/humble/Installation/Linux-Install-Debians.html) - [EOL May 2027] 21 | - [Jazzy Jalisco on Ubuntu 24.04](https://docs.ros.org/en/jazzy/Installation/Linux-Install-Debians.html) - [EOL May 2029] 22 | 23 | ### Installation 24 | 25 | The *zed_display_rviz2* is a colcon package. 26 | 27 | Install the [zed-ros2-wrapper](https://www.stereolabs.com/documentation/guides/using-zed-with-ros/introduction.html) package 28 | following the [installation guide](https://github.com/stereolabs/zed-ros2-wrapper#build-the-package) 29 | 30 | Install the [zed-ros2-examples](https://github.com/stereolabs/zed-ros2-examples) package following the [installation guide](https://github.com/stereolabs/zed-ros2-examples#build-the-package) 31 | 32 | ### Execution 33 | 34 | Use the following launch command to start the ZED ROS2 Wrapper node and RVIZ2 with the default setting for the camera that you are using: 35 | 36 | ```bash 37 | $ ros2 launch zed_display_rviz2 display_zed_cam.launch.py camera_model:= 38 | ``` 39 | 40 | Replace `` with the model of the camera that you are using: `'zed'`, `'zedm'`, `'zed2'`, `'zed2i'`, `'zedx'`, `'zedxm'`, `'virtual'`. 41 | 42 | ![ZED rendering on Rviz](images/depthcloud-RGB.jpg) 43 | ![ZED rendering on Rviz](images/ZEDM-Rviz.jpg) 44 | ![ZED rendering on Rviz](images/ZED-Rviz.jpg) 45 | 46 | [Detailed information](https://www.stereolabs.com/docs/ros2/rviz2/) 47 | -------------------------------------------------------------------------------- /examples/zed_aruco_localization/markers/6x6_1000-43.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rviz-plugin-zed-od/src/plugin/include/zed_od_display.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ZED_OD_DISPLAY_HPP_ 16 | #define ZED_OD_DISPLAY_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "visibility_control.hpp" 26 | #include "zed_od_info.hpp" 27 | 28 | namespace rviz_plugin_zed_od 29 | { 30 | namespace displays 31 | { 32 | 33 | typedef std::shared_ptr objectPtr; 34 | 35 | class ZED_OD_PLUGIN_PUBLIC ZedOdDisplay 36 | : public rviz_common::MessageFilterDisplay 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | ZedOdDisplay(); 42 | ~ZedOdDisplay(); 43 | 44 | void onInitialize() override; 45 | void reset() override; 46 | 47 | private: 48 | void processMessage( 49 | zed_msgs::msg::ObjectsStamped::ConstSharedPtr msg) override; 50 | void createOrUpdateObject(zed_msgs::msg::Object & obj); 51 | void invalidateObjs(); 52 | void removeNotValidObjs(); 53 | 54 | private slots: 55 | void updateShowSkeleton(); 56 | void updateShowLabel(); 57 | void updateAlpha(); 58 | void updateShowBBox(); 59 | void updateLinkSize(); 60 | void updateJointRadius(); 61 | void updateLabelScale(); 62 | 63 | protected: 64 | /** @brief Overridden from MessageFilterDisplay to get arrow/axes visibility 65 | * correct. */ 66 | void onEnable() override; 67 | void onDisable() override; 68 | 69 | private: 70 | rviz_common::properties::FloatProperty * mPropAlpha; 71 | rviz_common::properties::BoolProperty * mPropShowSkeleton; 72 | rviz_common::properties::BoolProperty * mPropShowLabel; 73 | rviz_common::properties::BoolProperty * mPropShowBBox; 74 | rviz_common::properties::FloatProperty * mPropLinkSize; 75 | rviz_common::properties::FloatProperty * mPropJointRadius; 76 | rviz_common::properties::FloatProperty * mPropLabelScale; 77 | 78 | std::map mObjects; 79 | std::map mObjUpdated; 80 | }; 81 | 82 | } // namespace displays 83 | } // namespace rviz_plugin_zed_od 84 | 85 | #endif // ZED_OD_DISPLAY_HPP_ 86 | -------------------------------------------------------------------------------- /tutorials/zed_depth_tutorial/src/zed_depth_sub_tutorial.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * This tutorial demonstrates simple receipt of ZED depth messages over the ROS 17 | * system. 18 | */ 19 | 20 | #include "rclcpp/rclcpp.hpp" 21 | #include "sensor_msgs/msg/image.hpp" 22 | 23 | using namespace std::placeholders; 24 | 25 | class MinimalDepthSubscriber : public rclcpp::Node 26 | { 27 | public: 28 | MinimalDepthSubscriber() 29 | : Node("zed_depth_tutorial") 30 | { 31 | /* Note: it is very important to use a QOS profile for the subscriber that 32 | * is compatible with the QOS profile of the publisher. The ZED component 33 | * node uses a default QoS profile with reliability set as "RELIABLE" and 34 | * durability set as "VOLATILE". To be able to receive the subscribed topic 35 | * the subscriber must use compatible parameters. 36 | */ 37 | 38 | // https://github.com/ros2/ros2/wiki/About-Quality-of-Service-Settings 39 | 40 | rclcpp::QoS depth_qos(10); 41 | 42 | auto sub_opt = rclcpp::SubscriptionOptions(); 43 | 44 | // Create depth map subscriber 45 | mDepthSub = create_subscription( 46 | "depth", depth_qos, 47 | std::bind(&MinimalDepthSubscriber::depthCallback, this, _1), sub_opt); 48 | } 49 | 50 | protected: 51 | void depthCallback(const sensor_msgs::msg::Image::SharedPtr msg) 52 | { 53 | // Get a pointer to the depth values casting the data 54 | // pointer to floating point 55 | float * depths = reinterpret_cast(&msg->data[0]); 56 | 57 | // Image coordinates of the center pixel 58 | int u = msg->width / 2; 59 | int v = msg->height / 2; 60 | 61 | // Linear index of the center pixel 62 | int centerIdx = u + msg->width * v; 63 | 64 | // Output the measure 65 | RCLCPP_INFO(get_logger(), "Center distance : %g m", depths[centerIdx]); 66 | } 67 | 68 | private: 69 | rclcpp::Subscription::SharedPtr mDepthSub; 70 | }; 71 | 72 | // The main function 73 | int main(int argc, char * argv[]) 74 | { 75 | rclcpp::init(argc, argv); 76 | 77 | auto depth_node = std::make_shared(); 78 | 79 | rclcpp::spin(depth_node); 80 | rclcpp::shutdown(); 81 | return 0; 82 | } 83 | -------------------------------------------------------------------------------- /tools/README.md: -------------------------------------------------------------------------------- 1 | # Stereolabs ZED Camera - ROS 2 topics benchmark tool 2 | 3 | This package provides a benchmark node to be used to test frequency and bandwidth of topics and eventually plot the realtime values. 4 | 5 | For each topic the following information will be available: 6 | 7 | * Topic type 8 | * Real time frequency 9 | * Window average frequency 10 | * Topic size 11 | * Real time topic bandwidth 12 | * Window average topic bandwidth 13 | 14 | The node publishes a message on the topic `_stats` containing all the information to be eventually plotted. 15 | 16 | **Note:** This tool is not available for Foxy distribution because it misses an important feature required to subscribe to "generic topics". 17 | 18 | ## Usage 19 | 20 | Open a new terminal console and start the benchmark node: 21 | 22 | ```bash 23 | $ ros2 run zed_topic_benchmark zed_topic_benchmark --ros-args -p topic_name:= 24 | ``` 25 | 26 | for example: 27 | 28 | ```bash 29 | ros2 run zed_topic_benchmark zed_topic_benchmark --ros-args -p topic_name:=/zed2i/zed_node/rgb/color/rect/image 30 | ``` 31 | 32 | The node will print all the topic information on the console: 33 | 34 | ```bash 35 | [INFO] [1665764376.862143962] [topic_benchmark]: ***** Benchmark parameters ***** 36 | [INFO] [1665764376.862355022] [topic_benchmark]: * Topic name: /zed/zed_node/rgb/color/rect/image 37 | [INFO] [1665764376.862462857] [topic_benchmark]: Average window size: 500 38 | [INFO] [1665764376.862496172] [topic_benchmark]: *** START BENCHMARK *** 39 | [INFO] [1665764376.863484009] [topic_benchmark]: Advertised on topic: /zed/zed_node/rgb/color/rect/image_stats 40 | [INFO] [1665764377.363430211] [topic_benchmark]: Found topic: '/zed/zed_node/rgb/color/rect/image' of type: 'sensor_msgs/msg/Image' 41 | #119 - Freq: 6.01 Hz (Avg: 13.49 Hz) - Bandwidth: 42.28 Mbps (Avg: 94.87 Mbps) - Msg size: 0.88 MB 42 | ``` 43 | 44 | ## Parameters 45 | 46 | * `topic_name`: name of the topic to test 47 | * `avg_win_size`: size of the mobile window for the calculation of the average. [Default: `500`] 48 | 49 | ## Custom message 50 | 51 | The node published a message on the topic `_stats` containing the previous information to be plotted. 52 | The topic is a custom message of type `BenchmarkStatsStamped` defined as: 53 | 54 | ``` 55 | # Standard Header 56 | std_msgs/Header header 57 | 58 | # Instant Frequency 59 | float32 topic_freq 60 | # Average Frequency 61 | float32 topic_avg_freq 62 | 63 | # Instant Bandwidth 64 | float32 topic_bw 65 | # Average Bandwidth 66 | float32 topic_avg_bw 67 | ``` 68 | 69 | ## Advanced 70 | The package provides a ROS 2 component called `stereolabs::TopicBenchmarkComponent` to be used with [Composition](https://docs.ros.org/en/humble/Tutorials/Intermediate/Composition.html) to test [Intra Process Communication (IPC)](https://design.ros2.org/articles/intraprocess_communications.html) performances. -------------------------------------------------------------------------------- /tutorials/zed_multi_camera/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_multi_camera) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "foxy") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_FOXY) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "humble") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_HUMBLE) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_IRON) 41 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 42 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 43 | add_definitions(-DFOUND_JAZZY) 44 | else() 45 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 46 | endif() 47 | else() 48 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 49 | endif() 50 | ################################################ 51 | 52 | find_package(ament_cmake_auto REQUIRED) 53 | ament_auto_find_build_dependencies() 54 | 55 | if(BUILD_TESTING) 56 | find_package(ament_lint_auto REQUIRED) 57 | ament_lint_auto_find_test_dependencies() 58 | endif() 59 | 60 | ############################################################################### 61 | #Add all files in subdirectories of the project in 62 | # a dummy_target so qtcreator have access to all files 63 | file(GLOB_RECURSE all_files ${CMAKE_SOURCE_DIR}/*) 64 | add_custom_target(all_${PROJECT_NAME}_files SOURCES ${all_files}) 65 | 66 | ############################################################################### 67 | # INSTALL 68 | 69 | # Install LAUNCH files 70 | install(DIRECTORY 71 | launch urdf 72 | DESTINATION share/${PROJECT_NAME} 73 | ) 74 | 75 | ament_package() 76 | -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/urdf/zed_robot_dual.urdf.xacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_multi_camera/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_isaac_ros_multi_camera) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "foxy") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_FOXY) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "humble") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_HUMBLE) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_IRON) 41 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 42 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 43 | add_definitions(-DFOUND_JAZZY) 44 | else() 45 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 46 | endif() 47 | else() 48 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 49 | endif() 50 | ################################################ 51 | 52 | find_package(ament_cmake_auto REQUIRED) 53 | ament_auto_find_build_dependencies() 54 | 55 | if(BUILD_TESTING) 56 | find_package(ament_lint_auto REQUIRED) 57 | ament_lint_auto_find_test_dependencies() 58 | endif() 59 | 60 | ############################################################################### 61 | #Add all files in subdirectories of the project in 62 | # a dummy_target so qtcreator have access to all files 63 | file(GLOB_RECURSE all_files ${CMAKE_SOURCE_DIR}/*) 64 | add_custom_target(all_${PROJECT_NAME}_files SOURCES ${all_files}) 65 | 66 | ############################################################################### 67 | # INSTALL 68 | 69 | # Install LAUNCH files 70 | install(DIRECTORY 71 | launch urdf 72 | DESTINATION share/${PROJECT_NAME} 73 | ) 74 | 75 | ament_package() 76 | -------------------------------------------------------------------------------- /tutorials/zed_multi_camera/urdf/zed_multi.urdf.xacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 26 | 27 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /zed_display_rviz2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_display_rviz2) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "foxy") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_FOXY) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "humble") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_HUMBLE) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_IRON) 41 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 42 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 43 | add_definitions(-DFOUND_JAZZY) 44 | else() 45 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 46 | endif() 47 | else() 48 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 49 | endif() 50 | ################################################ 51 | 52 | find_package(ament_cmake_auto REQUIRED) 53 | ament_auto_find_build_dependencies() 54 | 55 | if(BUILD_TESTING) 56 | find_package(ament_lint_auto REQUIRED) 57 | ament_lint_auto_find_test_dependencies() 58 | endif() 59 | 60 | ############################################################################### 61 | #Add all files in subdirectories of the project in 62 | # a dummy_target so qtcreator have access to all files 63 | file(GLOB_RECURSE all_files ${CMAKE_SOURCE_DIR}/*) 64 | add_custom_target(all_${PROJECT_NAME}_files SOURCES ${all_files}) 65 | 66 | ############################################################################### 67 | # INSTALL 68 | 69 | # Install LAUNCH files 70 | install(DIRECTORY 71 | launch 72 | DESTINATION share/${PROJECT_NAME} 73 | ) 74 | 75 | install(DIRECTORY 76 | rviz2 77 | DESTINATION share/${PROJECT_NAME} 78 | ) 79 | 80 | ament_package() 81 | -------------------------------------------------------------------------------- /tutorials/zed_video_tutorial/src/zed_video_sub_tutorial.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * This tutorial demonstrates simple receipt of ZED video messages over the ROS 17 | * system. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | rclcpp::Node::SharedPtr g_node = nullptr; 25 | 26 | /** 27 | * Subscriber callbacks. The argument of the callback is a constant pointer to 28 | * the received message 29 | */ 30 | 31 | void imageRightRectifiedCallback(const sensor_msgs::msg::Image::SharedPtr msg) 32 | { 33 | RCLCPP_INFO( 34 | g_node->get_logger(), 35 | "Right Rectified image received from ZED\tSize: %dx%d - Ts: %u.%u sec ", 36 | msg->width, msg->height, msg->header.stamp.sec, 37 | msg->header.stamp.nanosec); 38 | } 39 | 40 | void imageLeftRectifiedCallback(const sensor_msgs::msg::Image::SharedPtr msg) 41 | { 42 | RCLCPP_INFO( 43 | g_node->get_logger(), 44 | "Left Rectified image received from ZED\tSize: %dx%d - Ts: %u.%u sec ", 45 | msg->width, msg->height, msg->header.stamp.sec, 46 | msg->header.stamp.nanosec); 47 | } 48 | 49 | int main(int argc, char * argv[]) 50 | { 51 | rclcpp::init(argc, argv); 52 | 53 | // Create the node 54 | g_node = rclcpp::Node::make_shared("zed_video_tutorial"); 55 | 56 | /* Note: it is very important to use a QOS profile for the subscriber that is 57 | * compatible with the QOS profile of the publisher. The ZED component node 58 | * uses a default QoS profile with reliability set as "RELIABLE" and 59 | * durability set as "VOLATILE". To be able to receive the subscribed topic 60 | * the subscriber must use compatible parameters. 61 | */ 62 | 63 | // https://github.com/ros2/ros2/wiki/About-Quality-of-Service-Settings 64 | 65 | rclcpp::QoS video_qos(10); 66 | video_qos.keep_last(10); 67 | video_qos.best_effort(); 68 | video_qos.durability_volatile(); 69 | 70 | // Create right image subscriber 71 | auto right_sub = g_node->create_subscription( 72 | "right_image", video_qos, imageRightRectifiedCallback); 73 | 74 | // Create left image subscriber 75 | auto left_sub = g_node->create_subscription( 76 | "left_image", video_qos, imageLeftRectifiedCallback); 77 | 78 | // Let the node run 79 | rclcpp::spin(g_node); 80 | 81 | // Shutdown when the node is stopped using Ctrl+C 82 | rclcpp::shutdown(); 83 | 84 | return 0; 85 | } 86 | -------------------------------------------------------------------------------- /examples/zed_depth_to_laserscan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_depth_to_laserscan) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "humble") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_HUMBLE) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_IRON) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_JAZZY) 41 | else() 42 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 43 | endif() 44 | else() 45 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 46 | endif() 47 | ################################################ 48 | 49 | ############################################# 50 | # Dependencies 51 | 52 | find_package(ament_cmake_auto REQUIRED) 53 | ament_auto_find_build_dependencies() 54 | 55 | find_package(zed_components) 56 | find_package(zed_wrapper) 57 | find_package(depthimage_to_laserscan) 58 | 59 | if(BUILD_TESTING) 60 | find_package(ament_lint_auto REQUIRED) 61 | ament_lint_auto_find_test_dependencies() 62 | endif() 63 | 64 | ############################################################################### 65 | #Add all files in subdirectories of the project in 66 | # a dummy_target so qtcreator have access to all files 67 | file(GLOB_RECURSE all_files ${CMAKE_SOURCE_DIR}/*) 68 | add_custom_target(all_${PROJECT_NAME}_files SOURCES ${all_files}) 69 | 70 | # create ament index resource which references the libraries in the binary dir 71 | set(node_plugins "") 72 | 73 | ############################################################################### 74 | # Install 75 | 76 | # Install LAUNCH files 77 | install(DIRECTORY 78 | launch config rviz2 79 | DESTINATION share/${PROJECT_NAME} 80 | ) 81 | 82 | ament_package() 83 | -------------------------------------------------------------------------------- /tutorials/zed_rgb_convert/launch/zed_rgb_convert.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Stereolabs 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the 'License'); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an 'AS IS' BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from launch import LaunchDescription 18 | from launch_ros.actions import Node 19 | from ament_index_python.packages import get_package_share_directory 20 | from launch.substitutions import Command 21 | 22 | 23 | def generate_launch_description(): 24 | # Define LaunchDescription variable 25 | ld = LaunchDescription() 26 | 27 | # use: 28 | # - 'zed' for 'ZED' camera 29 | # - 'zedm' for 'ZED mini' camera 30 | # - 'zed2' for 'ZED2' camera 31 | camera_model = 'zed2' 32 | 33 | # Camera name 34 | camera_name = 'zed2i' 35 | 36 | # URDF/xacro file to be loaded by the Robot State Publisher node 37 | xacro_path = os.path.join( 38 | get_package_share_directory('zed_wrapper'), 39 | 'urdf', 'zed_descr.urdf.xacro' 40 | ) 41 | 42 | # ZED Configurations to be loaded by ZED Node 43 | config_common = os.path.join( 44 | get_package_share_directory('zed_wrapper'), 45 | 'config', 46 | 'common_stereo.yaml' 47 | ) 48 | 49 | config_camera = os.path.join( 50 | get_package_share_directory('zed_wrapper'), 51 | 'config', 52 | camera_model + '.yaml' 53 | ) 54 | 55 | # Set LOG format 56 | os.environ['RCUTILS_CONSOLE_OUTPUT_FORMAT'] = '{time} [{name}] [{severity}] {message}' 57 | 58 | # Robot State Publisher node 59 | rsp_node = Node( 60 | package='robot_state_publisher', 61 | namespace=camera_name, 62 | executable='robot_state_publisher', 63 | name='zed_state_publisher', 64 | output='screen', 65 | parameters=[{ 66 | 'robot_description': Command( 67 | [ 68 | 'xacro', ' ', xacro_path, ' ', 69 | 'camera_name:=', camera_name, ' ', 70 | 'camera_model:=', camera_model 71 | ]) 72 | }] 73 | ) 74 | 75 | # ZED node using manual composition 76 | zed_node = Node( 77 | package='zed_rgb_convert', 78 | namespace=camera_name, 79 | executable='zed_rgb_convert', 80 | output='screen', 81 | parameters=[ 82 | config_common, # Common parameters 83 | config_camera, # Camera related parameters 84 | ], 85 | remappings=[ 86 | ('zed_image_4ch', 'zed_node/rgb/color/rect/image'), 87 | ('camera_info', 'zed_node/rgb/color/rect/image') 88 | ] 89 | ) 90 | 91 | # Add nodes to LaunchDescription 92 | ld.add_action(rsp_node) 93 | ld.add_action(zed_node) 94 | 95 | return ld 96 | -------------------------------------------------------------------------------- /tools/zed_benchmark_component/src/component/include/topic_benchmark_component.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef TOPIC_BENCHMARK_COMPONENT_HPP_ 16 | #define TOPIC_BENCHMARK_COMPONENT_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | #include // Not available before ROS 2 Humble 24 | #include 25 | #include 26 | #include 27 | 28 | #include "visibility_control.hpp" 29 | #include "winavg.hpp" 30 | #include "zed_topic_benchmark_interfaces/msg/benchmark_stats_stamped.hpp" 31 | 32 | #define DEFAULT_TOPIC_NAME std::string("topic_name") 33 | 34 | namespace stereolabs 35 | { 36 | class TopicBenchmarkComponent : public rclcpp::Node 37 | { 38 | public: 39 | TOPIC_BENCHMARK_PUBLIC 40 | explicit TopicBenchmarkComponent(const rclcpp::NodeOptions & options); 41 | virtual ~TopicBenchmarkComponent(); 42 | 43 | protected: 44 | void init(); 45 | 46 | // ----> Node Parameters 47 | template 48 | void getParam( 49 | std::string paramName, T defValue, T & outVal, 50 | std::string log_info = std::string(), bool dynamic = false); 51 | 52 | void getParameters(); 53 | // ----> Node Parameters 54 | 55 | void updateTopicInfo(); ///< Update the information to subscribe to the topic 56 | ///< under benchmarking 57 | 58 | void topicCallback(std::shared_ptr msg); 59 | 60 | private: 61 | double mSubFreqTot; ///< Total of subscriber receiving frequency for average 62 | ///< computation 63 | double mSubFreqBw; ///< Average topic bandwidth (topic_size x avg_freq) 64 | 65 | rclcpp::TimerBase::SharedPtr mTopicTimer; 66 | 67 | // Parameters 68 | std::string mTopicName = 69 | DEFAULT_TOPIC_NAME; ///< Name of the benchmarked topic 70 | int mWinSize = 500; ///< Window size for frequency average 71 | bool mUseRosLog = false; ///< Use ROS logging system 72 | 73 | std::atomic mTopicAvailable; ///< Indicate if the benchmarked topic is 74 | ///< published by other nodes 75 | 76 | // Topic subscriptions 77 | std::map> mSubMap; 78 | 79 | // Average values 80 | WinAvg mAvgFreq; 81 | 82 | // Time measuring 83 | std::chrono::high_resolution_clock::time_point mLastRecTime; 84 | 85 | // Stats message publisher 86 | std::shared_ptr> 88 | mPub; 89 | uint64_t mTopicCount = 0; 90 | }; 91 | } // namespace stereolabs 92 | 93 | #endif // TOPIC_BENCHMARK_COMPONENT_HPP_ 94 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/2_bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 🐛 2 | description: Something isn't working as expected? Report your bugs here. 3 | labels: "bug" 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | # Welcome 👋 9 | 10 | Thanks for taking the time to fill out this bug report. 11 | Please fill out each section below. This info allows Stereolabs developers to diagnose (and fix!) your issue as quickly as possible. Otherwise we might need to close the issue without e.g. clear reproduction steps. 12 | 13 | Bug reports also shoulnd't be used for generic questions, please use the [Stereolabs Community forum](https://community.stereolabs.com/) instead. 14 | 15 | Useful Links: 16 | - Documentation: https://www.stereolabs.com/docs/ 17 | - Stereolabs support: https://support.stereolabs.com/hc/en-us/ 18 | - type: checkboxes 19 | attributes: 20 | label: Preliminary Checks 21 | description: Please make sure that you verify each checkbox and follow the instructions for them. 22 | options: 23 | - label: "This issue is not a duplicate. Before opening a new issue, please search existing issues." 24 | required: true 25 | - label: "This issue is not a question, feature request, or anything other than a bug report directly related to this project." 26 | required: true 27 | - type: textarea 28 | attributes: 29 | label: Description 30 | description: Describe the issue that you're seeing. 31 | placeholder: Be as precise as you can. Feel free to share screenshots, videos, or data. The more information you provide the easier will be to provide you with a fast solution. 32 | validations: 33 | required: true 34 | - type: textarea 35 | attributes: 36 | label: Steps to Reproduce 37 | description: Clear steps describing how to reproduce the issue. 38 | value: | 39 | 1. 40 | 2. 41 | 3. 42 | ... 43 | validations: 44 | required: true 45 | - type: textarea 46 | attributes: 47 | label: Expected Result 48 | description: Describe what you expected to happen. 49 | validations: 50 | required: true 51 | - type: textarea 52 | attributes: 53 | label: Actual Result 54 | description: Describe what actually happened. 55 | validations: 56 | required: true 57 | - type: dropdown 58 | attributes: 59 | label: ZED Camera model 60 | description: What model of ZED camera are you using? 61 | options: 62 | - "ZED" 63 | - "ZED Mini" 64 | - "ZED2" 65 | - "ZED2i" 66 | validations: 67 | required: true 68 | - type: textarea 69 | attributes: 70 | label: Environment 71 | render: shell 72 | description: Useful information about your system. 73 | placeholder: | 74 | OS: Operating System 75 | CPU: e.g. ARM 76 | GPU: Nvidia Jetson Xavier NX 77 | ZED SDK version: e.g. v3.5.3 78 | Other info: e.g. ROS Melodic 79 | validations: 80 | required: true 81 | - type: textarea 82 | attributes: 83 | label: Anything else? 84 | description: Please add any other information or comment that you think may be useful for solving the problem 85 | placeholder: 86 | validations: 87 | required: false 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Stereolabs
3 | ROS 2 Tutorials and Examples 4 |

5 | 6 | This package contains examples and tutorials for effectively using ZED cameras within the ROS 2 framework. 7 | 8 | [More information](https://www.stereolabs.com/docs/ros2/) 9 | 10 | ## Getting started 11 | 12 | - First, be sure to have installed the main ROS 2 package to integrate the ZED cameras in the ROS 2 framework: [zed-ros2-wrapper](https://github.com/stereolabs/zed-ros2-wrapper/) 13 | - [Install](#build-the-package) the Tutorials package 14 | - Read the online documentation for [More information](https://www.stereolabs.com/documentation/guides/using-zed-with-ros/introduction.html) 15 | 16 | ### Prerequisites 17 | 18 | - ROS 2 Foxy Fitzroy (deprecated), ROS 2 Humble Hawksbill, or ROS 2 Jazzy Jalisco: 19 | - [Foxy on Ubuntu 20.04](https://docs.ros.org/en/foxy/Installation/Linux-Install-Debians.html) - [**Not recommended. EOL reached**] 20 | - [Humble on Ubuntu 22.04](https://docs.ros.org/en/humble/Installation/Linux-Install-Debians.html) - [EOL May 2027] 21 | - [Jazzy Jalisco on Ubuntu 24.04](https://docs.ros.org/en/jazzy/Installation/Linux-Install-Debians.html) - [EOL May 2029] 22 | 23 | ### Build the package 24 | 25 | The `zed-ros-examples` repository is a collection of [colcon](http://design.ros2.org/articles/build_tool.html) packages. 26 | 27 | Open a terminal, clone the repository, update the dependencies, and build the packages: 28 | 29 | ```bash 30 | cd ~/ros2_ws/src/ #use your current ros2 workspace folder 31 | git clone https://github.com/stereolabs/zed-ros2-examples.git 32 | cd ../ 33 | sudo apt update 34 | rosdep update 35 | rosdep install --from-paths src --ignore-src -r -y 36 | colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release 37 | source ~/.bashrc 38 | ``` 39 | 40 | ## Tutorials and examples 41 | 42 | ### Data Visualization Examples 43 | 44 | - Example launch files to start a preconfigured instance of **RViz2** displaying all the ZED Wrapper node information: [zed_display_rviz2](./zed_display_rviz2) 45 | - ROS 2 plugin for **RViz2** to visualize the results of the Object Detection module (bounding boxes and skeletons): [rviz-plugin-zed-od](./rviz-plugin-zed-od) 46 | - Example layouts to display ZED Wrapper data in **Foxglove Studio** [zed_display_foxglove](./zed_display_foxglove/) 47 | 48 | ### Tutorials 49 | 50 | - [Images subscription tutorial](./tutorials/zed_video_tutorial) 51 | - [Depth subscription tutorial](./tutorials/zed_depth_tutorial) 52 | - [Pose/Odometry subscription tutorial](./tutorials/zed_pose_tutorial) 53 | - [ROS 2 Composition + BGRA2BGR conversion tutorial](./tutorials/zed_rgb_convert) 54 | - [Multi-camera](./tutorials/zed_multi_camera) 55 | - [Multi-Camera + Intra Process Communication](./tutorials/zed_ipc) 56 | - [Robot integration](./tutorials/zed_robot_integration) 57 | 58 | ### Examples 59 | 60 | - [ZED Localization with ArUco markers](./examples/zed_aruco_localization): use localized ArUco tags as a reference for localization. 61 | - [Convert ZED Depth map to virtual laser scan](./examples/zed_depth_to_laserscan): convert ZED Depth maps into virtual Laser Scans using 62 | 63 | ## Tools 64 | 65 | - **ZED Benchmark tool**: used to test topics and get statistics on frequency and bandwidth to be plotted. 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_april_tag/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_isaac_ros_april_tag) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "humble") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_HUMBLE) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_IRON) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_JAZZY) 41 | else() 42 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 43 | endif() 44 | else() 45 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 46 | endif() 47 | ################################################ 48 | 49 | if(ROS2_FOUND) 50 | ############################################# 51 | # Dependencies 52 | 53 | find_package(ament_cmake_auto REQUIRED) 54 | ament_auto_find_build_dependencies() 55 | 56 | # Check ISAAC ROS Nitros availability 57 | find_package(isaac_ros_common QUIET) 58 | 59 | # If Isaac ROS is not available the example will not be built 60 | if(isaac_ros_common_FOUND) 61 | 62 | if(BUILD_TESTING) 63 | find_package(ament_lint_auto REQUIRED) 64 | ament_lint_auto_find_test_dependencies() 65 | endif() 66 | 67 | ############################################################################### 68 | #Add all files in subdirectories of the project in 69 | # a dummy_target so qtcreator have access to all files 70 | file(GLOB_RECURSE all_files ${CMAKE_SOURCE_DIR}/*) 71 | add_custom_target(all_${PROJECT_NAME}_files SOURCES ${all_files}) 72 | 73 | # create ament index resource which references the libraries in the binary dir 74 | set(node_plugins "") 75 | 76 | ############################################################################### 77 | # Install 78 | 79 | # Install LAUNCH files 80 | install(DIRECTORY 81 | launch config rviz2 82 | DESTINATION share/${PROJECT_NAME} 83 | ) 84 | endif(isaac_ros_common_FOUND) 85 | ament_package() 86 | endif(ROS2_FOUND) 87 | -------------------------------------------------------------------------------- /tools/zed_benchmark_interfaces/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_topic_benchmark_interfaces) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "humble") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_HUMBLE) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_IRON) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_JAZZY) 41 | else() 42 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 43 | endif() 44 | else() 45 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 46 | endif() 47 | ################################################ 48 | 49 | # Default to C++17 50 | if(NOT CMAKE_CXX_STANDARD) 51 | set(CMAKE_CXX_STANDARD 17) 52 | endif() 53 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 54 | add_compile_options(-Wall -Wextra -Wpedantic) 55 | endif() 56 | 57 | find_package(ament_cmake_auto REQUIRED) 58 | ament_auto_find_build_dependencies() 59 | 60 | find_package(builtin_interfaces REQUIRED) 61 | find_package(rosidl_default_generators REQUIRED) 62 | find_package(std_msgs REQUIRED) 63 | 64 | if(BUILD_TESTING) 65 | find_package(ament_lint_auto REQUIRED) 66 | ament_lint_auto_find_test_dependencies() 67 | endif() 68 | 69 | ############################################################################### 70 | # Add all files in subdirectories of the project in 71 | # a dummy_target so qtcreator have access to all files 72 | file(GLOB_RECURSE extra_files ${CMAKE_SOURCE_DIR}/*) 73 | add_custom_target(all_${PROJECT_NAME}_files SOURCES ${extra_files}) 74 | ############################################################################### 75 | 76 | if( ${FOUND_ROS2_DISTRO} STREQUAL "humble" OR ${FOUND_ROS2_DISTRO} STREQUAL "iron") 77 | set(MSG_FILES 78 | "msg/BenchmarkStatsStamped.msg" 79 | ) 80 | 81 | set(SRV_FILES 82 | ) 83 | 84 | rosidl_generate_interfaces(${PROJECT_NAME} 85 | ${MSG_FILES} 86 | ${SRV_FILES} 87 | DEPENDENCIES builtin_interfaces std_msgs 88 | ) 89 | 90 | ament_export_dependencies(rosidl_default_runtime) 91 | endif() 92 | 93 | ament_package() 94 | -------------------------------------------------------------------------------- /rviz-plugin-zed-od/src/plugin/include/zed_od_info.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ZED_OD_INFO_HPP_ 16 | #define ZED_OD_INFO_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "visibility_control.hpp" 30 | #include "zed_body_parts.hpp" 31 | 32 | namespace Ogre 33 | { 34 | class SceneManager; 35 | class SceneNode; 36 | } // namespace Ogre 37 | 38 | namespace rviz_plugin_zed_od 39 | { 40 | namespace displays 41 | { 42 | 43 | typedef std::shared_ptr shapePtr; 44 | typedef std::shared_ptr linePtr; 45 | 46 | class ZED_OD_PLUGIN_PUBLIC ZedOdInfo : public QObject 47 | { 48 | Q_OBJECT 49 | 50 | public: 51 | explicit ZedOdInfo( 52 | zed_msgs::msg::Object & obj, 53 | Ogre::SceneManager * scene_manager, 54 | Ogre::SceneNode * parent_node = NULL); 55 | virtual ~ZedOdInfo(); 56 | 57 | void updateShowLabel(bool show); 58 | void updateAlpha(float alpha); 59 | void updateInfo(zed_msgs::msg::Object & obj); 60 | void updateShowBBox(bool show); 61 | void updateShowSkeleton(bool show); 62 | void updateLinkSize(float newval); 63 | void updateJointRadius(float newval); 64 | void updateLabelScale(float newval); 65 | 66 | protected: 67 | void calculateColor(); 68 | 69 | private: 70 | std::string mObjName; 71 | 72 | // shapePtr mBBox; 73 | std::shared_ptr mLabel; 74 | 75 | std::vector mBBoxCorners; 76 | std::vector mBBoxLines; 77 | 78 | std::vector mSkelJoints; 79 | std::vector mSkelLinks; 80 | 81 | float mAlpha = 0.75f; 82 | Ogre::ColourValue mColorBBox; 83 | Ogre::ColourValue mColorSkel; 84 | 85 | Ogre::SceneManager * mSceneManager = nullptr; 86 | Ogre::SceneNode * mParentNode = nullptr; 87 | Ogre::SceneNode * mSceneNode = nullptr; 88 | Ogre::SceneNode * mSkelSceneNode = nullptr; 89 | Ogre::SceneNode * mBBoxSceneNode = nullptr; 90 | Ogre::SceneNode * mPivotSceneNode = nullptr; 91 | 92 | bool mShowLabel = true; 93 | bool mShowBBox = true; 94 | bool mShowSkel = true; 95 | 96 | shapePtr mPivot; 97 | 98 | int16_t mLabelId; 99 | 100 | float mLabelScale = 2.5; 101 | float mJointRadius = 0.1; 102 | float mLinkSize = 0.05; 103 | 104 | const float mSkelScale = 0.4f; 105 | const int mSkelColOffset = 50; 106 | 107 | // Unique identifier for each object 108 | static uint64_t mObjIdx; 109 | }; 110 | 111 | } // namespace displays 112 | } // namespace rviz_plugin_zed_od 113 | 114 | #endif // ZED_OD_INFO_HPP_ 115 | -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/launch/view_mono_zed.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Stereolabs 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the 'License'); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an 'AS IS' BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | from ament_index_python.packages import get_package_share_directory 17 | from launch import LaunchDescription 18 | from launch_ros.actions import Node 19 | from launch.substitutions import ( 20 | LaunchConfiguration, 21 | Command 22 | ) 23 | from launch.actions import ( 24 | DeclareLaunchArgument 25 | ) 26 | from launch.actions import ( 27 | DeclareLaunchArgument, 28 | OpaqueFunction 29 | ) 30 | 31 | # Enable colored output 32 | os.environ["RCUTILS_COLORIZED_OUTPUT"] = "1" 33 | 34 | # Camera name and model 35 | camera_name = 'zed' 36 | camera_model = 'zedx' 37 | 38 | # RVIZ2 Configurations to be loaded by ZED Node 39 | config_rviz2 = os.path.join( 40 | get_package_share_directory('zed_robot_integration'), 41 | 'rviz2','view_config.rviz' 42 | ) 43 | 44 | # URDF/xacro file to be loaded by the Robot State Publisher node 45 | xacro_path = os.path.join( 46 | get_package_share_directory('zed_robot_integration'), 47 | 'urdf', 48 | 'zed_robot_mono.urdf.xacro' 49 | ) 50 | 51 | def launch_setup(context, *args, **kwargs): 52 | # Launch configuration variables 53 | use_zed_localization = LaunchConfiguration('use_zed_localization') 54 | 55 | 56 | # Robot URDF from xacro 57 | robot_description = Command( 58 | [ 59 | 'xacro', ' ', xacro_path, ' ', 60 | 'camera_name:=', camera_name, ' ', 61 | 'camera_model:=', camera_model, ' ', 62 | 'use_zed_localization:=', use_zed_localization, 63 | ]) 64 | 65 | # RVIZ2 node 66 | rviz2_node = Node( 67 | package='rviz2', 68 | executable='rviz2', 69 | name='rviz2', 70 | output='screen', 71 | arguments=[['-d'], [config_rviz2]], 72 | ) 73 | 74 | # Robot State Publisher 75 | rsp_node = Node( 76 | package='robot_state_publisher', 77 | executable='robot_state_publisher', 78 | name='scoutm_robot_state_publisher', 79 | output='screen', 80 | parameters=[ 81 | { 82 | 'robot_description': robot_description 83 | } 84 | ]) 85 | 86 | # Joint State Publisher 87 | jsp_node = Node( 88 | package='joint_state_publisher', 89 | executable='joint_state_publisher', 90 | name='scoutm_joint_state_publisher' 91 | ) 92 | 93 | return [ 94 | rviz2_node, 95 | rsp_node, 96 | jsp_node 97 | ] 98 | 99 | def generate_launch_description(): 100 | return LaunchDescription( 101 | [ 102 | DeclareLaunchArgument( 103 | 'use_zed_localization', 104 | default_value='true', 105 | description='Creates a TF tree with `camera_link` as root frame if `true`, otherwise the root is `base_ling`.', 106 | choices=['true', 'false']), 107 | OpaqueFunction(function=launch_setup) 108 | ] 109 | ) -------------------------------------------------------------------------------- /tutorials/zed_depth_tutorial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_tutorial_depth) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "foxy") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_FOXY) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "humble") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_HUMBLE) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_IRON) 41 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 42 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 43 | add_definitions(-DFOUND_JAZZY) 44 | else() 45 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 46 | endif() 47 | else() 48 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 49 | endif() 50 | ################################################ 51 | 52 | # if CMAKE_BUILD_TYPE is not specified, take 'Release' as default 53 | if(NOT CMAKE_BUILD_TYPE) 54 | set(CMAKE_BUILD_TYPE Release) 55 | endif() 56 | 57 | # Default to C++17 58 | if(NOT CMAKE_CXX_STANDARD) 59 | set(CMAKE_CXX_STANDARD 17) 60 | endif() 61 | 62 | # dependencies 63 | find_package(ament_cmake_auto REQUIRED) 64 | ament_auto_find_build_dependencies() 65 | 66 | find_package(rclcpp REQUIRED) 67 | find_package(sensor_msgs REQUIRED) 68 | 69 | if(BUILD_TESTING) 70 | find_package(ament_lint_auto REQUIRED) 71 | ament_lint_auto_find_test_dependencies() 72 | endif() 73 | 74 | ############################################################################### 75 | # Add all files in subdirectories of the project in 76 | # a dummy_target so qtcreator have access to all files 77 | file(GLOB_RECURSE extra_files ${CMAKE_SOURCE_DIR}/*) 78 | add_custom_target(${PROJECT_NAME}_files SOURCES ${extra_files}) 79 | ############################################################################### 80 | 81 | # includes 82 | include_directories( 83 | ${rclcpp_INCLUDE_DIRS} 84 | ${sensor_msgs_INCLUDE_DIRS} 85 | ) 86 | 87 | ## Build 88 | add_executable(zed_tutorial_depth src/zed_depth_sub_tutorial.cpp) 89 | ament_target_dependencies(zed_tutorial_depth 90 | rclcpp 91 | sensor_msgs 92 | ) 93 | 94 | # Install executable 95 | install( 96 | TARGETS zed_tutorial_depth 97 | DESTINATION lib/${PROJECT_NAME} 98 | ) 99 | 100 | ament_package() 101 | -------------------------------------------------------------------------------- /tutorials/zed_video_tutorial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_tutorial_video) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "foxy") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_FOXY) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "humble") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_HUMBLE) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_IRON) 41 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 42 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 43 | add_definitions(-DFOUND_JAZZY) 44 | else() 45 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 46 | endif() 47 | else() 48 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 49 | endif() 50 | ################################################ 51 | 52 | # if CMAKE_BUILD_TYPE is not specified, take 'Release' as default 53 | if(NOT CMAKE_BUILD_TYPE) 54 | set(CMAKE_BUILD_TYPE Release) 55 | endif() 56 | 57 | # Default to C++17 58 | if(NOT CMAKE_CXX_STANDARD) 59 | set(CMAKE_CXX_STANDARD 17) 60 | endif() 61 | 62 | # dependencies 63 | find_package(ament_cmake_auto REQUIRED) 64 | ament_auto_find_build_dependencies() 65 | 66 | find_package(rclcpp REQUIRED) 67 | find_package(sensor_msgs REQUIRED) 68 | 69 | if(BUILD_TESTING) 70 | find_package(ament_lint_auto REQUIRED) 71 | ament_lint_auto_find_test_dependencies() 72 | endif() 73 | 74 | ############################################################################### 75 | # Add all files in subdirectories of the project in 76 | # a dummy_target so qtcreator have access to all files 77 | file(GLOB_RECURSE extra_files ${CMAKE_SOURCE_DIR}/*) 78 | add_custom_target(${PROJECT_NAME}_files SOURCES ${extra_files}) 79 | ############################################################################### 80 | 81 | # includes 82 | include_directories( 83 | ${rclcpp_INCLUDE_DIRS} 84 | ${sensor_msgs_INCLUDE_DIRS} 85 | ) 86 | 87 | ## Build 88 | add_executable(zed_tutorial_video src/zed_video_sub_tutorial.cpp) 89 | ament_target_dependencies(zed_tutorial_video 90 | rclcpp 91 | sensor_msgs 92 | ) 93 | 94 | # Install executable 95 | install( 96 | TARGETS zed_tutorial_video 97 | DESTINATION lib/${PROJECT_NAME} 98 | ) 99 | 100 | ament_package() 101 | -------------------------------------------------------------------------------- /tutorials/zed_pose_tutorial/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_tutorial_pos_tracking) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "foxy") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_FOXY) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "humble") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_HUMBLE) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_IRON) 41 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 42 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 43 | add_definitions(-DFOUND_JAZZY) 44 | else() 45 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 46 | endif() 47 | else() 48 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 49 | endif() 50 | ################################################ 51 | 52 | # if CMAKE_BUILD_TYPE is not specified, take 'Release' as default 53 | if(NOT CMAKE_BUILD_TYPE) 54 | set(CMAKE_BUILD_TYPE Release) 55 | endif() 56 | 57 | # Default to C++17 58 | if(NOT CMAKE_CXX_STANDARD) 59 | set(CMAKE_CXX_STANDARD 17) 60 | endif() 61 | 62 | # dependencies 63 | find_package(ament_cmake_auto REQUIRED) 64 | ament_auto_find_build_dependencies() 65 | 66 | find_package(rclcpp REQUIRED) 67 | find_package(geometry_msgs REQUIRED) 68 | find_package(nav_msgs REQUIRED) 69 | find_package(tf2 REQUIRED) 70 | find_package(tf2_ros REQUIRED) 71 | 72 | if(BUILD_TESTING) 73 | find_package(ament_lint_auto REQUIRED) 74 | ament_lint_auto_find_test_dependencies() 75 | endif() 76 | 77 | ############################################################################### 78 | # Add all files in subdirectories of the project in 79 | # a dummy_target so qtcreator have access to all files 80 | file(GLOB_RECURSE extra_files ${CMAKE_SOURCE_DIR}/*) 81 | add_custom_target(${PROJECT_NAME}_files SOURCES ${extra_files}) 82 | ############################################################################### 83 | 84 | # includes 85 | include_directories( 86 | ${rclcpp_INCLUDE_DIRS} 87 | ${sensor_msgs_INCLUDE_DIRS} 88 | ) 89 | 90 | ## Build 91 | add_executable(zed_tutorial_pos_tracking src/zed_tutorial_pos_tracking.cpp) 92 | ament_target_dependencies(zed_tutorial_pos_tracking 93 | rclcpp 94 | geometry_msgs 95 | nav_msgs 96 | tf2 97 | tf2_ros 98 | ) 99 | 100 | # Install executable 101 | install( 102 | TARGETS zed_tutorial_pos_tracking 103 | DESTINATION lib/${PROJECT_NAME} 104 | ) 105 | 106 | ament_package() 107 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_multi_camera/urdf/zed_multi.urdf.xacro: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 26 | 27 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /tutorials/zed_robot_integration/launch/view_dual_zed.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Stereolabs 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the 'License'); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an 'AS IS' BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | from ament_index_python.packages import get_package_share_directory 17 | from launch import LaunchDescription 18 | from launch_ros.actions import Node 19 | from launch.substitutions import ( 20 | LaunchConfiguration, 21 | Command 22 | ) 23 | from launch.actions import ( 24 | DeclareLaunchArgument 25 | ) 26 | from launch.actions import ( 27 | DeclareLaunchArgument, 28 | OpaqueFunction 29 | ) 30 | 31 | # Enable colored output 32 | os.environ["RCUTILS_COLORIZED_OUTPUT"] = "1" 33 | 34 | # Camera name and model 35 | camera_name_1 = 'zed_front' 36 | camera_name_2 = 'zed_rear' 37 | camera_model_1 = 'zedx' 38 | camera_model_2 = 'zedxm' 39 | 40 | # RVIZ2 Configurations to be loaded by ZED Node 41 | config_rviz2 = os.path.join( 42 | get_package_share_directory('zed_robot_integration'), 43 | 'rviz2','view_config.rviz' 44 | ) 45 | 46 | # URDF/xacro file to be loaded by the Robot State Publisher node 47 | xacro_path = os.path.join( 48 | get_package_share_directory('zed_robot_integration'), 49 | 'urdf', 50 | 'zed_robot_dual.urdf.xacro' 51 | ) 52 | 53 | def launch_setup(context, *args, **kwargs): 54 | # Launch configuration variables 55 | use_zed_localization = LaunchConfiguration('use_zed_localization') 56 | 57 | 58 | # Robot URDF from xacro 59 | robot_description = Command( 60 | [ 61 | 'xacro', ' ', xacro_path, ' ', 62 | 'camera_name_1:=', camera_name_1, ' ', 63 | 'camera_name_2:=', camera_name_2, ' ', 64 | 'camera_model_1:=', camera_model_1, ' ', 65 | 'camera_model_2:=', camera_model_2, ' ', 66 | 'use_zed_localization:=', use_zed_localization, 67 | ]) 68 | 69 | # RVIZ2 node 70 | rviz2_node = Node( 71 | package='rviz2', 72 | executable='rviz2', 73 | name='rviz2', 74 | output='screen', 75 | arguments=[['-d'], [config_rviz2]], 76 | ) 77 | 78 | # Robot State Publisher 79 | rsp_node = Node( 80 | package='robot_state_publisher', 81 | executable='robot_state_publisher', 82 | name='scoutm_robot_state_publisher', 83 | output='screen', 84 | parameters=[ 85 | { 86 | 'robot_description': robot_description 87 | } 88 | ]) 89 | 90 | # Joint State Publisher 91 | jsp_node = Node( 92 | package='joint_state_publisher', 93 | executable='joint_state_publisher', 94 | name='scoutm_joint_state_publisher' 95 | ) 96 | 97 | return [ 98 | rviz2_node, 99 | rsp_node, 100 | jsp_node 101 | ] 102 | 103 | def generate_launch_description(): 104 | return LaunchDescription( 105 | [ 106 | DeclareLaunchArgument( 107 | 'use_zed_localization', 108 | default_value='true', 109 | description='Creates a TF tree with `camera_link` as root frame if `true`, otherwise the root is `base_ling`.', 110 | choices=['true', 'false']), 111 | OpaqueFunction(function=launch_setup) 112 | ] 113 | ) -------------------------------------------------------------------------------- /tools/zed_benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_topic_benchmark) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "foxy") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_FOXY) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "humble") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_HUMBLE) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_IRON) 41 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 42 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 43 | add_definitions(-DFOUND_JAZZY) 44 | else() 45 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 46 | endif() 47 | else() 48 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 49 | endif() 50 | ################################################ 51 | 52 | if(${FOUND_ROS2_DISTRO} STREQUAL "humble" OR ${FOUND_ROS2_DISTRO} STREQUAL "iron") 53 | # if CMAKE_BUILD_TYPE is not specified, take 'Release' as default 54 | if(NOT CMAKE_BUILD_TYPE) 55 | set(CMAKE_BUILD_TYPE Release) 56 | endif() 57 | 58 | # Default to C++17 59 | if(NOT CMAKE_CXX_STANDARD) 60 | set(CMAKE_CXX_STANDARD 17) 61 | endif() 62 | 63 | # dependencies 64 | set(DEPENDENCIES 65 | rclcpp 66 | rclcpp_components 67 | zed_topic_benchmark_component 68 | ) 69 | 70 | find_package(ament_cmake_auto REQUIRED) 71 | ament_auto_find_build_dependencies() 72 | 73 | find_package(rclcpp REQUIRED) 74 | find_package(rclcpp_components REQUIRED) 75 | find_package(zed_topic_benchmark_component REQUIRED) 76 | 77 | if(BUILD_TESTING) 78 | find_package(ament_lint_auto REQUIRED) 79 | ament_lint_auto_find_test_dependencies() 80 | endif() 81 | 82 | ############################################################################### 83 | # Add all files in subdirectories of the project in 84 | # a dummy_target so qtcreator have access to all files 85 | file(GLOB_RECURSE extra_files ${CMAKE_SOURCE_DIR}/*) 86 | add_custom_target(${PROJECT_NAME}_files SOURCES ${extra_files}) 87 | ############################################################################### 88 | 89 | ## Sources 90 | set(SRC_CONT src/topic_benchmark_container.cpp) 91 | 92 | ## Build 93 | add_executable(${PROJECT_NAME} ${SRC_CONT}) 94 | ament_target_dependencies(${PROJECT_NAME} 95 | ${DEPENDENCIES} 96 | ) 97 | 98 | # Install executable 99 | install(TARGETS ${PROJECT_NAME} 100 | ARCHIVE DESTINATION lib 101 | LIBRARY DESTINATION lib 102 | RUNTIME DESTINATION lib/${PROJECT_NAME} 103 | ) 104 | 105 | # Install LAUNCH files 106 | install(DIRECTORY 107 | launch 108 | DESTINATION share/${PROJECT_NAME} 109 | ) 110 | 111 | ament_package() 112 | endif() 113 | 114 | 115 | -------------------------------------------------------------------------------- /examples/zed_aruco_localization/src/component/include/zed_aruco_localization_component.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ZED_ARUCO_LOC_COMPONENT_HPP_ 16 | #define ZED_ARUCO_LOC_COMPONENT_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "aruco_loc_visibility_control.hpp" 34 | 35 | namespace stereolabs 36 | { 37 | 38 | typedef struct 39 | { 40 | int idx; 41 | std::string marker_frame_id; 42 | std::vector position; 43 | std::vector orientation; 44 | } ArucoPose; 45 | 46 | class ZedArucoLoc : public rclcpp::Node 47 | { 48 | public: 49 | ZED_ARUCO_LOC_COMPONENT_PUBLIC 50 | explicit ZedArucoLoc(const rclcpp::NodeOptions & options); 51 | 52 | virtual ~ZedArucoLoc() {} 53 | 54 | protected: 55 | void camera_callback( 56 | const sensor_msgs::msg::Image::ConstSharedPtr & img, 57 | const sensor_msgs::msg::CameraInfo::ConstSharedPtr & cam_info); 58 | 59 | template 60 | void getParam( 61 | std::string paramName, T defValue, T & outVal, 62 | std::string log_info = std::string(), bool dynamic = false); 63 | 64 | void getParams(); 65 | void getGeneralParams(); 66 | void getMarkerParams(); 67 | 68 | void initTFs(); 69 | void broadcastMarkerTFs(); 70 | bool getTransformFromTf( 71 | std::string targetFrame, std::string sourceFrame, 72 | tf2::Transform & out_tr); 73 | 74 | bool resetZedPose(tf2::Transform & new_pose); 75 | 76 | private: 77 | // ----> ROS Messages 78 | image_transport::CameraPublisher 79 | _pubDetect; // Publisher for detection results 80 | image_transport::CameraSubscriber _subImage; // ZED Image subscriber 81 | rclcpp::QoS _defaultQoS; // QoS parameters 82 | // <---- ROS Messages 83 | 84 | // Service client 85 | rclcpp::Client::SharedPtr _setPoseClient; 86 | 87 | // ----> Running variables 88 | rclcpp::Time _detTime; // Time of the latest detection 89 | std::atomic 90 | _detRunning; // Flag used to not perform cuncurrent detections 91 | // <---- Running variables 92 | 93 | // ----> Parameters 94 | int _markerCount = 1; // Number of markers available in the environment 95 | float _markerSize = 0.16f; // Size of the tags [m] 96 | float _detRate = 1.0f; // Maximum detection frequency for pose update 97 | std::string _worldFrameId; // World frame id 98 | std::string _cameraName = "zed"; // Name of the camera to be re-localized 99 | double _maxDist; // Maximum distance from the camera 100 | bool 101 | _refineDetection; // Enable sub-pixel refinement for the detected corners 102 | std::map 103 | _tagPoses; // Pose of each tag in the environment in World coordinates 104 | bool _debugActive; // Enable debug messages 105 | // <---- Parameters 106 | 107 | // ----> TF2 108 | std::unique_ptr _tfBuffer; 109 | std::unique_ptr _tfListener; 110 | std::unique_ptr _tfBroadcaster; 111 | 112 | tf2::Transform _img2aruco; 113 | tf2::Transform _aruco2img; 114 | tf2::Transform _ros2img; 115 | tf2::Transform _img2ros; 116 | tf2::Transform _left2base; 117 | 118 | rclcpp::TimerBase::SharedPtr _tfTimer; // Timer to broadcast marker TFs 119 | // <---- TF2 120 | }; 121 | 122 | } // namespace stereolabs 123 | 124 | #endif // ZED_ARUCO_LOC_COMPONENT_HPP_ 125 | -------------------------------------------------------------------------------- /examples/zed_depth_to_laserscan/README.md: -------------------------------------------------------------------------------- 1 | # ZED Depth map to Laser Scan 2 | 3 | This example demonstrates how to use [ROS 2 Composition](https://docs.ros.org/en/humble/Concepts/Intermediate/About-Composition.html) to convert the ZED Depth map messages into a virtual laser scan by using the `depthimage_to_laserscan` package. 4 | 5 | Usage: 6 | 7 | ```bash 8 | ros2 launch zed_depth_to_laserscan zed_depth_to_laserscan.launch.py camera_model:= 9 | ``` 10 | 11 | the launch file will start the ZED Wrapper node, the Depth Image to Laser Scan converter node, RVIZ2 for data visualization, and a Robot State Publisher node to broadcast the ZED camera static frames. 12 | 13 | You can disable RVIZ2 by using the launch argument `rviz:=false`. 14 | 15 | You can also get the list of all the available launch parameters with 16 | 17 | ```bash 18 | ros2 launch zed_to_laser_scan zed_to_laser_scan.launch.py -s 19 | ``` 20 | 21 | ![](./images/laserscan.jpg) 22 | 23 | ![](./images/pointcloud_scan.jpg) 24 | 25 | ## The launch file explained 26 | 27 | The launch file creates a ROS 2 container to run the two components: 28 | 29 | ```xml 30 | # ROS 2 Component Container 31 | container = ComposableNodeContainer( 32 | name='zed_depth_to_laserscan', 33 | namespace=camera_name_val, 34 | package='rclcpp_components', 35 | executable='component_container', 36 | composable_node_descriptions=[ 37 | zed_wrapper_component, 38 | zed_cvt_component 39 | ], 40 | output='screen', 41 | ) 42 | ``` 43 | 44 | The `zed_wrapper_component` variable defines the ZED node: 45 | 46 | ```xml 47 | # ZED Wrapper component 48 | zed_wrapper_component = ComposableNode( 49 | package='zed_components', 50 | namespace=camera_name_val, 51 | plugin='stereolabs::ZedCamera', 52 | name=zed_node_name, 53 | parameters=[ 54 | # YAML files 55 | config_common_path, # Common parameters 56 | config_camera_path, # Camera related parameters 57 | # Overriding 58 | { 59 | 'general.camera_name': camera_name_val, 60 | 'general.camera_model': camera_model_val, 61 | 'svo.svo_path': svo_path, 62 | 'general.serial_number': serial_number 63 | } 64 | ], 65 | extra_arguments=[{'use_intra_process_comms': True}] 66 | ) 67 | ``` 68 | 69 | the parameters are loaded from the YAML files defined by the variables `config_common_path` and `config_camera_path`. Note that `camera_name`, `camera_model`, `svo_file`, and `serial_number` are overridden by the launch options, so their values in the YAML files are ignored. 70 | 71 | The `zed_cvt_component` variable defines the "Depth Image to Laser Scan" node: 72 | 73 | ```xml 74 | # Depth to Laser scan component 75 | zed_cvt_component = ComposableNode( 76 | package='depthimage_to_laserscan', 77 | namespace=camera_name_val, 78 | plugin='depthimage_to_laserscan::DepthImageToLaserScanROS', 79 | name='depthimage_to_laserscan', 80 | parameters=[ 81 | config_path_cvt, 82 | # Overriding 83 | { 84 | 'output_frame': camera_depth_frame 85 | }], 86 | remappings=[ 87 | ('depth', zed_node_name_val + '/depth/depth_registered'), 88 | ('depth_camera_info', zed_node_name_val + '/depth/camera_info') 89 | ], 90 | #extra_arguments=[{'use_intra_process_comms': True}] # Uncomment when supported by the package 91 | ) 92 | ``` 93 | 94 | the parameters are loaded from the YAML files defined by the variable `config_path_cvt`. The parameter `output_frame` is overridden by the value of the variable `camera_depth_frame` initialized above to match the name of the link broadcasted by the ZED node: `camera_depth_frame = camera_name_val + '_left_camera_frame'`. 95 | 96 | The topic names `depth` and `depth_camera_info` are remapped to match the topic names published by the ZED node. 97 | 98 | ## Known issues 99 | 100 | Unfortunately, we cannot leverage the Intraprocess Communication behavior and improve data transmission performance with zero-copy because the default QoS setting of the `depthimage_to_laserscan::DepthImageToLaserScanROS` component is not compatible [see [issue](https://github.com/ros-perception/depthimage_to_laserscan/issues/75)]. If this will be fixed in the future you can uncomment the line `#extra_arguments=[{'use_intra_process_comms': True}] # Uncomment when supported by the package`. 101 | -------------------------------------------------------------------------------- /zed_display_rviz2/launch/display_zed_cam.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Stereolabs 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the 'License'); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an 'AS IS' BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | from launch.launch_description_sources import PythonLaunchDescriptionSource 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ( 22 | DeclareLaunchArgument, 23 | OpaqueFunction, 24 | IncludeLaunchDescription 25 | ) 26 | from launch.conditions import IfCondition 27 | from launch.substitutions import ( 28 | LaunchConfiguration, 29 | TextSubstitution 30 | ) 31 | from launch_ros.actions import Node 32 | 33 | def launch_setup(context, *args, **kwargs): 34 | 35 | # Launch configuration variables 36 | start_zed_node = LaunchConfiguration('start_zed_node') 37 | camera_name = LaunchConfiguration('camera_name') 38 | camera_model = LaunchConfiguration('camera_model') 39 | 40 | publish_svo_clock = LaunchConfiguration('publish_svo_clock') 41 | 42 | camera_name_val = camera_name.perform(context) 43 | camera_model_val = camera_model.perform(context) 44 | 45 | if (camera_name_val == ''): 46 | camera_name_val = 'zed' 47 | 48 | camera_type = '' 49 | if( camera_model_val=='zed' or 50 | camera_model_val=='zedm' or 51 | camera_model_val=='zed2' or 52 | camera_model_val=='zed2i' or 53 | camera_model_val=='zedx' or 54 | camera_model_val=='zedxm' or 55 | camera_model_val=='virtual'): 56 | camera_type = 'stereo' 57 | else: # 'zedxonegs' or 'zedxone4k') 58 | camera_type = 'mono' 59 | 60 | # RVIZ2 Configurations to be loaded by ZED Node 61 | config_rviz2 = os.path.join( 62 | get_package_share_directory('zed_display_rviz2'), 63 | 'rviz2', 64 | 'zed_' + camera_type + '.rviz' 65 | ) 66 | 67 | # RVIZ2 node 68 | rviz2_node = Node( 69 | package='rviz2', 70 | namespace=camera_name_val, 71 | executable='rviz2', 72 | name=camera_model_val +'_rviz2', 73 | output='screen', 74 | arguments=[['-d'], [config_rviz2]], 75 | parameters=[{'use_sim_time': publish_svo_clock}] 76 | ) 77 | 78 | # ZED Wrapper launch file 79 | zed_wrapper_launch = IncludeLaunchDescription( 80 | launch_description_source=PythonLaunchDescriptionSource([ 81 | get_package_share_directory('zed_wrapper'), 82 | '/launch/zed_camera.launch.py' 83 | ]), 84 | launch_arguments={ 85 | 'camera_name': camera_name_val, 86 | 'camera_model': camera_model_val, 87 | 'publish_svo_clock': publish_svo_clock 88 | }.items(), 89 | condition=IfCondition(start_zed_node) 90 | ) 91 | 92 | return [ 93 | rviz2_node, 94 | zed_wrapper_launch 95 | ] 96 | 97 | 98 | def generate_launch_description(): 99 | return LaunchDescription( 100 | [ 101 | DeclareLaunchArgument( 102 | 'start_zed_node', 103 | default_value='True', 104 | description='Set to `False` to start only RVIZ2 if a ZED node is already running.'), 105 | DeclareLaunchArgument( 106 | 'camera_name', 107 | default_value=TextSubstitution(text='zed'), 108 | description='The name of the camera. It can be different from the camera model and it will be used as node `namespace`.'), 109 | DeclareLaunchArgument( 110 | 'camera_model', 111 | description='[REQUIRED] The model of the camera. Using a wrong camera model can disable camera features.', 112 | choices=['zed', 'zedm', 'zed2', 'zed2i', 'zedx', 'zedxm', 'virtual', 'zedxonegs', 'zedxone4k']), 113 | DeclareLaunchArgument( 114 | 'publish_svo_clock', 115 | default_value='false', 116 | description='If set to `true` the node will act as a clock server publishing the SVO timestamp. This is useful for node synchronization'), 117 | OpaqueFunction(function=launch_setup) 118 | ] 119 | ) 120 | -------------------------------------------------------------------------------- /tools/zed_benchmark_component/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | project(zed_topic_benchmark_component) 3 | 4 | ## Generate symbols for IDE indexer 5 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 6 | 7 | ################################################ 8 | # Check the ROS2 version 9 | 10 | set(ROS2_FOUND FALSE) 11 | if(DEFINED ENV{ROS_DISTRO}) 12 | set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO}) 13 | set(ROS2_FOUND TRUE) 14 | #message("* Found ROS2 ${FOUND_ROS2_DISTRO}") 15 | else() 16 | message("* ROS2 distro variable not set. Trying to figure it out...") 17 | set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling") 18 | set(ROS2_FOUND FALSE) 19 | foreach(distro ${ROS2_DISTROS}) 20 | if(NOT ROS2_FOUND) 21 | find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp) 22 | if(RCLCPP_H) 23 | message("* Found ROS2 ${distro}") 24 | set(FOUND_ROS2_DISTRO ${distro}) 25 | set(ROS2_FOUND TRUE) 26 | endif() 27 | endif() 28 | endforeach() 29 | endif() 30 | 31 | if(ROS2_FOUND) 32 | if(${FOUND_ROS2_DISTRO} STREQUAL "humble") 33 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 34 | add_definitions(-DFOUND_HUMBLE) 35 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron") 36 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 37 | add_definitions(-DFOUND_IRON) 38 | elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy") 39 | #message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.") 40 | add_definitions(-DFOUND_JAZZY) 41 | else() 42 | message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.") 43 | endif() 44 | else() 45 | message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.") 46 | endif() 47 | ################################################ 48 | 49 | if(${FOUND_ROS2_DISTRO} STREQUAL "humble" OR ${FOUND_ROS2_DISTRO} STREQUAL "iron") 50 | # if CMAKE_BUILD_TYPE is not specified, take 'Release' as default 51 | if(NOT CMAKE_BUILD_TYPE) 52 | set(CMAKE_BUILD_TYPE Release) 53 | endif() 54 | 55 | # Default to C++17 56 | if(NOT CMAKE_CXX_STANDARD) 57 | set(CMAKE_CXX_STANDARD 17) 58 | endif() 59 | 60 | # dependencies 61 | set(DEPENDENCIES 62 | rclcpp 63 | rclcpp_components 64 | zed_topic_benchmark_interfaces 65 | ) 66 | 67 | find_package(ament_cmake_auto REQUIRED) 68 | ament_auto_find_build_dependencies() 69 | 70 | find_package(rclcpp REQUIRED) 71 | find_package(rclcpp_components REQUIRED) 72 | find_package(zed_topic_benchmark_interfaces REQUIRED) 73 | 74 | 75 | if(BUILD_TESTING) 76 | find_package(ament_lint_auto REQUIRED) 77 | ament_lint_auto_find_test_dependencies() 78 | endif() 79 | 80 | ############################################################################### 81 | # Add all files in subdirectories of the project in 82 | # a dummy_target so qtcreator have access to all files 83 | file(GLOB_RECURSE extra_files ${CMAKE_SOURCE_DIR}/*) 84 | add_custom_target(${PROJECT_NAME}_files SOURCES ${extra_files}) 85 | ############################################################################### 86 | 87 | ## Sources 88 | set(SRC_COMP 89 | src/component/src/topic_benchmark_component.cpp 90 | src/component/src/winavg.cpp) 91 | 92 | add_library(${PROJECT_NAME} SHARED 93 | ${SRC_COMP} 94 | ) 95 | target_compile_definitions(${PROJECT_NAME} 96 | PRIVATE "COMPOSITION_BUILDING_DLL" 97 | ) 98 | ament_target_dependencies(${PROJECT_NAME} 99 | ${DEPENDENCIES} 100 | ) 101 | 102 | target_include_directories(${PROJECT_NAME} PUBLIC 103 | $ 104 | $ 105 | $ 106 | ) 107 | 108 | rclcpp_components_register_nodes(${PROJECT_NAME} "stereolabs::TopicBenchmarkComponent") 109 | set(node_plugins "${node_plugins}stereolabs::TopicBenchmarkComponent;$\n") 110 | 111 | install(TARGETS ${PROJECT_NAME} 112 | ARCHIVE DESTINATION lib 113 | LIBRARY DESTINATION lib 114 | RUNTIME DESTINATION lib/${PROJECT_NAME} 115 | ) 116 | 117 | install(DIRECTORY 118 | ${CMAKE_CURRENT_SOURCE_DIR}/src/component/include/ 119 | ${CMAKE_CURRENT_SOURCE_DIR}/src/include/ 120 | DESTINATION include/${PROJECT_NAME} 121 | ) 122 | 123 | ament_export_include_directories(include) 124 | ament_export_libraries(${PROJECT_NAME}) 125 | ament_export_dependencies(${DEPENDENCIES}) 126 | ament_package() 127 | endif() 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /tutorials/zed_rgb_convert/src/component/src/zed_rgb_convert_component.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "zed_rgb_convert_component.hpp" 16 | 17 | #include 18 | #include 19 | 20 | using namespace std::chrono_literals; 21 | using namespace std::placeholders; 22 | 23 | namespace stereolabs 24 | { 25 | 26 | ZedRgbCvtComponent::ZedRgbCvtComponent(const rclcpp::NodeOptions & options) 27 | : Node("zed_cvt_node", options), mDefaultQoS(1) 28 | { 29 | RCLCPP_INFO(get_logger(), "********************************"); 30 | RCLCPP_INFO(get_logger(), " ZED BGRA2BGA Convert Component "); 31 | RCLCPP_INFO(get_logger(), "********************************"); 32 | RCLCPP_INFO(get_logger(), " * namespace: %s", get_namespace()); 33 | RCLCPP_INFO(get_logger(), " * node name: %s", get_name()); 34 | RCLCPP_INFO(get_logger(), "********************************"); 35 | 36 | /* Note: it is very important to use a QOS profile for the subscriber that is 37 | * compatible with the QOS profile of the publisher. The ZED component node 38 | * uses a default QoS profile with reliability set as "RELIABLE" and 39 | * durability set as "VOLATILE". To be able to receive the subscribed topic 40 | * the subscriber must use compatible parameters. 41 | */ 42 | 43 | // https://github.com/ros2/ros2/wiki/About-Quality-of-Service-Settings 44 | 45 | mDefaultQoS.keep_last(10); 46 | mDefaultQoS.reliable(); 47 | mDefaultQoS.durability_volatile(); 48 | 49 | // Create camera pusblisher for converted image topic 50 | mPubBgr = image_transport::create_camera_publisher( 51 | this, "~/zed_image_3ch", mDefaultQoS.get_rmw_qos_profile()); 52 | RCLCPP_INFO_STREAM( 53 | get_logger(), 54 | "Advertised on topic: " << mPubBgr.getTopic()); 55 | 56 | // Create camera subscriber 57 | mSubBgra = image_transport::create_camera_subscription( 58 | this, "zed_image_4ch", 59 | std::bind(&ZedRgbCvtComponent::camera_callback, this, _1, _2), "raw", 60 | mDefaultQoS.get_rmw_qos_profile()); 61 | 62 | RCLCPP_INFO_STREAM( 63 | get_logger(), 64 | "Subscribed on topic: " << mSubBgra.getTopic()); 65 | RCLCPP_INFO_STREAM( 66 | get_logger(), 67 | "Subscribed on topic: " << mSubBgra.getInfoTopic()); 68 | } 69 | 70 | void ZedRgbCvtComponent::camera_callback( 71 | const sensor_msgs::msg::Image::ConstSharedPtr & img, 72 | const sensor_msgs::msg::CameraInfo::ConstSharedPtr & cam_info) 73 | { 74 | // Check for correct input image encoding 75 | if (img->encoding != sensor_msgs::image_encodings::BGRA8) { 76 | RCLCPP_ERROR( 77 | get_logger(), 78 | "The input topic image requires 'BGRA8' encoding"); 79 | exit(EXIT_FAILURE); 80 | } 81 | 82 | // Convert BGRA to BGR using OpenCV 83 | void * data = 84 | const_cast(reinterpret_cast(&img->data[0])); 85 | cv::Mat bgra(img->height, img->width, CV_8UC4, data); 86 | cv::Mat bgr; 87 | 88 | cv::cvtColor(bgra, bgr, cv::COLOR_BGRA2BGR); 89 | 90 | // Create the output message and copy coverted data 91 | std::shared_ptr out_bgr = 92 | std::make_shared(); 93 | 94 | out_bgr->header.stamp = img->header.stamp; 95 | out_bgr->header.frame_id = img->header.frame_id; 96 | out_bgr->height = bgr.rows; 97 | out_bgr->width = bgr.cols; 98 | 99 | int num = 1; // for endianness detection 100 | out_bgr->is_bigendian = !(*reinterpret_cast(&num) == 1); 101 | 102 | out_bgr->step = bgr.step; 103 | 104 | size_t size = out_bgr->step * out_bgr->height; 105 | out_bgr->data.resize(size); 106 | 107 | out_bgr->encoding = sensor_msgs::image_encodings::BGR8; 108 | memcpy(reinterpret_cast((&out_bgr->data[0])), &bgr.data[0], size); 109 | 110 | // Publish the new image message coupled with camera info from the original 111 | // message 112 | mPubBgr.publish(out_bgr, cam_info); 113 | } 114 | 115 | } // namespace stereolabs 116 | 117 | #include "rclcpp_components/register_node_macro.hpp" 118 | 119 | // Register the component with class_loader. 120 | // This acts as a sort of entry point, allowing the component to be discoverable 121 | // when its library is being loaded into a running process. 122 | RCLCPP_COMPONENTS_REGISTER_NODE(stereolabs::ZedRgbCvtComponent) 123 | -------------------------------------------------------------------------------- /tutorials/zed_pose_tutorial/src/zed_tutorial_pos_tracking.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Stereolabs 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * This tutorial demonstrates simple receipt of ZED pose and odometry messages 17 | * over the ROS system. 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | using namespace std::placeholders; 29 | 30 | #define RAD2DEG 57.295779513 31 | 32 | class MinimalPoseOdomSubscriber : public rclcpp::Node 33 | { 34 | public: 35 | MinimalPoseOdomSubscriber() 36 | : Node("zed_odom_pose_tutorial") 37 | { 38 | /* Note: it is very important to use a QOS profile for the subscriber that 39 | * is compatible with the QOS profile of the publisher. The ZED component 40 | * node uses a default QoS profile with reliability set as "RELIABLE" and 41 | * durability set as "VOLATILE". To be able to receive the subscribed topic 42 | * the subscriber must use compatible parameters. 43 | */ 44 | 45 | // https://github.com/ros2/ros2/wiki/About-Quality-of-Service-Settings 46 | 47 | rclcpp::QoS qos(10); 48 | 49 | auto sub_opt = rclcpp::SubscriptionOptions(); 50 | 51 | // Create pose subscriber 52 | mPoseSub = create_subscription( 53 | "pose", qos, 54 | std::bind(&MinimalPoseOdomSubscriber::poseCallback, this, _1), sub_opt); 55 | 56 | // Create odom subscriber 57 | mOdomSub = create_subscription( 58 | "odom", qos, 59 | std::bind(&MinimalPoseOdomSubscriber::odomCallback, this, _1), sub_opt); 60 | } 61 | 62 | protected: 63 | void poseCallback(const geometry_msgs::msg::PoseStamped::SharedPtr msg) 64 | { 65 | // Camera position in map frame 66 | double tx = msg->pose.position.x; 67 | double ty = msg->pose.position.y; 68 | double tz = msg->pose.position.z; 69 | 70 | // Orientation quaternion 71 | tf2::Quaternion q(msg->pose.orientation.x, msg->pose.orientation.y, 72 | msg->pose.orientation.z, msg->pose.orientation.w); 73 | 74 | // 3x3 Rotation matrix from quaternion 75 | tf2::Matrix3x3 m(q); 76 | 77 | // Roll Pitch and Yaw from rotation matrix 78 | double roll, pitch, yaw; 79 | m.getRPY(roll, pitch, yaw); 80 | 81 | // Output the measure 82 | RCLCPP_INFO( 83 | get_logger(), 84 | "Received pose in '%s' frame : X: %.2f Y: %.2f Z: %.2f - R: " 85 | "%.2f P: %.2f Y: %.2f - " 86 | "Ts: %u.%u sec ", 87 | msg->header.frame_id.c_str(), tx, ty, tz, roll * RAD2DEG, 88 | pitch * RAD2DEG, yaw * RAD2DEG, msg->header.stamp.sec, 89 | msg->header.stamp.nanosec); 90 | } 91 | 92 | void odomCallback(const nav_msgs::msg::Odometry::SharedPtr msg) 93 | { 94 | // Camera position in map frame 95 | double tx = msg->pose.pose.position.x; 96 | double ty = msg->pose.pose.position.y; 97 | double tz = msg->pose.pose.position.z; 98 | 99 | // Orientation quaternion 100 | tf2::Quaternion q( 101 | msg->pose.pose.orientation.x, msg->pose.pose.orientation.y, 102 | msg->pose.pose.orientation.z, msg->pose.pose.orientation.w); 103 | 104 | // 3x3 Rotation matrix from quaternion 105 | tf2::Matrix3x3 m(q); 106 | 107 | // Roll Pitch and Yaw from rotation matrix 108 | double roll, pitch, yaw; 109 | m.getRPY(roll, pitch, yaw); 110 | 111 | // Output the measure 112 | RCLCPP_INFO( 113 | get_logger(), 114 | "Received odometry in '%s' frame : X: %.2f Y: %.2f Z: %.2f - " 115 | "R: %.2f P: %.2f Y: %.2f - " 116 | "Ts: %u.%u sec ", 117 | msg->header.frame_id.c_str(), tx, ty, tz, roll * RAD2DEG, 118 | pitch * RAD2DEG, yaw * RAD2DEG, msg->header.stamp.sec, 119 | msg->header.stamp.nanosec); 120 | } 121 | 122 | private: 123 | rclcpp::Subscription::SharedPtr mPoseSub; 124 | rclcpp::Subscription::SharedPtr mOdomSub; 125 | }; 126 | 127 | int main(int argc, char * argv[]) 128 | { 129 | rclcpp::init(argc, argv); 130 | 131 | auto pos_track_node = std::make_shared(); 132 | 133 | rclcpp::spin(pos_track_node); 134 | rclcpp::shutdown(); 135 | return 0; 136 | } 137 | -------------------------------------------------------------------------------- /tutorials/zed_ipc/launch/zed_ipc.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Stereolabs 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the 'License'); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an 'AS IS' BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | from launch.launch_description_sources import PythonLaunchDescriptionSource 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ( 22 | DeclareLaunchArgument, 23 | OpaqueFunction, 24 | IncludeLaunchDescription, 25 | LogInfo 26 | ) 27 | from launch.substitutions import ( 28 | LaunchConfiguration, 29 | TextSubstitution 30 | ) 31 | from launch_ros.actions import ( 32 | LoadComposableNodes 33 | ) 34 | from launch_ros.descriptions import ComposableNode 35 | 36 | # Function to parse array parameters 37 | def parse_array_param(param): 38 | str = param.replace('[', '') 39 | str = str.replace(']', '') 40 | str = str.replace(' ', '') 41 | arr = str.split(',') 42 | return arr 43 | 44 | def launch_setup(context, *args, **kwargs): 45 | 46 | # List of actions to be launched 47 | actions = [] 48 | 49 | # Arguments 50 | names = LaunchConfiguration('cam_names') 51 | models = LaunchConfiguration('cam_models') 52 | serials = LaunchConfiguration('cam_serials') 53 | ids = LaunchConfiguration('cam_ids') 54 | disable_tf = LaunchConfiguration('disable_tf') 55 | 56 | # Call the multi-camera launch file 57 | multi_camera_launch_file = os.path.join( 58 | get_package_share_directory('zed_multi_camera'), 59 | 'launch', 60 | 'zed_multi_camera.launch.py' 61 | ) 62 | zed_multi_camera = IncludeLaunchDescription( 63 | launch_description_source=PythonLaunchDescriptionSource(multi_camera_launch_file), 64 | launch_arguments={ 65 | 'cam_names': names, 66 | 'cam_models': models, 67 | 'cam_serials': serials, 68 | 'cam_ids': ids, 69 | 'disable_tf': disable_tf 70 | }.items() 71 | ) 72 | actions.append(zed_multi_camera) 73 | 74 | cam_count = len(names.perform(context).split(',')) 75 | 76 | # Create topic remappings for the point cloud node 77 | remappings = [] 78 | name_array = parse_array_param(names.perform(context)) 79 | for i in range(cam_count): 80 | base_topic = 'pointcloud_' + str(i) 81 | remap = '/zed_multi/' + name_array[i] + '/point_cloud/cloud_registered' 82 | remapping = (base_topic, remap) 83 | remappings.append(remapping) 84 | 85 | # Create the point cloud node 86 | pc_node = ComposableNode( 87 | package='zed_ipc', 88 | plugin='stereolabs::PointCloudComponent', 89 | name='ipc_user_node', 90 | namespace='zed_multi', 91 | parameters=[{ 92 | 'cam_count': cam_count 93 | }], 94 | remappings=remappings, 95 | extra_arguments=[{'use_intra_process_comms': True}] 96 | ) 97 | 98 | # Load the point cloud node in the container 99 | load_pc_node = LoadComposableNodes( 100 | composable_node_descriptions=[pc_node], 101 | target_container='/zed_multi/zed_multi_container' 102 | ) 103 | actions.append(load_pc_node) 104 | 105 | return actions 106 | 107 | 108 | def generate_launch_description(): 109 | return LaunchDescription( 110 | [ 111 | DeclareLaunchArgument( 112 | 'cam_names', 113 | description='An array containing the names of the cameras, e.g. [zed_front,zed_back]'), 114 | DeclareLaunchArgument( 115 | 'cam_models', 116 | description='An array containing the names of the cameras, e.g. [zed2i,zed2]'), 117 | DeclareLaunchArgument( 118 | 'cam_serials', 119 | default_value=[], 120 | description='An array containing the serial numbers of the cameras, e.g. [35199186,23154724]'), 121 | DeclareLaunchArgument( 122 | 'cam_ids', 123 | default_value=[], 124 | description='An array containing the ID number of the cameras, e.g. [0,1]'), 125 | DeclareLaunchArgument( 126 | 'disable_tf', 127 | default_value='False', 128 | description='If `True` disable TF broadcasting for all the cameras in order to fuse visual odometry information externally.'), 129 | OpaqueFunction(function=launch_setup) 130 | ] 131 | ) 132 | -------------------------------------------------------------------------------- /examples/zed_aruco_localization/README.md: -------------------------------------------------------------------------------- 1 | # ZED ArUco Localization 2 | 3 | This example demonstrates how to use a set of ArUco markers placed at known positions and orientations in the environment to locate a ZED camera device. 4 | 5 | The example leverages the concept of [Node Composition in ROS 2(https://docs.ros.org/en/humble/Concepts/Intermediate/About-Composition.html)]. It creates a ROS 2 component named `stereolabs::ZedArucoLoc` that must be executed in the same container (process)where the `stereolabs::ZedCamera` component is running to leverage the Intra Process Communication behavior of ROS 2 and minimize the data latency. 6 | 7 | The launch file `zed_aruco_loc.launch.py` shows how to start a ROS 2 container and load the `stereolabs::ZedCamera` component and the `stereolabs::ZedArucoLoc` component. 8 | 9 | The `stereolabs::ZedArucoLoc` component subscribes to the rectified left camera RGB image topic of the component `stereolabs::ZedCamera`, performs ArUco detection and recalculates the pose of the camera according to the pose of the detected marker in the world. Finally, the `stereolabs::ZedArucoLoc` component calls the `set_pose` service provided by the `stereolabs::ZedCamera` component to fix the pose of the camera. 10 | 11 | You can generate your ArUco markers by using [this online tool](https://chev.me/arucogen/). It is important to select the **6x6** dictionary. 12 | 13 | ## Set the parameters 14 | 15 | The parameters are described in the file `config/aruco_loc.yaml` that is loaded by the launch file: 16 | 17 | ``` 18 | general: 19 | marker_count: # Number of markers in the World 20 | marker_size: # Width/Height of the ArUco tags [m] 21 | maximum_distance: # Maximum distance of the target from the camera to consider it valid 22 | detection_rate: # Maximum detection frequency for camera pose update 23 | camera_name: "zed" # Name of the camera to relocate 24 | world_frame_id: "map" # Frame id of the world frame 25 | refine_detection: false # If enabled the corners of the detected markers will be processed to obtain sub-pixel precision 26 | 27 | debug: 28 | active: false # Enable debug messages 29 | ``` 30 | 31 | For each marker in the world (this must match the number in `marker_count`): 32 | 33 | ``` 34 | marker_: 35 | aruco_id: # ID of the ArUco tag as retrieved by the ArUco Detector code 36 | position: [,,] # Pose with respect to the World origin [m] 37 | orientation: [,,] # Orientation with respect to the World origin [rad] 38 | ``` 39 | 40 | > **Note:** the folder `markers` contains the SVG files of the markers **#19** and **#43** listed in the example file `aruco_loc.yaml`. 41 | You can use a vectorial editor (e.g. Inkscape) to resize them according to the value of the parameter `general.marker_size`. 42 | 43 | ## Run the example 44 | 45 | Call the command 46 | 47 | `ros2 launch zed_aruco_localization zed_aruco_loc.launch.py camera_model:=` 48 | 49 | to start the `zed_aruco_localization` node. 50 | 51 | > **Note:** you can add the option `rviz:=false` to disable the automatic load of RVIZ2. 52 | 53 | The `zed_aruco_localization` node performs ArUco detection at a fixed rate by subscribing to ZED color image topics. When a tag is detected it calculates the camera pose with respect to it and calls the `set_pose` service of the ZED node to reset the camera pose in the "world". 54 | 55 | > **Note:** By default, the gravity alignment is turned off. However, you can turn it on by using the launch option `gravity_alignment:=true`. Please note that for accurate ArUco re-location, it is crucial to ensure that the pitch and yaw values of each marker's orientation are properly set with respect to the Earth's gravity vector. 56 | 57 | Before running the example, it is important to set the following parameters in `config/aruco_loc.yaml`: 58 | 59 | * `general.marker_count`: indicates how many markers are placed in the world 60 | * `general.marker_size`: dimension in meters of the size of the marker 61 | 62 | Then for each marker a set of parameters must be added: 63 | 64 | ```yaml 65 | marker_xxx: 66 | aruco_id: yy # ID of the ArUco tag as retrieved by the ArUco Detector code 67 | position: [X,Y,Z] # Pose with respect to the World origin [m] 68 | orientation: [R,P,Y] # Orientation with respect to the World origin [rad] 69 | ``` 70 | 71 | * replace `marker_xxx` with an incremental index, i.e. `marker_000` for the first marker, `marker_001` for the second marker, and so on. 72 | * `aruco_id`: the index of the marker as detected 73 | * `position`: the position of the marker in world frame, i.e. with respect to the origin 74 | * `orientation`: the roll, pitch, yaw orientation [rad] of the marker in world frame, i.e. with respect to the origin 75 | 76 | > **Note**: use the command `ros2 launch zed_aruco_localization zed_aruco_loc.launch.py -s` to get the list of all the availabe launch parameters. 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /isaac_ros/zed_isaac_ros_nitros_sub/launch/zed_nitros_sub_example.launch.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Stereolabs 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the 'License'); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an 'AS IS' BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | from ament_index_python.packages import get_package_share_directory 18 | from launch.launch_description_sources import PythonLaunchDescriptionSource 19 | 20 | from launch import LaunchDescription 21 | from launch.actions import ( 22 | DeclareLaunchArgument, 23 | OpaqueFunction, 24 | IncludeLaunchDescription, 25 | LogInfo 26 | ) 27 | from launch.substitutions import ( 28 | LaunchConfiguration, 29 | TextSubstitution 30 | ) 31 | from launch_ros.actions import ( 32 | ComposableNodeContainer, 33 | LoadComposableNodes 34 | ) 35 | 36 | from launch_ros.descriptions import ( 37 | ComposableNode 38 | ) 39 | # Enable colored output 40 | os.environ["RCUTILS_COLORIZED_OUTPUT"] = "1" 41 | 42 | 43 | def launch_setup(context, *args, **kwargs): 44 | 45 | # Get the path to the camera configuration file 46 | example_params_file = os.path.join( 47 | get_package_share_directory('zed_isaac_ros_nitros_sub'), 48 | 'config', 49 | 'example_params.yaml' 50 | ) 51 | 52 | # Get the path to the AprilTag configuration file # List of actions to be launched 53 | actions = [] 54 | 55 | namespace_val = 'zed_isaac' 56 | camera_model = LaunchConfiguration('camera_model') 57 | topic_name = LaunchConfiguration('topic_name') 58 | 59 | # ROS 2 Component Container 60 | container_name = 'zed_container' 61 | info = '* Starting Composable node container: ' + namespace_val + '/' + container_name 62 | actions.append(LogInfo(msg=TextSubstitution(text=info))) 63 | 64 | # Note: It is crucial that the 'executable' field is set to be 'component_container_mt' 65 | # so that the created nodes can be started and communicated correctly within the same process. 66 | 67 | zed_container = ComposableNodeContainer( 68 | name=container_name, 69 | namespace=namespace_val, 70 | package='rclcpp_components', 71 | executable='component_container_mt', 72 | #executable='component_container_isolated', 73 | arguments=['--ros-args', '--log-level', 'info'], 74 | output='screen', 75 | ) 76 | actions.append(zed_container) 77 | 78 | # ZED Wrapper launch file 79 | zed_wrapper_launch = IncludeLaunchDescription( 80 | launch_description_source=PythonLaunchDescriptionSource([ 81 | get_package_share_directory('zed_wrapper'), 82 | '/launch/zed_camera.launch.py' 83 | ]), 84 | launch_arguments={ 85 | 'camera_model': camera_model, 86 | 'container_name': container_name, 87 | 'namespace': namespace_val, 88 | 'enable_ipc': 'false', 89 | 'ros_params_override_path': example_params_file 90 | }.items() 91 | ) 92 | actions.append(zed_wrapper_launch) 93 | 94 | # Define the Image Subscriber node component 95 | 96 | isaac_image_sub_node = ComposableNode( 97 | package='zed_isaac_ros_nitros_sub', 98 | plugin='stereolabs::ZedNitrosSubComponent', 99 | name='zed_nitros_sub_component', 100 | namespace=namespace_val, 101 | remappings=[ 102 | ('image', topic_name) 103 | ], 104 | parameters=[ 105 | example_params_file 106 | ], 107 | extra_arguments=[{'use_intra_process_comms': False}] 108 | ) 109 | 110 | # Create the full name of the container 111 | container_full_name = namespace_val + '/' + container_name 112 | 113 | # Load the Image Subscriber node into the container 114 | load_sub_node = LoadComposableNodes( 115 | composable_node_descriptions=[isaac_image_sub_node], 116 | target_container=container_full_name 117 | ) 118 | actions.append(load_sub_node) 119 | 120 | return actions 121 | 122 | def generate_launch_description(): 123 | return LaunchDescription( 124 | [ 125 | DeclareLaunchArgument( 126 | 'camera_model', 127 | description='[REQUIRED] The model of the camera. Using a wrong camera model can disable camera features.', 128 | choices=['zed', 'zedm', 'zed2', 'zed2i', 'zedx', 'zedxm', 'virtual', 'zedxonegs', 'zedxone4k']), 129 | DeclareLaunchArgument( 130 | 'topic_name', 131 | default_value='', 132 | description='Topic name to subscribe to BGRA Nitros image messages. It also supports 32 bit Depth Map messages.'), 133 | OpaqueFunction(function=launch_setup) 134 | ] 135 | ) 136 | --------------------------------------------------------------------------------