Skip to content

Commit 4babe79

Browse files
committed
Isaac ROS 2.1.0
1 parent 2f8bff1 commit 4babe79

File tree

12 files changed

+476
-82
lines changed

12 files changed

+476
-82
lines changed

README.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ The graph under benchmark is measured multiple times, with calculated results in
3838
- [Explanation of the Results JSON Format](#explanation-of-the-results-json-format)
3939
- [Creating Custom Benchmark](#creating-custom-benchmark)
4040
- [Profiling](#profiling)
41+
- [Live Benchmark Mode](#live-benchmark-mode)
4142
- [Updates](#updates)
4243

4344
## Latest Update
4445

45-
Update 2023-04-05: Initial Release
46+
Update 2023-11-16: Add support for live benchmark mode
4647

4748
## Supported Platforms
4849

@@ -181,21 +182,21 @@ Included in the log is information on the host system on which results were meas
181182

182183
The following are the performance results measured with `ros2_benchmark` on `aarch64` and `x86_64` platforms, using ROS 2 Humble in March 2023. The table below also contains links to the packages for the nodes used in the benchmark and to the complete results JSON files.
183184

184-
| Node | Input Size | Intel NUC Corei7 11th Gen | AGX Orin (CPU only) |
185-
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
186-
| [AprilTag Node](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/scripts/apriltag_ros_apriltag_node.py) | 720p | [90.8 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/apriltag_ros_apriltag_node-nuc_4060ti.json)<br>11 ms | [56.3 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/apriltag_ros_apriltag_node-agx_orin.json)<br>18 ms |
187-
| [Rectify Node](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/scripts/image_proc_rectify_node.py) | 1080p | [539 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/image_proc_rectify_node-nuc_4060ti.json)<br>1.9 ms | [185 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/image_proc_rectify_node-agx_orin.json)<br>5.6 ms |
188-
| [H.264 Encoder Node<br>I-frame Support](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/scripts/image_transport_h264_decoder_node.py) | 1080p | [60.5 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/image_transport_h264_decoder_node-nuc_4060ti.json)<br>19 ms | [28.0 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/image_transport_h264_decoder_node-agx_orin.json)<br>37 ms |
189-
| [H.264 Encoder Node<br>P-frame Support](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/scripts/image_transport_h264_encoder_node.py) | 1080p | [43.4 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/image_transport_h264_encoder_node-nuc_4060ti.json)<br>24 ms | [10.2 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/image_transport_h264_encoder_node-agx_orin.json)<br>95 ms |
190-
| [Stereo Disparity Node](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/scripts/stereo_image_proc_node.py) | 1080p | [99.5 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/stereo_image_proc_node-nuc_4060ti.json)<br>6.4 ms | [66.5 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/stereo_image_proc_node-agx_orin.json)<br>15 ms |
185+
| Node | Input Size | Intel NUC Corei7 11th Gen | AGX Orin (CPU only) |
186+
| ------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- |
187+
| [AprilTag Node](scripts/apriltag_ros_apriltag_node.py) | 720p | [90.8 fps](results/apriltag_ros_apriltag_node-nuc_4060ti.json)<br>11 ms | [56.3 fps](results/apriltag_ros_apriltag_node-agx_orin.json)<br>18 ms |
188+
| [Rectify Node](scripts/image_proc_rectify_node.py) | 1080p | [539 fps](results/image_proc_rectify_node-nuc_4060ti.json)<br>1.9 ms | [185 fps](results/image_proc_rectify_node-agx_orin.json)<br>5.6 ms |
189+
| [H.264 Encoder Node<br>I-frame Support](scripts/image_transport_h264_decoder_node.py) | 1080p | [60.5 fps](results/image_transport_h264_decoder_node-nuc_4060ti.json)<br>19 ms | [28.0 fps](results/image_transport_h264_decoder_node-agx_orin.json)<br>37 ms |
190+
| [H.264 Encoder Node<br>P-frame Support](scripts/image_transport_h264_encoder_node.py) | 1080p | [43.4 fps](results/image_transport_h264_encoder_node-nuc_4060ti.json)<br>24 ms | [10.2 fps](results/image_transport_h264_encoder_node-agx_orin.json)<br>95 ms |
191+
| [Stereo Disparity Node](scripts/stereo_image_proc_node.py) | 1080p | [99.5 fps](results/stereo_image_proc_node-nuc_4060ti.json)<br>6.4 ms | [66.5 fps](results/stereo_image_proc_node-agx_orin.json)<br>15 ms |
191192

192-
| Graph | Input Size | Intel NUC Corei7 11th Gen | AGX Orin (CPU only) |
193-
| --------------------------------------------------------------------------------------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
194-
| [AprilTag Graph](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/scripts/apriltag_ros_apriltag_graph.py) | 720p | [88.1 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/apriltag_ros_apriltag_graph-nuc_4060ti.json)<br>12 ms | [56.3 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/apriltag_ros_apriltag_graph-agx_orin.json)<br>22 ms |
195-
| [Stereo Disparity Graph](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/scripts/stereo_image_proc_graph.py) | 1080p | [99.4 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/stereo_image_proc_graph-nuc_4060ti.json)<br>16 ms | [63.5 fps](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/results/stereo_image_proc_graph-agx_orin.json)<br>28 ms |
193+
| Graph | Input Size | Intel NUC Corei7 11th Gen | AGX Orin (CPU only) |
194+
| ------------------------------------------------------------ | ---------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
195+
| [AprilTag Graph](scripts/apriltag_ros_apriltag_graph.py) | 720p | [88.1 fps](results/apriltag_ros_apriltag_graph-nuc_4060ti.json)<br>12 ms | [56.3 fps](results/apriltag_ros_apriltag_graph-agx_orin.json)<br>22 ms |
196+
| [Stereo Disparity Graph](scripts/stereo_image_proc_graph.py) | 1080p | [99.4 fps](results/stereo_image_proc_graph-nuc_4060ti.json)<br>16 ms | [63.5 fps](results/stereo_image_proc_graph-agx_orin.json)<br>28 ms |
196197

197198

198-
> **Note**: All results above are using ROS 2 nodes from open source that run computation on the CPU only. For GPU-accelerated equivalent packages, see [Isaac ROS](https://gitlab-master.nvidia.com/isaac_ros).
199+
> **Note**: All results above are using ROS 2 nodes from open source that run computation on the CPU only. For GPU-accelerated equivalent packages, see [Isaac ROS](https://github.com/NVIDIA-ISAAC-ROS/).
199200

200201
### Explanation of the Results JSON Format
201202

@@ -396,16 +397,21 @@ Follow these steps to ensure that everything in the template is configured corre
396397
5. Insert your custom nodes declared in step 1 to the composable node container.
397398
6. Revise/add benchmark configurations under `ROS2BenchmarkConfig` declaration based on your custom graph.
398399

399-
The full benchmark configuration options can be found [here](https://gitlab-master.nvidia.com/isaac_ros/ros2_benchmark/-/blob/dev/ros2_benchmark/ros2_benchmark/default_ros2_benchmark_config.yaml) in the default `ros2_benchmark` configuration file.
400+
The full benchmark configuration options can be found [here](ros2_benchmark/ros2_benchmark/default_ros2_benchmark_config.yaml) in the default `ros2_benchmark` configuration file.
400401

401402
## Profiling
402403

403404
When seeking to optimize performance, profiling is often used to gain deep insight into the call stack, and where processing time is spent in functions. [ros2_tracing](https://github.com/ros2/ros2_tracing) provides a tracing instrumentation to better understand performance on a CPU, but lacks information on GPU acceleration.
404405

405406
[Nsight Systems](https://developer.nvidia.com/nsight-systems) provides tracing instrumentation for CPU, GPU, and other SOC (system-on-chip) hardware accelerators for both `aarch64` and `x86_64` platforms, and is freely available for download. We use this tooling to profile our graphs of computation in ROS, to identify areas of improvement for compute optimization, and improvement of synchronization between heterogenous computing hardware. These tools allow for comparison of before and after to inspect profile differences with the benchmark tooling.
406407

408+
## Live Benchmark Mode
409+
410+
Besides benchmarking a graph with data loaded from rosbags, `ros2_benchmark` also supports a live benchmark mode that enables measuring performance outcome of a graph with its data source (e.g., a grph consists of a camera node). A [Realsense benchmark script](scripts/realsense2_node.py) is provided as an example to showcase the use of the live benchmark mode.
411+
407412
## Updates
408413

409-
| Date | Changes |
410-
| ---------- | --------------- |
411-
| 2023-04-05 | Initial release |
414+
| Date | Changes |
415+
| ---------- | ----------------------------------- |
416+
| 2023-11-16 | Add support for live benchmark mode |
417+
| 2023-04-05 | Initial release |

assets/configs/realsense.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
%YAML 1.2
2+
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
3+
# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# SPDX-License-Identifier: Apache-2.0
18+
---
19+
device_type: ''
20+
serial_no: ''
21+
usb_port_id: ''
22+
23+
rgb_camera:
24+
profile: '640x480x15'
25+
color_qos: "SENSOR_DATA"
26+
27+
depth_module:
28+
profile: '1280x720x30'
29+
emitter_enabled: 0
30+
emitter_on_off: false
31+
depth_qos: "SENSOR_DATA"
32+
depth_info_qos: "SYSTEM_DEFAULT"
33+
34+
infra_qos: "SENSOR_DATA"
35+
36+
enable_accel: false
37+
enable_color: false
38+
enable_depth: false
39+
enable_gyro: false
40+
enable_infra1: true
41+
enable_infra2: true
42+
43+
pointcloud:
44+
enable: false
45+
46+
pointcloud_texture_index: 0
47+
pointcloud_texture_stream: RS2_STREAM_ANY
48+
49+
enable_sync: false
50+
align_depth: false

ros2_benchmark/include/ros2_benchmark/monitor_node.hpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,26 @@ class MonitorNode : public rclcpp::Node
6060
const ros2_benchmark_interfaces::srv::StartMonitoring::Request::SharedPtr,
6161
ros2_benchmark_interfaces::srv::StartMonitoring::Response::SharedPtr response);
6262

63+
/// Record a satrt timestamp for a given message key.
64+
bool RecordStartTimestamp(
65+
const int32_t & message_key,
66+
const std::chrono::time_point<std::chrono::system_clock> & timestamp);
67+
6368
/// Record an end timestamp for a given message key.
6469
bool RecordEndTimestamp(const int32_t & message_key);
6570

6671
/// Record an end timestamp with an automatic generated key.
6772
bool RecordEndTimestampAutoKey();
6873

74+
/// Get a timestamp from a given serialized message
75+
std::chrono::time_point<std::chrono::system_clock>
76+
GetTimestampFromSerializedMessage(
77+
std::shared_ptr<rclcpp::SerializedMessage> serialized_message_ptr);
78+
6979
/// Index of this monitor node.
7080
uint32_t monitor_index_;
7181

72-
/// The name of the service StartMonitoring created in this nodee
82+
/// The name of the service StartMonitoring created in this node
7383
std::string monitor_service_name_;
7484

7585
/// Data format of the monitor subscriber.
@@ -78,10 +88,19 @@ class MonitorNode : public rclcpp::Node
7888
/// Treat the header.stamp.sec field in a message as a message ID.
7989
bool revise_timestamps_as_message_ids_{false};
8090

91+
/// Record timestamps in the observed messages as start timestamps
92+
bool record_start_timestamps_{false};
93+
8194
/// A subscriber that monitors the incoming messages for a specified topic
8295
/// and record their arrival timestamps.
8396
std::shared_ptr<rclcpp::SubscriptionBase> monitor_sub_{nullptr};
8497

98+
std::mutex is_monitoring_mutex_;
99+
bool is_monitoring_;
100+
101+
/// A list for storing start timestamps obtained from the observed messages.
102+
KeyTimePtMap start_timestamps_{};
103+
85104
/// A list for storing timestamps of the observed messages.
86105
KeyTimePtMap end_timestamps_{};
87106

ros2_benchmark/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ SPDX-License-Identifier: Apache-2.0
2121
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
2222
<package format="3">
2323
<name>ros2_benchmark</name>
24-
<version>2.0.0</version>
24+
<version>2.1.0</version>
2525
<description>Benchmarking framework for ROS 2 graphs</description>
2626

2727
<maintainer email="[email protected]">Hemal Shah</maintainer>

ros2_benchmark/ros2_benchmark/basic_performance_calculator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,6 @@ def conclude_performance(self) -> dict:
215215
final_perf_data[metric] = 'INVALID VALUES: NO CONCLUDED METHOD ASSIGNED'
216216

217217
self.reset()
218+
if self._report_prefix != '':
219+
return {self._report_prefix: final_perf_data}
218220
return final_perf_data

ros2_benchmark/ros2_benchmark/default_ros2_benchmark_config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ ros2_benchmark_config:
3636
# Use timestamp's sec field in a message header as message IDs for benchmarking
3737
revise_timestamps_as_message_ids: false
3838

39+
# Collect start timestamps from the messages observed by monitors
40+
collect_start_timestamps_from_monitors: false
41+
3942
# Enable CPU profiling during benchmarking
4043
enable_cpu_profiler: true
4144

ros2_benchmark/ros2_benchmark/ros2_benchmark_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class BenchmarkMode(Enum):
5858
TIMELINE = 0
5959
LOOPING = 1
6060
SWEEPING = 2
61+
LIVE = 3
6162

6263

6364
class ROS2BenchmarkConfig():
@@ -70,6 +71,7 @@ class ROS2BenchmarkConfig():
7071
# its type is not string (as env only supports string values).
7172
__config_type_map = {
7273
'revise_timestamps_as_message_ids': bool,
74+
'collect_start_timestamps_from_monitors': bool,
7375
'enable_cpu_profiler': bool,
7476
'publish_tf_messages_in_set_data': bool,
7577
'publish_tf_static_messages_in_set_data': bool,

0 commit comments

Comments
 (0)