Skip to content

Commit

Permalink
Merge pull request #6 from NVIDIA-ISAAC-ROS/release-dp-2
Browse files Browse the repository at this point in the history
Isaac ROS 0.20.0 (DP2)
  • Loading branch information
hemalshahNV authored Oct 19, 2022
2 parents 2678112 + cf65e2e commit ca8be66
Show file tree
Hide file tree
Showing 333 changed files with 5,027 additions and 1,394 deletions.
42 changes: 28 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Overview

ROS2 Humble introduces new hardware-acceleration features, including type adaptation and type negotiation, that significantly increase performance for developers seeking to incorporate AI/machine learning and computer vision functionality into their ROS-based applications.
ROS2 Humble introduces new hardware-acceleration features, including type adaptation and type negotiation, that significantly increase performance for developers seeking to incorporate AI/machine learning and computer vision functionality into their ROS-based applications.

Type adaptation (REP-2007) is common for hardware accelerators, which require a different data format to deliver optimal performance. Type adaptation allows ROS nodes to work in a format better suited to the hardware. Processing pipelines can eliminate memory copies between the CPU and the memory accelerator using the adapted type. Unnecessary memory copies consume CPU compute, waste power, and slow down performance, especially as the image size increases.

Expand All @@ -14,8 +14,8 @@ Accelerating processing pipelines using type adaptation and negotiation makes th

The NVIDIA implementation of type adaption and negotiation are called NITROS (NVIDIA Isaac Transport for ROS). ROS processing pipelines made up of NITROS-based Isaac ROS hardware accelerated modules (a.k.a. GEMs or Isaac ROS nodes) can deliver promising performance and results.


## Table of Contents

- [Isaac ROS NITROS](#isaac-ros-nitros)
- [Overview](#overview)
- [Table of Contents](#table-of-contents)
Expand All @@ -33,44 +33,44 @@ The NVIDIA implementation of type adaption and negotiation are called NITROS (NV
- [Using NITROS-Accelerated Nodes in Existing Non-NITROS Graphs](#using-nitros-accelerated-nodes-in-existing-non-nitros-graphs)
- [Updates](#updates)


## Latest Update
Update 2022-08-31: Update to be compatible with JetPack 5.0.2

Update 2022-10-19: Minor updates and bugfixes

## Supported Platforms

This package is designed and tested to be compatible with ROS2 Humble running on [Jetson](https://developer.nvidia.com/embedded-computing) or an x86_64 system with an NVIDIA GPU.

> **Note**: Versions of ROS2 earlier than Humble are **not** supported. This package depends on specific ROS2 implementation features that were only introduced beginning with the Humble release.

| Platform | Hardware | Software | Notes |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Jetson | [Jetson Orin](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-orin/)<br/>[Jetson Xavier](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-agx-xavier/) | [JetPack 5.0.2](https://developer.nvidia.com/embedded/jetpack) | For best performance, ensure that [power settings](https://docs.nvidia.com/jetson/archives/r34.1/DeveloperGuide/text/SD/PlatformPowerAndPerformance.html) are configured appropriately. |
| x86_64 | NVIDIA GPU | [Ubuntu 20.04+](https://releases.ubuntu.com/20.04/) <br> [CUDA 11.6.1+](https://developer.nvidia.com/cuda-downloads) |

| Platform | Hardware | Software | Notes |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Jetson | [Jetson Orin](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-orin/) <br> [Jetson Xavier](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-agx-xavier/) | [JetPack 5.0.2](https://developer.nvidia.com/embedded/jetpack) | For best performance, ensure that [power settings](https://docs.nvidia.com/jetson/archives/r34.1/DeveloperGuide/text/SD/PlatformPowerAndPerformance.html) are configured appropriately. |
| x86_64 | NVIDIA GPU | [Ubuntu 20.04+](https://releases.ubuntu.com/20.04/) <br> [CUDA 11.6.1+](https://developer.nvidia.com/cuda-downloads) |

### Docker

To simplify development, we strongly recommend leveraging the Isaac ROS Dev Docker images by following [these steps](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common/blob/main/docs/dev-env-setup.md). This will streamline your development environment setup with the correct versions of dependencies on both Jetson and x86_64 platforms.

> **Note:** All Isaac ROS Quickstarts, tutorials, and examples have been designed with the Isaac ROS Docker images as a prerequisite.

## System Assumptions

The design of NITROS makes the following assumptions of the ROS2 applications:

- To leverage the benefit of zero-copy in NITROS, all NITROS-accelerated nodes must run in the same process.
- For a given topic in which type negotiation takes place, there can only be one negotiating publisher.
- For a NITROS-accelerated node, received-frame IDs are assumed to be constant throughout the runtime.


## NITROS-Accelerated Nodes

Most Isaac ROS GEMs have been updated to be NITROS-accelerated.
The acceleration is in effect between NITROS-accelerated nodes when two or more of them are connected next to each other. In such a case, NITROS-accelerated nodes can discover each other through type negotiation and leverage type adaptation for data transmission automatically at runtime.

NITROS-accelerated nodes are also compatible with non-NITROS nodes: A NITROS-accelerated node can be used together with any existing, non-NITROS ROS2 node, and it will function like a typical ROS2 node.


## NITROS Data Types

NITROS supports transporting various common data types with zero-copy in its own NITROS types.
Each NITROS type is one-to-one-mapped to a ROS message type, which ensures compatibility with existing tools, workflows, and codebases. A non-NITROS node supporting the corresponding ROS message types can publish data to or subscribe to data from a NITROS-accelerated node that supports the corresponding NITROS types.

Expand All @@ -83,20 +83,23 @@ Each NITROS type is one-to-one-mapped to a ROS message type, which ensures compa
| NitrosPointCloud | [sensor_msgs/PointCloud2](https://github.com/ros2/common_interfaces/blob/humble/sensor_msgs/msg/PointCloud2.msg) |
| NitrosAprilTagDetectionArray | [isaac_ros_apriltag_interfaces/AprilTagDetectionArray](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_common/blob/main/isaac_ros_apriltag_interfaces/msg/AprilTagDetectionArray.msg) |


## NITROS-Accelerated Graphs

ROS2 graphs built with NITROS-accelerated nodes yield promising performance.
The following highlights three graphs that are created and tested fully with Isaac ROS NITROS-accelerated nodes. For more detailed performance outcomes, visit [this page](https://github.com/NVIDIA-ISAAC-ROS/.github/blob/main/profile/performance-summary.md).

### AprilTag Detection Graph

The AprilTag detection graph uses the NVIDIA GPU-accelerated AprilTags library to detect AprilTags in images and publishes their poses, IDs, and additional metadata. Visit [Isaac ROS Apriltag](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_apriltag) for more details.

```mermaid
graph LR;
argus_node("ArgusMonoNode (Raw Image)") --> rectify_node("RectifyNode (Rectified Image)");
rectify_node --> apriltag_node("AprilTagNode (AprilTag Detection)");
```

### Stereo Disparity Graph

The stereo disparity graph performs DNN-based stereo depth estimation via continuous disparity prediction. It produces a depth image or point cloud of the scene that can be used for robot navigation. Visit [Isaac ROS DNN Stereo Disparity](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_dnn_stereo_disparity) for more details.

```mermaid
Expand All @@ -109,7 +112,9 @@ graph LR;
```

### Image Segmentation Graph

The image segmentation graph uses a deep learning U-Net model to generate an image mask segmenting out objects of interest. Visit [Isaac ROS Image Segmentation](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_image_segmentation) for more details.

```mermaid
graph LR;
argus_node("ArgusMonoNode (Raw Image)") --> rectify_node("RectifyNode (Rectified Image)");
Expand All @@ -120,6 +125,7 @@ graph LR;
```

## Creating Graphs with NITROS-Accelerated Nodes

Besides the above fully tested graphs, it is also possible to construct your own graphs with any of the Isaac ROS NITROS-accelerated nodes to enjoy the performance benefit of NITROS.

The key to successfully constructing a NITROS-accelerated graph is to ensure that all NITROS-accelerated nodes start in the same process (which permits zero-copy between nodes).
Expand Down Expand Up @@ -151,7 +157,9 @@ To do so, follow the steps below to create your own launch file:
],
)
```

3. Place the created nodes in `ComposableNodeContainer`:

```python
nitros_container = ComposableNodeContainer(
name='nitros_container',
Expand All @@ -160,14 +168,17 @@ To do so, follow the steps below to create your own launch file:
composable_node_descriptions=[argus_mono_node, rectify_node],
)
```

> **Note:** It is crucial that the `executable` field is set to be `component_container_mt` so that the created nodes can be started and communicated correctly within the same process.

4. Finally, place the created composable node container in `LaunchDescription` to finalize the launch script.

```python
return launch.LaunchDescription([nitros_container])
```

## Using NITROS-Accelerated Nodes in Existing Non-NITROS Graphs

As stated in [NITROS-Accelerated Nodes](#nitros-accelerated-nodes), it is also possible to use any NITROS-accelerated nodes in an existing ROS2 graph, as all Isaac ROS nodes are compatible with non-NITROS ROS2 nodes.

Follow these steps to integrate one or more NITROS-accelerated nodes into your graph:
Expand All @@ -177,15 +188,18 @@ Follow these steps to integrate one or more NITROS-accelerated nodes into your g
2. Place the created composable node container in `LaunchDescription` together with your own, regular ROS2 node or composable node container declarations.

Now the NITROS-accelerated nodes will be able to choose the best compatible way to communicate with their adjacent nodes.

- When connected to non-NITROS nodes, NITROS-accelerated nodes will function like regular ROS2 nodes.
- When connected to NITROS-accelerated nodes, zero-copy data transmission via type adaptation and type negotiation will be adopted.

Please visit the link below for an example graph that consists of NITROS-accelerated and non-NITROS nodes:

- [NITROS-accelerated AprilTag node + non-NITROS USB camera node](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_apriltag/blob/main/docs/tutorial-usb-cam.md)

## Updates

| Date | Changes |
| ---------- | ------------------------------------------ |
| 2022-10-19 | Minor updates and bugfixes |
| 2022-08-31 | Update to be compatible with JetPack 5.0.2 |
| 2022-06-30 | Initial release |
43 changes: 26 additions & 17 deletions isaac_ros_nitros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ message( STATUS "Architecture: ${ARCHITECTURE}" )
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

# Elbrus (register path and install)
ament_index_register_resource(elbrus CONTENT share/${PROJECT_NAME}/elbrus)
install(DIRECTORY lib/elbrus
DESTINATION "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}")

# Eigen3
find_package(Eigen3 3.3 REQUIRED NO_MODULE)


# GXF
include_directories(gxf/include)
include_directories(gxf/include/third_party)
Expand All @@ -45,17 +48,18 @@ add_library(gxf_std SHARED IMPORTED)
add_library(gxf_multimedia SHARED IMPORTED) # for NitrosImage
add_library(optimizer SHARED IMPORTED)
if( ${ARCHITECTURE} STREQUAL "x86_64" )
set_property(TARGET gxf PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_x86_64/core/libgxf_core.so)
set_property(TARGET gxf_std PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_x86_64/std/libgxf_std.so)
set_property(TARGET gxf PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_x86_64_cuda_11_7/core/libgxf_core.so)
set_property(TARGET gxf_std PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_x86_64_cuda_11_7/std/libgxf_std.so)
set_property(
TARGET gxf_multimedia PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_x86_64/multimedia/libgxf_multimedia.so)
set_property(TARGET optimizer PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_x86_64/libgxf_optimizer.so)
TARGET gxf_multimedia
PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_x86_64_cuda_11_7/multimedia/libgxf_multimedia.so)
set_property(TARGET optimizer PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_x86_64_cuda_11_7/libgxf_optimizer.so)
elseif( ${ARCHITECTURE} STREQUAL "aarch64" )
set_property(TARGET gxf PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_jetpack50/core/libgxf_core.so)
set_property(TARGET gxf_std PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_jetpack50/std/libgxf_std.so)
set_property(TARGET gxf PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_jetpack502/core/libgxf_core.so)
set_property(TARGET gxf_std PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_jetpack502/std/libgxf_std.so)
set_property(
TARGET gxf_multimedia PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_jetpack50/multimedia/libgxf_multimedia.so)
set_property(TARGET optimizer PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_jetpack50/libgxf_optimizer.so)
TARGET gxf_multimedia PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_jetpack502/multimedia/libgxf_multimedia.so)
set_property(TARGET optimizer PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/gxf/lib/gxf_jetpack502/libgxf_optimizer.so)
endif()


Expand All @@ -70,6 +74,8 @@ if(USE_NVTX)
link_libraries("nvToolsExt")
endif()

# Find VPI dependency
find_package(vpi REQUIRED)

# NitrosNode
ament_auto_add_library(isaac_ros_nitros SHARED
Expand All @@ -80,11 +86,12 @@ ament_auto_add_library(isaac_ros_nitros SHARED
src/types/nitros_int64.cpp
src/nitros_publisher.cpp
src/nitros_subscriber.cpp
src/nitros_publisher_subscriber_group.cpp)
src/nitros_publisher_subscriber_group.cpp
src/utils/vpi_utilities.cpp)
target_compile_definitions(isaac_ros_nitros
PRIVATE "COMPOSITION_BUILDING_DLL"
)
target_link_libraries(isaac_ros_nitros gxf gxf_multimedia optimizer Eigen3::Eigen)
target_link_libraries(isaac_ros_nitros gxf gxf_multimedia optimizer Eigen3::Eigen vpi)
# For the NitrosNode test node
rclcpp_components_register_node(isaac_ros_nitros
PLUGIN "nvidia::isaac_ros::nitros::NitrosNode"
Expand Down Expand Up @@ -123,13 +130,15 @@ install(
# Install extensions directory
# Also copying libgxf_core.so to the lib directory for exposing it to other packages
if( ${ARCHITECTURE} STREQUAL "x86_64" )
install(DIRECTORY gxf/lib/gxf_x86_64/ DESTINATION share/${PROJECT_NAME}/gxf)
install(FILES gxf/lib/gxf_x86_64/multimedia/libgxf_multimedia.so DESTINATION lib/)
install(FILES gxf/lib/gxf_x86_64/cuda/libgxf_cuda.so DESTINATION lib/)
install(DIRECTORY gxf/lib/gxf_x86_64_cuda_11_7/ DESTINATION share/${PROJECT_NAME}/gxf)
install(FILES gxf/lib/gxf_x86_64_cuda_11_7/core/libgxf_core.so DESTINATION lib/)
install(FILES gxf/lib/gxf_x86_64_cuda_11_7/multimedia/libgxf_multimedia.so DESTINATION lib/)
install(FILES gxf/lib/gxf_x86_64_cuda_11_7/cuda/libgxf_cuda.so DESTINATION lib/)
elseif( ${ARCHITECTURE} STREQUAL "aarch64" )
install(DIRECTORY gxf/lib/gxf_jetpack50/ DESTINATION share/${PROJECT_NAME}/gxf)
install(FILES gxf/lib/gxf_jetpack50/multimedia/libgxf_multimedia.so DESTINATION lib/)
install(FILES gxf/lib/gxf_jetpack50/cuda/libgxf_cuda.so DESTINATION lib/)
install(DIRECTORY gxf/lib/gxf_jetpack502/ DESTINATION share/${PROJECT_NAME}/gxf)
install(FILES gxf/lib/gxf_jetpack502/core/libgxf_core.so DESTINATION lib/)
install(FILES gxf/lib/gxf_jetpack502/multimedia/libgxf_multimedia.so DESTINATION lib/)
install(FILES gxf/lib/gxf_jetpack502/cuda/libgxf_cuda.so DESTINATION lib/)
endif()
set_target_properties(isaac_ros_nitros PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
set_target_properties(isaac_ros_nitros PROPERTIES INSTALL_RPATH "$ORIGIN/../share/${PROJECT_NAME}/gxf/core")
Expand Down
29 changes: 15 additions & 14 deletions isaac_ros_nitros/gxf/include/common/any.hpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/*
Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
* SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef NVIDIA_COMMON_ANY_HPP_
#define NVIDIA_COMMON_ANY_HPP_

Expand Down
Loading

0 comments on commit ca8be66

Please sign in to comment.