deepstream_ros2
Deepstream - ROS2 bridge with depth and color data synchronization
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.5%) to scientific vocabulary
Repository
Deepstream - ROS2 bridge with depth and color data synchronization
Basic Info
- Host: GitHub
- Owner: maladzenkau
- License: bsd-3-clause
- Language: Python
- Default Branch: main
- Size: 738 KB
Statistics
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
deepstream_ros2 (Pre-reliese phase)
This project allows bridging DeepStream inference results (rectangular boxes) with ROS2 in its basic functionality.
Also, if you wish to utilize a ROS2 topic of type sensor_msgs::msg::Image for object detection, you can employ the image2rtsp package to buffer the topic into an RTSP stream. With a ROS2 topic as DeepStream input, additional functionality can be used to estimate the latency (which appears due to the inference processing time), which can be used to synchronize depth and color data or to estimate the load state of your device. For the Intel® RealSense™ Depth Camera D435i, it is also implemented the extraction of real-world coordinates relative to the camera frame and their transformation into the map frame. (Note: The camera frame should be included in the URDF description.)
The development is being carried out on Ubuntu 20.04 with ROS2 Foxy at Jetson ORIN NX 16GB running JetPack 5.1.2 (DeepStream 6.3).
To Do:
Test with ROS2 Humble
1. DeepStream Kafka - ROS2 bridge
Dependencies
- ROS2 Foxy
- Some libraries
bash pip install -U numpy python-dateutil kafka-python pyrealsense2 sudo apt install default-jre
DeepStream and Kafka server configuration
- To set up a Kafka server for use with DeepStream, you can refer to the instructions provided in link1 and link2. For additional reference, configuration files for DeepStream can be found in the
deepstreamfolder. - To start DeepStream application, run your own build with Kafka broker or
test5-app:bash deepstream-test5-app -c deepstream_app_config.txt## Install - Clone the package:
bashrc git clone https://github.com/maladzenkau/deepstream_ros2 - Change the parameters in the launch file according to your needs:
bashrc gedit ~/deepstream_ros2/src/deepstream_ros2_bridge_launch/launch/launch.py# Example parameters=[ {'kafkatopic': 'deepstream'}, # Name of the created Kafka topic on which inference results are published {'bootstrapservers': '127.0.0.1:9092'}, # Server adress {'known_objects': ['red', 'yellow', 'green']} # Classes your model is trained to detect - Save your configuration and navigate to
ros2_wscolcon root, source and build the package:
bashrc
cd ~/deepstream_ros2/
colcon build
Run
- Source
installand launch the package:bashrc source install/setup.bash ros2 launch deepstream_ros2_bridge_launch launch.pyObject detection results will be published on topic/objectDetection.
Message Example
```bashrc
timestampkafka: '2024-03-25T10:54:50.968Z' detectedobject: '50' topleftx: 571 toplefty: 216 bottomright_x: 614
bottomrighty: 261
```
2. Latency estimation
To estimate the latency, your model should be capable of detecting a synchronization image. It is recommended to use a simple image with a typical background from your dataset. Ensure that the resolution of your synchronization image matches the resolution of the source topic used for object detection. Example of such an image is shown below.
- Open launch file:
bashrc gedit ~/deepstream_ros2/src/deepstream_ros2_bridge_launch/launch/launch.py - Uncomment latency estimation node:
bashrc ld.add_action(latency_estimator) - Change the node parameters according to the color data topic: # Example parameters=[ {'frequency': '5'}, # How often the latency should be estimated (in seconds) {'colorimagetopic': 'color/imageraw'}, # topic which serves as a DeepStream source. {'topicencoding': 'bgr8'}, # encoding of this topic (could be found using 'ros2 topic info') {'imgpath': '/home/jetson/deepstreamros2/sync.jpg'} # path to your synchronization image ]
- Save your configuration and navigate to
ros2_wscolcon root, source and build the package:bashrc colcon build --packages-select deepstream_ros2_bridge_launchThe latency will be published on topic/latency.
3. Color and depth data synchronization
The synchronization node enables the delay of a topic based on a specified latency. It's important to note that for topics with low frame rates, this functionality may not provide significant benefits. This synchronization mechanism ensures that detected boxes from the color frame correspond accurately to objects in the depth frame. Additionally, it implies that the depth sensor produces depth frames aligned with the color sensor frames.
- Open launch file:
bashrc
gedit ~/deepstream_ros2/src/deepstream_ros2_bridge_launch/launch/launch.py
- Uncomment delay node:
bashrc
ld.add_action(delay_topic)
- Change the delay_topic node parameters according to the depth data topic:
Example
parameters=[
{'topic_to_be_delayed': '/aligned_depth_to_color/image_raw'},
{'fps': 30} # FPS of the topic (should be set the same for both depth and color data topics)
]
- Save your configuration and navigate to
ros2_wscolcon root, source and build the package:bashrc colcon build --packages-select deepstream_ros2_bridge_launch - To check if the bounding boxes of the detected object correspond to the object on the depth frame, uncomment validation node:
bashrc ld.add_action(validation)To make the visual validation, open rviz and show topicsvalColorImageandvalDepthImage. Example is shown below.
4. Object coordinates with Realsense Camera d435i
It's possible to extract real-world 3D coordinates from the Realsense Camera d435i pixel coordinates and then convert them to the map frame. This code should be applicable to other Realsense cameras as well.
- To project a pixel into the real-world camera frame, uncomment the relevant section in the code:
bashrc
ld.add_action(realsense_camera)
And change the parameters according to the explanations provided is the launch file. Coordinates will be available as a Pose message on the choosen topic.
- To project a pixel into the real-world map frame, uncomment transformation node:
bashrc
ld.add_action(tf_camera_to_map)
Owner
- Name: Dzmitry Maladzenkau
- Login: maladzenkau
- Kind: user
- Company: RPTU (TU Kaiserslautern)
- Repositories: 2
- Profile: https://github.com/maladzenkau
M.Sc. in Automation and Control
Citation (CITATION.cff)
cff-version: 1.2.0
preferred-citation:
type: software
message: If you use this software, please cite it as below.
authors:
- family-names: Maladzenkau
given-names: Dzmitry
title: "deepstream_ros2 "
version: 1.0
date-released: 2024-24-03
license: BSD 3-Clause
url: "https://github.com/45kmh/deepstream_ros2"
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Dependencies
- setuptools *