dmabuf_transport is a package for zero-copy transport of ROS messages using Linux dma-buf file descriptors.
Dmabuf Transport provides a way to share data between different hardware accelerators and different ROS nodes with zero-copy.
When ROS nodes send data with supported types, they send dma-buf descriptors (fd) instead of the data itself.
It is built on ROS 2 Type Adaption, which allows us to define methods for serializing directly to the user-requested type and/or using that type in intra-process communication.
Dmabuf descriptors can be transported between multiple ROS nodes and are zero-copy accessible by multiple hardware accelerators, such as GPUs and DSPs.
Note
This package need Linux kernel 5.12+ and ROS Humble later version.
- Supported types
- Supported targets
- Installation
- Usage
- Build from source
- Contributing
- Contributors
- License
| QRB ROS Transport Type | ROS Interfaces |
|---|---|
| dmabuf_transport::type::Image | sensor_msgs::msg::Image |
| dmabuf_transport::type::PointCloud2 | sensor_msgs::msg::PointCloud2 |
| Development Hardware | Qualcomm Dragonwing™ RB3 Gen2 | Qualcomm Dragonwing™ IQ-9075 EVK |
|---|---|---|
| Hardware Overview |
Important
PREREQUISITES: The following steps need to be run on Qualcomm Ubuntu and ROS Jazzy.
Refer to Install Ubuntu on Qualcomm IoT Platforms and Install ROS Jazzy to set up your environment.
For Qualcomm Linux, please check out the Qualcomm Intelligent Robotics Product SDK documents.
Add Qualcomm IOT PPA for Ubuntu:
sudo add-apt-repository ppa:ubuntu-qcom-iot/qirp
sudo apt updateInstall Debian package:
sudo apt install ros-jazzy-dmabuf-transportThis section shows how to use dmabuf_transport in your projects, Here, we use dmabuf_transport::type::Image as an example.
Add the dependencies in your package.xml:
<depend>dmabuf_transport</depend>Use ament_cmake_auto to find dependencies in your CMakeLists.txt:
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()Using adapted types in your ROS node
#include "dmabuf_transport/type/image.hpp"
// Create message
auto msg = std::make_unique<dmabuf_transport::type::Image>();
msg->header = std_msgs::msg::Header();
msg->width = width;
msg->height = height;
msg->encoding = "rgb8";
// Allocate dmabuf for message
auto dmabuf = lib_mem_dmabuf::DmaBuffer::alloc(size, "/dev/dma_heap/system");
// ... set data to dmabuf
msg->dmabuf = dmabuf;
// Publish message
pub->publish(std::move(msg));Install dependencies:
sudo add-apt-repository ppa:ubuntu-qcom-iot/qirp
sudo apt update
sudo apt install \
ros-jazzy-ros-core \
ros-dev-tools \
ros-jazzy-sensor-msgs \
ros-jazzy-lib-mem-dmabuf \Download the source code and build it with colcon
source /opt/ros/jazzy/setup.bash
git clone https://github.com/qualcomm-qrb-ros/dmabuf_transport.git
colcon buildWe love community contributions! Get started by reading our CONTRIBUTING.md.
Feel free to create an issue for bug report, feature requests or any discussion💡.
Thanks to all our contributors who have helped make this project better!
penww |
jiaxshi |
quic-zhaoyuan |
Project is licensed under the BSD-3-Clause License. See LICENSE for the full license text.
