> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 使用 qrb_ros_benchmark 评估 ROS2 组件的性能

[qrb\_ros\_benchmark](https://github.com/qualcomm-qrb-ros/qrb_ros_benchmark) 是一款基准测试工具,专为评估 Qualcomm 机器人平台上 ROS 组件的性能而设计。它提供可复用的组件,用于对各种消息类型和 ROS 节点进行基准测试,重点关注零拷贝传输机制。

`qrb_ros_benchmark `**基于 [ros2\_benchmark](https://github.com/NVIDIA-ISAAC-ROS/ros2_benchmark) 构建,并使用专用组件对其进行扩展,以对 QRB ROS 传输类型进行基准测试,包括:**

* QRB 传输类型(Image、IMU、PointCloud2)
* DMABuf 传输类型(Image、PointCloud2)
* 标准 ROS 消息类型

> [!NOTE]
>
> **注意**
>
> 有关 `qrb_ros_benchmark` 管道流程及其使用主题的信息,请参见 [ros2\_benchmark](https://github.com/NVIDIA-ISAAC-ROS/ros2_benchmark)。

## 前提条件

* 您已根据 [设置运行示例应用程序的环境](https://dragonwingdocs.qualcomm.com/zh/SDKs/QIR-SDK-2.0/set-up-env-for-sample-app.md) **设置好设备**。
* 已为评估您的自定义 ROS2 应用程序准备好基准测试脚本。详细信息,请参见 [创建自定义基准](https://github.com/NVIDIA-ISAAC-ROS/ros2_benchmark?tab=readme-ov-file#creating-custom-benchmark)。

## 运行开箱即用的 `qrb_ros_benchmark`

> [accordion] 试一试
>
> **1. 设置环境**
>
> 启动两个终端,在每个终端中运行以下命令,以在设备上设置 QIR SDK 和 ROS2 环境。`ROS_DOMAIN_ID` 的取值范围:\[0, 232]
>
> ```bash theme={null}
> ssh root@[ip-addr]
> ```
>
> ```bash title="SSH Session" theme={null}
> source /usr/share/qirp-setup.sh
> export ROS_DOMAIN_ID=xx
> ```
>
> **2. 运行您的自定义 ROS2 应用程序**
>
> 在终端 1 中,运行您的自定义 ROS2 应用程序。
>
> ```bash title="SSH Session" theme={null}
> ros2 launch my_application.launch.py
> ```
>
> **3. 运行您的基准测试脚本**
>
> 在终端 2 中,运行用于评估您的自定义 ROS2 应用程序的基准测试脚本。
>
> ```bash title="SSH Session" theme={null}
> launch_test my_benchmark_scripts.py
> ```
>
> 该脚本会在您的终端中输出评估结果。

## 构建并运行 `qrb_ros_benchmark`

> [accordion] 试一试
>
> **1. 在主机上构建 qrb\_ros\_benchmark**
>
> ```bash theme={null}
> cd <qirp_decompressed_workspace>
> source setup.sh
> cd qirp-samples/platform/qrb_ros_benchmark
> colcon build --merge-install --cmake-args ${CMAKE_ARGS}
> ```
>
> **2. 将 qrb\_ros\_benchmark 推送到设备**
>
> ```bash theme={null}
> cd qirp-samples/platform/qrb_ros_benchmark/install
> tar czvf qrb_ros_benchmark.tar.gz include lib share
> scp qrb_ros_benchmark.tar.gz root@[ip-addr]:/opt/
> ssh root@[ip-addr]
> ```
>
> ```bash title="SSH Session" theme={null}
> tar --no-overwrite-dir --no-same-owner -zxf /opt/qrb_ros_benchmark.tar.gz -C /usr/ros/jazzy/
> ```
>
> **3. 设置环境**
>
> 启动两个终端,在每个终端中运行以下命令,以在设备上设置 QIR SDK 和 ROS2 环境。`ROS_DOMAIN_ID` 的取值范围:\[0, 232]
>
> ```bash theme={null}
> ssh root@[ip-addr]
> ```
>
> ```bash title="SSH Session" theme={null}
> source /usr/share/qirp-setup.sh
> export ROS_DOMAIN_ID=xx
> ```
>
> **4. 运行您的自定义 ROS2 应用程序**
>
> 在终端 1 中,运行您的自定义 ROS2 应用程序。
>
> ```bash title="SSH Session" theme={null}
> ros2 launch my_application.launch.py
> ```
>
> **5. 运行您的基准测试脚本**
>
> 在终端 2 中,运行用于评估您的自定义 ROS2 应用程序的基准测试脚本。
>
> ```bash title="SSH Session" theme={null}
> launch_test my_benchmark_scripts.py
> ```

## 限制

`qrb_ros_benchmark` 支持以下 ROS2 消息类型:

* ROS2 标准消息类型
* QRB 传输类型(Image、IMU、PointCloud2)
* DMABuf 传输类型(Image、PointCloud2)
