From 2d625a12215ac2cbd35c1ea4bc54cf7a6e877560 Mon Sep 17 00:00:00 2001 From: Peng Wang Date: Fri, 3 Jan 2025 09:20:26 +0000 Subject: [PATCH] README: Move content to QRB ROS document Signed-off-by: Peng Wang --- .clang-format | 62 ------------- .github/ISSUE_TEMPLATE.md | 40 --------- .github/PULL_REQUEST_TEMPLATE.yml | 0 .github/workflows/basic-build.yml | 37 -------- README.md | 113 ++++-------------------- include/dmabuf_transport/type/image.hpp | 1 - 6 files changed, 15 insertions(+), 238 deletions(-) delete mode 100644 .clang-format delete mode 100644 .github/ISSUE_TEMPLATE.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE.yml delete mode 100644 .github/workflows/basic-build.yml diff --git a/.clang-format b/.clang-format deleted file mode 100644 index 717dcb0..0000000 --- a/.clang-format +++ /dev/null @@ -1,62 +0,0 @@ -BasedOnStyle: "Google" ---- -Language: Cpp -AccessModifierOffset: -2 -ConstructorInitializerIndentWidth: 2 -AlignAfterOpenBracket: "DontAlign" -AlignEscapedNewlinesLeft: false -AlignTrailingComments: true -AllowAllParametersOfDeclarationOnNextLine: false -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -AllowShortFunctionsOnASingleLine: "Inline" -AlwaysBreakTemplateDeclarations: true -AlwaysBreakBeforeMultilineStrings: true -BreakBeforeBinaryOperators: false -BreakBeforeTernaryOperators: false -BreakConstructorInitializersBeforeComma: true -BinPackParameters: false -ColumnLimit: 100 -ConstructorInitializerAllOnOneLineOrOnePerLine: true -DerivePointerBinding: false -PointerBindsToType: true -ExperimentalAutoDetectBinPacking: false -IndentCaseLabels: true -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: "None" -ObjCSpaceBeforeProtocolList: true -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 60 -PenaltyBreakString: 1 -PenaltyBreakFirstLessLess: 1000 -PenaltyExcessCharacter: 1000 -PenaltyReturnTypeOnItsOwnLine: 90 -SpacesBeforeTrailingComments: 2 -Cpp11BracedListStyle: false -Standard: "Auto" -IndentWidth: 2 -TabWidth: 2 -UseTab: "Never" -IndentFunctionDeclarationAfterType: false -SpacesInParentheses: false -SpacesInAngles: false -SpaceInEmptyParentheses: false -SpacesInCStyleCastParentheses: false -SpaceAfterControlStatementKeyword: true -SpaceBeforeAssignmentOperators: true -ContinuationIndentWidth: 4 -SortIncludes: true -SpaceAfterCStyleCast: false -BreakBeforeBraces: "Custom" -BraceWrapping: - AfterClass: true - AfterControlStatement: false - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterStruct: true - AfterUnion: true - BeforeCatch: false - BeforeElse: false - IndentBraces: false -PointerAlignment: Middle diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 3cfc293..0000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,40 +0,0 @@ -## Bug report - -**Required Info:** - -- Operating System: - - -- Hardware Information: - - -- Installation type: - - -- Version or commit hash: - - -- DDS implementation: - - -- Client library (if applicable): - - - -#### Steps to reproduce issue - -``` - -``` - -#### Expected behavior - -#### Actual behavior - -#### Additional information - - ----- -## Feature request - -#### Feature description - - -#### Implementation considerations - \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.yml b/.github/PULL_REQUEST_TEMPLATE.yml deleted file mode 100644 index e69de29..0000000 diff --git a/.github/workflows/basic-build.yml b/.github/workflows/basic-build.yml deleted file mode 100644 index c7ce58f..0000000 --- a/.github/workflows/basic-build.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Basic Build Workflow - -on: - push: - branches: [rolling] - pull_request: - types: [opened, reopened, synchronize] - -jobs: - build-rolling: - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - container: - image: osrf/ros2:testing - steps: - - name: Checkout repo - uses: actions/checkout@v2 - - name: Create Workspace - run: | - mkdir src_tmp - mv `find -maxdepth 1 -not -name . -not -name src_tmp` src_tmp/ - mv src_tmp/ src/ - - name: Install Prerequisites - run: | - bash -c 'source /opt/ros/$ROS_DISTRO/setup.bash; \ - apt-get update && apt-get upgrade -y && rosdep update; \ - rosdep install --from-paths src --ignore-src -y' - - name: Build Workspace - run: | - bash -c 'source /opt/ros/$ROS_DISTRO/setup.bash; \ - colcon build' - - name: Run Tests - run: | - bash -c 'source /opt/ros/$ROS_DISTRO/setup.bash; \ - colcon test; \ - colcon test-result --verbose' diff --git a/README.md b/README.md index 2a993b6..faa329f 100644 --- a/README.md +++ b/README.md @@ -4,118 +4,35 @@ dmabuf_transport is a package for zero-copy transport ROS message with Linux dma ## Overview -[Dmabuf Transport](https://github.com/quic-qrb-ros/dmabuf_transport) provides a way to share data between different hardware accelerators and different ROS nodes with zero-copy. +[Dmabuf Transport](https://github.com/quic-qrb-ros/dmabuf_transport) provides a way to share data between different hardware accelerators and different ROS nodes with zero-copy. It is built on ROS 2 [Type Adaption](https://ros.org/reps/rep-2007.html). It allows us to define methods for serializing directly to the user requested type, and/or using that type in intra-process communication without ever converting it. We can define our adapted types with Linux dma-buf, and send dma-buf descriptor with ROS. Then use [ROS Composition](https://docs.ros.org/en/rolling/Tutorials/Intermediate/Composition.html) to confirm ROS nodes running in a single process, it enables zero-copy over the pipeline. -## System Requirements +> This package need Linux kernel 5.12+ and ROS Humble later version. -- Linux kernel version 5.12 and later, for kernel dma-buf support. -- ROS 2 Humble and later, for type adaption support. +## Documentation -## QuickStart +Please refer to the [Dmabuf Transport](https://quic-qrb-ros.github.io/main/packages/qrb_ros_transport/dmabuf_transport.html) for more documents. +- [Overview](https://quic-qrb-ros.github.io/main/packages/qrb_ros_transport/dmabuf_transport.html#overview) +- [Quickstart](https://quic-qrb-ros.github.io/main/packages/qrb_ros_transport/dmabuf_transport.html#quickstart) +- [Updates](https://quic-qrb-ros.github.io/main/packages/qrb_ros_transport/dmabuf_transport.html#updates) -## Code Sync and Build +## Contributing -Currently, we only support build with QCLINUX SDK. +We would love to have you as a part of the QRB ROS community. Whether you are helping us fix bugs, proposing new features, improving our documentation, or spreading the word, please refer to our [contribution guidelines](./CONTRIBUTING.md) and [code of conduct](./CODE_OF_CONDUCT.md). -1. Setup QCLINUX SDK environments follow this document: [Set up the cross-compile environment](https://docs.qualcomm.com/bundle/publicresource/topics/80-65220-2/develop-your-first-application_6.html?product=1601111740013072&facet=Qualcomm%20Intelligent%20Robotics%20(QIRP)%20Product%20SDK&state=releasecandidate) +- Bug report: If you see an error message or encounter failures, please create a [bug report](../../issues) +- Feature Request: If you have an idea or if there is a capability that is missing and would make development easier and more robust, please submit a [feature request](../../issues) -2. Create `ros_ws` directory in `/qirp-sdk/` +## Authors - ```bash - mkdir -p /qirp-sdk/ros_ws - ``` +* **Peng Wang** - *Initial work* - [penww](https://github.com/penww) -3. Clone this repository and dependencies under `/qirp-sdk/ros_ws` +See also the list of [contributors](https://github.com/quic-qrb-ros/dmabuf_transport/graphs/contributors) who participated in this project. - ```bash - cd /qirp-sdk/ros_ws - git clone https://github.com/quic-qrb-ros/lib_mem_dmabuf.git - git clone https://github.com/quic-qrb-ros/dmabuf_transport.git - ``` - -4. Build projects - - ```bash - export AMENT_PREFIX_PATH="${OECORE_TARGET_SYSROOT}/usr;${OECORE_NATIVE_SYSROOT}/usr" - export PYTHONPATH=${PYTHONPATH}:${OECORE_TARGET_SYSROOT}/usr/lib/python3.10/site-packages - - colcon build --merge-install --cmake-args \ - -DPython3_ROOT_DIR=${OECORE_TARGET_SYSROOT}/usr \ - -DPython3_NumPy_INCLUDE_DIR=${OECORE_TARGET_SYSROOT}/usr/lib/python3.10/site-packages/numpy/core/include \ - -DPYTHON_SOABI=cpython-310-aarch64-linux-gnu -DCMAKE_STAGING_PREFIX=$(pwd)/install \ - -DCMAKE_PREFIX_PATH=$(pwd)/install/share \ - -DBUILD_TESTING=OFF - ``` -## Using dmabuf_transport in your project - -1. Add dependency in package.xml - - ```xml - dmabuf_transport - ``` - -2. Add dependency in CMakeLists.txt - - ```cmake - find_package(dmabuf_transport REQUIRED) - - ament_target_dependencies(${PROJECT_NAME} - # ... - dmabuf_transport - ) - ``` - -3. Zero-copy transport dmabuf_transport types - - ```c++ - #include "dmabuf_transport/type/image.hpp" - // create message - auto msg = std::make_unique(); - msg->header = std_msgs::msg::Header(); - // save message data to dmabuf - auto dmabuf = lib_mem_dmabuf::DmaBuffer::alloc(1024, "/dev/dma_heap/system"); - // ... set data - msg->dmabuf = dmabuf; - - // publish message - pub_->publish(std::move(msg)); - ``` - -- Check [test](./test/) directory to find more details. - -## Supported Types - -The following table lists current supported types: - -| Zero Copy Transport Type | ROS Interface | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| [dmabuf_transport::type::Image](./include/dmabuf_transport/type/image.hpp) | [sensor_msgs::msg::Image](https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/Image.msg) | -| [dmabuf_transport::type::PointCloud2](./include/dmabuf_transport/type/pointcloud2.hpp) | [sensor_msgs::msg::Imu](https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/PointCloud2.msg) | - -## Supported Platforms - -This package is designed and tested to be compatible with ROS 2 Humble running on Qualcom RB3 gen2. - -| Hardware | Software | -| ------------------------------------------------------------ | ----------------- | -| [Qualcomm RB3 gen2](https://www.qualcomm.com/developer/hardware/rb3-gen-2-development-kit) | LE.QCROBOTICS.1.0 | - -## Resources - -- [ROS 2 Type Adaption](https://ros.org/reps/rep-2007.html): ROS 2 new feature to implement zero copy transport. -- [Linux dma-buf](https://docs.kernel.org/driver-api/dma-buf.html): Linux kernel subsystem for sharing buffers for hardware (DMA) access across multiple device drivers and subsystems, and for synchronizing asynchronous hardware access -- [lib_mem_dmabuf](https://github.com/quic-qrb-ros/lib_mem_dmabuf): Library for access and interact with Linux DMA heaps. - -## Contributions - -Thanks for your interest in contributing to dmabuf_transport! Please read our [Contributions Page](CONTRIBUTING.md) for more information on contributing features or bug fixes. We look forward to your participation! ## License -dmabuf_transport is licensed under the BSD 3-clause "New" or "Revised" License. - -Check out the [LICENSE](LICENSE) for more details. +Project is licensed under the [BSD-3-clause License](https://spdx.org/licenses/BSD-3-Clause.html). See [LICENSE](./LICENSE) for the full license text. diff --git a/include/dmabuf_transport/type/image.hpp b/include/dmabuf_transport/type/image.hpp index e33a14e..44af1c3 100644 --- a/include/dmabuf_transport/type/image.hpp +++ b/include/dmabuf_transport/type/image.hpp @@ -43,7 +43,6 @@ struct rclcpp::TypeAdapterfd() <= 0) { RCLCPP_ERROR(rclcpp::get_logger("dmabuf_transport"), "image: dmabuf is null"); return;