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

# Publish system status with qrb_ros_system_monitor

The `qrb_ros_system_monitor` sample application has various ROS nodes that publish system status information, such as CPU loading, memory usage, and disk space.

## Pipeline for `qrb_ros_system_monitor`

The figure shows the pipeline, which collects system information with the `sysfs` node and some system standard command tools, and then publishes these data with ROS messages.

<p style={{ textAlign: 'center', fontWeight: 'bold'}}>
  <img src="https://mintcdn.com/qualcomm-prod/BUW_rqJcTn92gBMR/SDKs/QIR-SDK-2.0/media/80-65220-2-qirp-sdk-qsg/sys-monitor-pipeline.svg?fit=max&auto=format&n=BUW_rqJcTn92gBMR&q=85&s=b025d5240f6764404aa5c0fa61f419af" width="1243" height="434" data-path="SDKs/QIR-SDK-2.0/media/80-65220-2-qirp-sdk-qsg/sys-monitor-pipeline.svg" />

  Figure: qrb\_ros\_system\_monitor pipeline
</p>

## ROS nodes used in the `qrb_ros_system_monitor `pipeline

| ROS node           | Description                                             |
| :----------------- | :------------------------------------------------------ |
| CpuMonitor         | Publishes the CPU loading information.                  |
| MemoryMonitor      | Publishes the memory usage information.                 |
| DiskMonitor        | Publishes the disk space information.                   |
| SwapMonitor        | Publishes the swap space information.                   |
| TemperatureMonitor | Publishes the CPU temperature.                          |
| BatteryMonitor     | Publishes the battery information.                      |
| SystemInfoServer   | Publishes static system information, such as CPU count. |

## ROS topics used in the `qrb_ros_system_monitor ` pipeline

<table>
  <thead>
    <tr>
      <th style={{ width: '20%' }}>ROS topic</th>
      <th style={{ width: '25%' }}>Message type</th>
      <th style={{ width: '20%' }}>Published/Subscribed by</th>
      <th style={{ width: '35%' }}>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>`/cpu`</td>
      <td>`qrb_ros_system_monitor::CpuMonitor`</td>
      <td>Published by `CpuMonitor`</td>
      <td>Publishes the CPU loading information.</td>
    </tr>

    <tr>
      <td>`/memory`</td>
      <td>`qrb_ros_system_monitor::MemoryMonitor`</td>
      <td>Published by `MemoryMonitor`</td>
      <td>Publishes the memory usage information.</td>
    </tr>

    <tr>
      <td>`/disk`</td>
      <td>`qrb_ros_system_monitor::DiskMonitor`</td>
      <td>Published by `DiskMonitor`</td>
      <td>Publishes the disk space information.</td>
    </tr>

    <tr>
      <td>`/swap`</td>
      <td>`qrb_ros_system_monitor::SwapMonitor`</td>
      <td>Published by `SwapMonitor`</td>
      <td>Publishes the swap space information.</td>
    </tr>

    <tr>
      <td>`/temperature`</td>
      <td>`qrb_ros_system_monitor::TemperatureMonitor`</td>
      <td>Published by `TemperatureMonitor`</td>
      <td>Publishes the CPU temperature.</td>
    </tr>

    <tr>
      <td>`/battery`</td>
      <td>`qrb_ros_system_monitor::BatteryMonitor`</td>
      <td>Published by `BatteryMonitor`</td>
      <td>Publishes the battery information.</td>
    </tr>
  </tbody>
</table>

## ROS services used in the `qrb_ros_system_monitor ` pipeline

<table>
  <thead>
    <tr>
      <th style={{ width: '28%' }}>ROS topic</th>
      <th style={{ width: '20%' }}>Message type</th>
      <th style={{ width: '22%' }}>Served by</th>
      <th style={{ width: '30%' }}>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>`/system_info_server`</td>
      <td>`qrb_ros_system_monitor::SystemInfoServer`</td>
      <td>`SystemInfoServer`</td>
      <td>Publishes static system information, such as CPU count. </td>
    </tr>
  </tbody>
</table>

## Prerequisites

You have **Set up the device** according to [Set up the environment for running sample applications](./set-up-env-for-sample-app).

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

1. Start two terminals, and run the following commands in each terminal to set up QIR SDK and ROS2 environment on the device.
   ```shell theme={null}
   ssh root@[ip-addr]
   (ssh) source /usr/share/qirp-setup.sh
   ```
2. In terminal 1, run the system monitor ROS node.
   ```shell theme={null}
   (ssh) ros2 run qrb_ros_system_monitor qrb_ros_system_monitor
   ```
3. In terminal 2, check the system information with ROS topic.
   ```shell theme={null}
   (ssh) ros2 topic echo /cpu
   ```

## Build and run `qrb_ros_system_monitor`

1. Build `qrb_ros_system_monitor` provided by the QIR SDK on the host computer.
   ```shell theme={null}
   cd <qirp_decompressed_workspace>
   source setup.sh
   cd qirp-samples/platform/qrb_ros_system_monitor
   colcon build --merge-install --cmake-args ${CMAKE_ARGS}
   ```
2. Push `qrb_ros_system_monitor` to the device.

   <Note>
     **Note**

     Ensure that the QIR SDK is installed on the device.
   </Note>

   ```shell theme={null}
   cd qirp-samples/platform/qrb_ros_system_monitor/install
   tar czvf qrb_ros_system_monitor.tar.gz lib share
   scp qrb_ros_system_monitor.tar.gz root@[ip-addr]:/opt/
   ssh root@[ip-addr]
   (ssh) tar --no-overwrite-dir --no-same-owner -zxf /opt/qrb_ros_system_monitor.tar.gz -C /usr/ros/jazzy/
   ```
3. Start two terminals, and run the following commands in each terminal to set up QIR SDK and ROS2 environment on the device.
   ```shell theme={null}
   ssh root@[ip-addr]
   (ssh) source /usr/share/qirp-setup.sh
   ```
4. In terminal 1, run the system monitor ROS node.
   ```shell theme={null}
   (ssh) ros2 run qrb_ros_system_monitor qrb_ros_system_monitor
   ```
5. In terminal 2, get the system information.
   ```shell theme={null}
   (ssh) ros2 topic echo /cpu
   (ssh) ros2 topic echo /memory
   ```

## **Limitation**

The `sysfs` node and Linux standard command-line tools collect the system information values. Therefore, if the `sysfs` path changes or the output format of command-line tools changes, those ROS nodes may not work as expected.
