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.
Figure: qrb_ros_system_monitor pipeline
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
| ROS topic | Message type | Published/Subscribed by | Description |
|---|
/cpu | qrb_ros_system_monitor::CpuMonitor | Published by CpuMonitor | Publishes the CPU loading information. |
/memory | qrb_ros_system_monitor::MemoryMonitor | Published by MemoryMonitor | Publishes the memory usage information. |
/disk | qrb_ros_system_monitor::DiskMonitor | Published by DiskMonitor | Publishes the disk space information. |
/swap | qrb_ros_system_monitor::SwapMonitor | Published by SwapMonitor | Publishes the swap space information. |
/temperature | qrb_ros_system_monitor::TemperatureMonitor | Published by TemperatureMonitor | Publishes the CPU temperature. |
/battery | qrb_ros_system_monitor::BatteryMonitor | Published by BatteryMonitor | Publishes the battery information. |
ROS services used in the qrb_ros_system_monitor pipeline
| ROS topic | Message type | Served by | Description |
|---|
/system_info_server | qrb_ros_system_monitor::SystemInfoServer | SystemInfoServer | Publishes static system information, such as CPU count. |
Prerequisites
You have Set up the device according to Set up the environment for running sample applications.
Run out-of-the-box qrb_ros_system_monitor
- Start two terminals, and run the following commands in each terminal to set up QIR SDK and ROS2 environment on the device.
ssh root@[ip-addr]
(ssh) source /usr/share/qirp-setup.sh
- In terminal 1, run the system monitor ROS node.
(ssh) ros2 run qrb_ros_system_monitor qrb_ros_system_monitor
- In terminal 2, check the system information with ROS topic.
(ssh) ros2 topic echo /cpu
Build and run qrb_ros_system_monitor
-
Build
qrb_ros_system_monitor provided by the QIR SDK on the host computer.
cd <qirp_decompressed_workspace>
source setup.sh
cd qirp-samples/platform/qrb_ros_system_monitor
colcon build --merge-install --cmake-args ${CMAKE_ARGS}
-
Push
qrb_ros_system_monitor to the device.
NoteEnsure that the QIR SDK is installed on the device.
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/
-
Start two terminals, and run the following commands in each terminal to set up QIR SDK and ROS2 environment on the device.
ssh root@[ip-addr]
(ssh) source /usr/share/qirp-setup.sh
-
In terminal 1, run the system monitor ROS node.
(ssh) ros2 run qrb_ros_system_monitor qrb_ros_system_monitor
-
In terminal 2, get the system information.
(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.