A composable container for Adaptive ROS 2 Node computations. Select between FPGA, CPU or GPU at run-time.

adaptive_component

A composable stateless container for Adaptive ROS 2 Node computations. Select between FPGA, CPU or GPU at run-time.

Nodes using hardware acceleration are able to perform computations faster relying on FPGAs or GPUs, improving performance. Adaptive ROS 2 Nodes leverage hardware acceleration at run-time, allowing robotics engineers to select which computational resource the Node uses on-the-go, giving roboticists a finer-grained control over the resources their computional graphs use in the underlying hardware.

This ROS 2 package provides a composable stateless container for Adaptive ROS 2 Node computations: adaptive_component. It allows building Nodes that can select between FPGA, CPU or GPU, at run-time.

Technically, it's a ROS 2 Node1 subclass programmed as a Component2 and including its own single threaded executor to build adaptive computations. Adaptive ROS 2 Nodes can then be built easily and are able to perform computations in the CPU, the FPGA or the GPU. Adaptive behavior is controlled through the adaptive ROS 2 parameter, with the following values allowed:

  • 0: Hardware::CPU
  • 1: Hardware::FPGA
  • 2: Hardware::GPU

adaptive_component is stateless by default, if you need your Adaptive Nodes to be stateful, feel free to inherit from composition::AdaptiveComponent and create your own stateful subclasses3.

How does it work?

asciicast

using NodeCPU = composition::DoubleVaddComponent;
using NodeFPGA = composition::DoubleVaddComponentFPGA;

rclcpp::NodeOptions options;

// Create an executor
rclcpp::executors::MultiThreadedExecutor exec;

// Create an adaptive ROS 2 Node using "components", the resulting
// Node is also programed as a "component", retaining composability
auto adaptive_node = std::make_shared<composition::AdaptiveComponent>(
      "doublevadd_publisher_adaptive",        
      options,                                
                                              // CPU
      std::make_shared<NodeCPU>("_doublevadd_publisher_adaptive_cpu", options),
                                              // FPGA
      std::make_shared<NodeFPGA>("_doublevadd_publisher_adaptive_fpga", options),
                                              // GPU
      nullptr);

exec.add_node(adaptive_node);  // fill up the executor
exec.spin();  // spin the executor

Then, dynamically, one could switch from CPU to FPGA by setting the adaptive parameter in the /doublevadd_publisher_adaptive Node:

  • To run in the CPU: ros2 param set /doublevadd_publisher_adaptive adaptive 0
  • To run in the FPGA: ros2 param set /doublevadd_publisher_adaptive adaptive 1

Why should I care as a ROS package maintainer?

The integration of hardware acceleration into ROS often requires rewriting parts of the Node computations to further exploit parallelism. These changes often conflict with CPU-centric architectures and as a maintainer, you're likely to care for "not breaking" CPU-centric implementations.

To consistently integrate hardware acceleration, avoid unnecessary forks and discourage package fragmentation, composition::AdaptiveComponent allows to extend ROS 2 CPU-centric Nodes4 with their computational counterparts separating concerns at build-time. From a package-maintenance perspective, each Node (across computation options) is written in a separated file and as a separated Component. These can live either within the same package, or in totally different (disconnected) ones. adaptive_component takes care of putting them together at launch time and no dependency with the package is required at build-time5.

From an execution perspective, developers can easily create Adaptive ROS 2 Nodes and compose them together as desired at launch-time, with capabilities to adaptively switch between compute alternatives at run-time.

Some examples

Examples of using adaptive_component:

Conventions and recommendations

The following conventions and recommendations are meant to facilitate the integration of hardware acceleration in existing ROS packages

  1. Component-oriented: AdaptiveComponent is built as a component and should be used as such to maintain composability of Nodes.
  2. Naming: The Adaptive Node should be suffix with _adaptive to identify in the computational graph which Nodes have adaptive capabilities and which do not.
  3. Hidden sub-Nodes: Adaptive Node components (compute-specific ones e.g. CPU's or FPGA's) should be named with a hyphen (_) as a prefix, which will make them hidden Nodes by default.
  4. File names: When possible, source code file names should adhere to the following guidelines:
    • CPU-based computational Nodes can optionally add the _cpu suffix
    • FPGA-based computational Nodes shall add the _fpga suffix
    • GPU-based computational Nodes shall add the _gpu suffix

Quality Declaration

This package claims to be in the Quality Level 4 category, see the Quality Declaration for more details.

Footnotes

  1. A Node is a process that performs computations. ROS 2 is designed to be modular at a fine-grained scale; a robot control system usually comprises many nodes. Nodes execute arbitrary logic that contribute to the overall robotics behavior.

  2. A ROS 2 Component is a Node compiled into a shared library which is then loaded at runtime by a container process. This offers roboticists additional flexibility while building their computational graphs, making the layout process a deploy-time decision. A Component is commonly a subclass of rclcpp::Node. To maintain flexibility and modularity, Components shouldn’t perform any long running or blocking tasks in their constructors. Instead, they can use timers to get periodic notifications and use callbacks for publishers, subscribers, servers, or clients.

  3. See this example (ROS 2 component).

  4. Assumes Nodes are written as components, but it they are not, it's a great chance to do so ;).

  5. Though adaptive_component allows to disconnect nodes across packages, to facilitate source code maintenance across CPU-centric implementations and counterparts, it should be encouraged to keep the source code within the same ROS 2 package with suffixes indicating of the compute substrate (e.g. _fpga.cpp, etc.). This will facilitate maintaining implementations across different compute substrates, avoid versioning issues and fragmentation issues.

Owner
ROS 2 Hardware Acceleration Working Group
Drive creation, maintenance and testing of acceleration kernels for ROS 2 and Gazebo.
ROS 2 Hardware Acceleration Working Group
Comments
  • Question: Sharing of Parameters

    Question: Sharing of Parameters

    If I understood correctly, this adaptive component is a way to expose an interface to swap between node components dynamically.

    What is the intended interaction with the parameter system for the implemented nodes for the different architectures? Are parameters meant to be bound to the adaptive component (essentially the node manager), or is the intention to have the parameters bound to the architecture specific nodes instead?

  • FEATURE: create launch AdaptiveNode class to configure sub-components at launch-time

    FEATURE: create launch AdaptiveNode class to configure sub-components at launch-time

    consider subclassing ComposableNode and creating an AdaptiveNode class that allows for launch-time remapping of names, topics, etc.

    See https://github.com/ros-acceleration/acceleration_examples/blob/main/image_proc_adaptive/launch/image_proc_adaptive.launch.py for a use case example.

  • Add extra ament exports

    Add extra ament exports

    I'm not too sure if this is necessary, but it seems to be recommended practice

    • ament_export_include_directories adds the include directory to the ament index for this package
    • ament_export_libraries does the same, but for the library target

    I've also updated the name references to adaptive_component to the project name.

  • Release Process! (RELEASED! PENDING SYNC) :green_circle:

    Release Process! (RELEASED! PENDING SYNC) :green_circle:

    [STATUS: PENDING SYNC PR UPDATE]

    Buildfarm Status

    • Build Status dev (ubuntu_jammy_amd64)
    • Build Status doc (ubuntu_jammy_amd64)
    • Build Status src (rhel_8)
    • Build Status src (ubuntu_jammy)
    • Build Status bin (ubuntu_jammy_amd64)
    • Build Status bin (rhel_8_x86_64)
    • Build Status bin (ubuntu_jammy_arm64)

    Description

    This issue tracks the status for the release of this repository into rosdistro and making it available for installation as .deb via the ROS 2 repositories.

    It will detail the steps that need to be taken, and what recommended changes are good to have.

    Release Process

    Steps

    • [x] Add LICENSE file
    • [x] Reflect all system dependencies in package.xml (e.g. rclcpp_components)
      • https://github.com/ros-acceleration/adaptive_component/pull/5 .
    • [x] Create rolling and humble branches
    • [x] Create a new release tag corresponding to the version specified in package.xml
    • [x] Create release repo
      • Pending https://github.com/ros2-gbp/ros2-gbp-github-org/pull/40
      • Up: https://github.com/ros2-gbp/adaptive_component-release
    • [x] Do bloom release
      • [x] bloom should PR rosdistro, if not, manually create a PR
      • https://github.com/ros/rosdistro/pull/32756
      • https://github.com/ros/rosdistro/pull/32774
    • [x] rosdistro team to review package and merge PR (1-2 days, 1 month to get apt installable)
      • https://github.com/ros/rosdistro/pull/32774
    • [ ] Monitor build and release status on repo page and buildfarm

    Recommendations

    • [x] RELYING ON DOCS INSTEAD: Implement parameter sharing functionality https://github.com/ros-acceleration/adaptive_component/issues/2
    • [x] Export targets
      • https://github.com/ros-acceleration/adaptive_component/pull/6
  • Question: Multiple Nodes of a Single Architecture

    Question: Multiple Nodes of a Single Architecture

    Is there a case where a user might want to have multiple sub-nodes of a similar architecture? (e.g. two GPUs, swapping between them.)

    It doesn't look like this adaptive component is able to handle that case, since it manages swapping of architectures only. Is this intended?

This repository uses a ROS node to subscribe to camera (hikvision) and lidar (livox) data. After the node merges the data, it publishes the colored point cloud and displays it in rviz.
This repository uses a ROS node to subscribe to camera (hikvision) and lidar (livox) data. After the node merges the data, it publishes the colored point cloud and displays it in rviz.

fusion-lidar-camera-ROS 一、介绍 本仓库是一个ROS工作空间,其中ws_fusion_camera/src有一个工具包color_pc ws_fusion_camera │ README.md │ └───src │ └───package: c

Dec 7, 2022
A Geometry Dash mod that lets you select the screen to run the game on

Screen Selector A mod that lets you select the screen to run Geometry Dash on Fully compatible with Mega Hack v6 (except the "Fullscreen" and "Borderl

Jun 3, 2022
A run-time C++ library for working with units of measurement and conversions between them and with string representations of units and measurements

Units What's new Some of the CMake target names have changed in the latest release, please update builds appropriately Documentation A library that pr

Dec 14, 2022
Raspberry Pi Pico (RP2040) and Micro-ROS (ROS 2) Integration

The Pico is an amazing microcontroller and I couldn't wait for ROS 2 support or Arduino Core, so here is my approach. Once the Arduino Core for RP2040 is out it will be easier to use micro_ros_arduino.

Jun 19, 2022
ROS package to calibrate the extrinsic parameters between LiDAR and Camera.
ROS package to calibrate the extrinsic parameters between LiDAR and Camera.

lidar_camera_calibrator lidar_camera_calibrator is a semi-automatic, high-precision, feature-based camera and LIDAR extrinsic calibration tool. In gen

Dec 23, 2022
Love 6's Regular Expression Engine. Support Concat/Select/Closure Basic function. Hope u can enjoy this tiny engine :)
Love 6's Regular Expression Engine. Support Concat/Select/Closure Basic function. Hope u can enjoy this tiny engine :)

Regex_Engine Love 6's Blog Website: https://love6.blog.csdn.net/ Love 6's Regular Expression Engine Hope u can love my tiny regex engine :) maybe a fe

May 24, 2022
around — adaptive rounding operation

around — adaptive rounding operation Attempts to perform nice rounding of a floating point number, like a human would do. Usage: around.h #include "ar

Oct 21, 2022
Adaptive Runtime AUTOSAR Linux Simulator

Adaptive-AUTOSAR Adaptive AUTOSAR is a simulated Adaptive Platform enviroment over Linux defined by AUTOSAR. The goal of this project is to implement

Jan 4, 2023
BAAF-Net - Semantic Segmentation for Real Point Cloud Scenes via Bilateral Augmentation and Adaptive Fusion (CVPR 2021)
BAAF-Net - Semantic Segmentation for Real Point Cloud Scenes via Bilateral Augmentation and Adaptive Fusion (CVPR 2021)

Semantic Segmentation for Real Point Cloud Scenes via Bilateral Augmentation and Adaptive Fusion (CVPR 2021) This repository is for BAAF-Net introduce

Dec 29, 2022
Patches & Script for AOSP to run on Xuantie RISC-V CPU
Patches & Script for AOSP to run on Xuantie RISC-V CPU

Overview Graph 1. AOSP on RISC-V 64(XuanTie 910) Video for Android on XuanTie910 News and related resources Chip ICE is a XuanTie C910 based high perf

Jan 2, 2023
this package help you to give glassomorphic+ neomrphic both effects to a container (at a time).
this package help you to give glassomorphic+ neomrphic both effects to a container (at a time).

duomorphsim this package help you to give glassomorphic+ neomrphic both effects to a container (at a time). Usage DuoMorphicCard need four argument wh

Aug 23, 2021
Performance Evaluation of a Parallel Image Enhancement Technique for Dark Images on Multithreaded CPU and GPU Architectures
 Performance Evaluation of a Parallel Image Enhancement Technique for Dark Images on Multithreaded CPU and GPU Architectures

Performance Evaluation of a Parallel Image Enhancement Technique for Dark Images on Multithreaded CPU and GPU Architectures Image processing is a rese

Nov 4, 2021
Get CPU & GPU temperatures and fan and battery statistics from your Mac.

macOS Hardware Stats Get CPU & GPU temperatures and fan and battery statistics from your Mac. This simple script will output a JSON array containing h

May 5, 2022
Physically-based GPU and CPU ray-tracer emerging on a surface
Physically-based GPU and CPU ray-tracer emerging on a surface

etx-tracer Physically-based GPU and CPU ray-tracer emerging on a surface. Features Vertex Connection and Merging algorithm (CPU and GPU); Full-spectra

Dec 14, 2022
An efficient, composable design pattern for range processing
An efficient, composable design pattern for range processing

Transrangers An efficient, composable design pattern for range processing. Intro Pull-based approach Push-based approach Transrangers Performance Tran

Nov 10, 2022
Load bitstream to AG1K series FPGA using CH552
Load bitstream to AG1K series FPGA using CH552

ch552-ag1k-msd Load bitstream to AG1K series FPGA using CH552 AG1K does not have a built-in data flash; This design only simulate a USB mass storage d

Dec 14, 2022
Streaming video over USB 3.0 using MAX10 FPGA and CYUSB3014 synchronous slave mode.
Streaming video over USB 3.0 using MAX10 FPGA and CYUSB3014 synchronous slave mode.

DECA_USB3_Cam Streaming video over USB 3.0 using MAX10 FPGA and CYUSB3014 synchronous slave mode. Video: Block diagram _______

Apr 18, 2022
An FPGA accelerator for general-purpose Sparse-Matrix Dense-Matrix Multiplication (SpMM).

Sextans Sextans is an accelerator for general-purpose Sparse-Matrix Dense-Matrix Multiplication (SpMM). One exciting feature is that we only need to p

Dec 29, 2022
Simple library to interface with Hitachi-compatible character LCDs for the Sipeed Tang Nano 4K Gowin FPGA board.

Simple library to interface with Hitachi-compatible character LCDs for the Sipeed Tang Nano 4K Gowin FPGA board.

Dec 14, 2022