> ## 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.

# Evaluate performance of ROS2 components with qrb_ros_benchmark

[qrb\_ros\_benchmark](https://github.com/qualcomm-qrb-ros/qrb_ros_benchmark) is a benchmarking tool designed for evaluating the performance of ROS components on Qualcomm robotics platforms. It provides reusable components for benchmarking various message types and ROS nodes, with a focus on zero-copy transport mechanisms.

`qrb_ros_benchmark `**builds on [ros2\_benchmark](https://github.com/NVIDIA-ISAAC-ROS/ros2_benchmark) and extends it with specialized components for benchmarking QRB ROS transport types, including:**

* QRB transport types (Image, IMU, PointCloud2)
* DMABuf transport types (Image, PointCloud2)
* Standard ROS message types

<Note>
  **Note**

  For information about the `qrb_ros_benchmark` pipeline flow and the topics it uses, see [ros2\_benchmark](https://github.com/NVIDIA-ISAAC-ROS/ros2_benchmark).
</Note>

## Prerequisites

* You have **Set up the device** according to [Set up the environment for running sample applications](./set-up-env-for-sample-app).
* Prepare the benchmark scripts for evaluating your custom ROS2 application. For details, see [Creating custom benchmark](https://github.com/NVIDIA-ISAAC-ROS/ros2_benchmark?tab=readme-ov-file#creating-custom-benchmark).

## Run out-of-the-box `qrb_ros_benchmark`

<Accordion title="Try me">
  <Steps>
    <Step title="Set up the environment">
      Start two terminals, and run the following commands in each terminal to set up QIR SDK and ROS2 environment on the device. Value range of `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
      ```
    </Step>

    <Step title="Run your custom ROS2 application">
      In terminal 1, run your custom ROS2 application.

      ```bash title="SSH Session" theme={null}
      ros2 launch my_application.launch.py
      ```
    </Step>

    <Step title="Run your benchmark script">
      In terminal 2, run your benchmark script for evaluating your custom ROS2 application.

      ```bash title="SSH Session" theme={null}
      launch_test my_benchmark_scripts.py
      ```

      The script outputs the evaluation result in your terminal.
    </Step>
  </Steps>
</Accordion>

## Build and run `qrb_ros_benchmark`

<Accordion title="Try me">
  <Steps>
    <Step title="Build qrb_ros_benchmark on the host">
      ```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}
      ```
    </Step>

    <Step title="Push qrb_ros_benchmark to the device">
      ```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/
      ```
    </Step>

    <Step title="Set up the environment">
      Start two terminals, and run the following commands in each terminal to set up QIR SDK and ROS2 environment on the device. Value range of `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
      ```
    </Step>

    <Step title="Run your custom ROS2 application">
      In terminal 1, run your custom ROS2 application.

      ```bash title="SSH Session" theme={null}
      ros2 launch my_application.launch.py
      ```
    </Step>

    <Step title="Run your benchmark script">
      In terminal 2, run your benchmark scripts for evaluating your custom ROS2 application.

      ```bash title="SSH Session" theme={null}
      launch_test my_benchmark_scripts.py
      ```
    </Step>
  </Steps>
</Accordion>

## Limitation

`qrb_ros_benchmark` supports the following ROS2 message types:

* ROS2 standard message type
* QRB transport types (Image, IMU, PointCloud2)
* DMABuf transport types (Image, PointCloud2)
