docs: document side-stream benchmark tools

This commit is contained in:
ob-yalian
2026-09-16 18:20:52 +08:00
parent 2e1631d5cf
commit cc198dce71
4 changed files with 42 additions and 16 deletions
@@ -4,17 +4,18 @@ This section introduces the performance benchmark tools, their purpose, and the
## common_benchmark_node.py
`common_benchmark_node.py` monitors Orbbec camera performance in a ROS environment. It collects and records key camera metrics such as frame rate, latency, system resource usage, and packet/drop rate to help evaluate camera node stability and performance. Statistics are updated once per second.
`common_benchmark_node.py` monitors Orbbec camera performance in a ROS environment. It collects and records subscriber-side metrics such as image frame rate, latency, system resource usage, and estimated frame loss to help evaluate camera node stability and performance. Statistics are updated once per second.
Features:
- Measures published image frame rate and latency (current, minimum, maximum, and average).
- Measures the frame rate and latency of images received by the subscriber (current, minimum, maximum, and average).
- Monitors camera node CPU/ARM usage (current, minimum, maximum, and average).
- Tracks frame drop rate (publisher) and packet loss rate (subscriber).
- Estimates subscriber-side frame loss from image message timestamps.
- Supports `color`, `left_color`, `right_color`, `depth`, `ir`, `left_ir`, and `right_ir` image streams, as well as compressed image and point cloud topics.
- Prints real-time statistics at 1 Hz and saves results to a CSV file.
- Supports configurable runtime and CSV output path.
In ROS 1, both frame drop rate and packet loss rate can be measured. In ROS 2, the header does not contain the `seq` field, so only publisher-side frame drop rate is calculated.
In ROS 2, the node estimates subscriber-side frame loss from adjacent image message timestamps. When `--ideal_fps` is set, it uses the specified ideal frame rate; otherwise, it learns the nominal frame interval from received image timestamps.
![common_benchmark_ros1](../image/benchmark_images/common_benchmark_ros1.png "ROS1")
@@ -32,6 +33,9 @@ Parameters:
- `--run_time`: Monitoring duration, specified as a time string such as `"10s"`, `"5m"`, `"1h"`, or `"2d"`. The default is 10 seconds.
- `--csv_file`: Output CSV file path. By default, it is saved in the workspace directory as `camera_monitor_log.csv`.
- `--ideal_fps`: Ideal frame rate used for subscriber-side frame-loss estimation. A value greater than `0` overrides the interval learned from image timestamps.
- `--camera_names`: Camera namespaces to monitor, separated by commas.
- `--topics`: Topics to monitor, separated by commas. Use raw stream names such as `color,left_color,right_color`, or full raw/compressed image and point cloud topics. Automatic discovery selects only raw image topics; compressed images and point clouds require full topic names.
Multi-camera monitoring example:
@@ -39,7 +43,8 @@ Multi-camera monitoring example:
ros2 run orbbec_camera common_benchmark_node.py \
--run_time 1h \
--csv_file /tmp/cam_log.csv \
--camera_names camera_01,camera_02
--camera_names camera_01,camera_02 \
--topics color,left_color,right_color
```
## service_benchmark_node.py
@@ -205,7 +210,7 @@ Output data files are stored in the `ob_benchmark` folder with names such as `0.
## start_benchmark_node
`start_benchmark_node` is the subscriber used in the benchmark workflow. It subscribes to multi-camera color, depth, IR, and point cloud topics according to `camera_name` in `start_benchmark_params.json`. It is usually used together with benchmark launch files.
`start_benchmark_node` is the subscriber used in the benchmark workflow. It subscribes to multi-camera `color`, `left_color`, `right_color`, `depth`, `left_ir`, `right_ir`, and point cloud topics according to `camera_name` in `start_benchmark_params.json`. It is usually used together with benchmark launch files.
```bash
ros2 run orbbec_camera start_benchmark_node
@@ -4,7 +4,7 @@ This section describes multi-camera image saving, synchronization verification,
## multi_save_rgbir_node
`multi_save_rgbir_node` subscribes to multi-camera RGB/IR images and metadata according to `multi_save_rgbir_params.json`, and uses the `start_capture` service to trigger saving. Start the corresponding multi-camera nodes before using it.
`multi_save_rgbir_node` subscribes to multi-camera RGB/IR images and metadata according to `multi_save_rgbir_params.json`, and uses the `start_capture` service to trigger saving. Supported stream names are `color`, `left_color`, `right_color`, `ir`, `left_ir`, and `right_ir`. Start the corresponding multi-camera nodes before using it.
```bash
ros2 run orbbec_camera multi_save_rgbir_node
@@ -16,6 +16,14 @@ The configuration file is:
orbbec_camera/config/tools/multisavergbir/multi_save_rgbir_params.json
```
Set the streams to save in `stream_names`, for example:
```json
"stream_names": ["color", "left_color", "right_color"]
```
When `stream_names` is an empty array, the node automatically discovers stable available streams after startup. When streams are configured explicitly, every selected stream must receive the requested number of frames before capture completes.
Trigger saving 10 frames:
```bash
@@ -26,7 +34,7 @@ ros2 service call /start_capture orbbec_camera_msgs/srv/SetInt32 "{data: 10}"
`image_sync_example_node` verifies multi-image timestamp synchronization online. It subscribes to 1 to 8 image topics, displays synchronized images, and prints timestamp difference and FPS statistics. Start the camera node before using it.
If `sync_topics` is not set, the node automatically discovers color/depth image topics:
If `sync_topics` is not set, the node automatically discovers image topics for `left_color`, `right_color`, `left_ir`, `right_ir`, `color`, `depth`, and `ir`. The node supports synchronizing up to 8 image topics:
```bash
ros2 run orbbec_camera image_sync_example_node
@@ -4,17 +4,18 @@
## common_benchmark_node.py
`common_benchmark_node.py` 是一个用于监控在 ROS 环境中运行的 Orbbec 相机性能的工具。它实时收集和记录关键相机指标,如帧率、延迟、系统资源使用和丢包率,帮助用户评估相机节点的稳定性和性能(每秒更新一次)。
`common_benchmark_node.py` 是一个用于监控在 ROS 环境中运行的 Orbbec 相机性能的工具。它在订阅端实时收集和记录关键相机指标,如图像帧率、延迟、系统资源使用和估算丢帧率,帮助用户评估相机节点的稳定性和性能(每秒更新一次)。
功能:
- 测量发布的图像帧率和延迟(当前、最小、最大、平均)。
- 测量订阅端接收的图像帧率和延迟(当前、最小、最大、平均)。
- 监控相机节点的 CPU/ARM 使用率(当前、最小、最大、平均)。
- 跟踪丢帧率(发布者)和丢包率(订阅者)。
- 根据图像消息时间戳估算订阅端丢帧率。
- 支持 `color`、`left_color`、`right_color`、`depth`、`ir`、`left_ir` 和 `right_ir` 图像流,也支持压缩图像和点云 topic。
- 将实时统计信息(1 Hz)打印到终端并将结果保存到 CSV 文件。
- 支持可配置的运行时长和 CSV 输出路径。
在 ROS1 中,可以测量丢帧率和丢包率,而在 ROS2 中,header 缺少 `seq` 字段,因此仅计算发布者端的丢帧率。
在 ROS2 中,节点根据相邻图像消息的时间戳估算订阅端丢帧率。设置 `--ideal_fps` 时使用指定的理想帧率;未设置时根据收到的图像时间戳学习名义帧间隔。
![common_benchmark_ros1](../image/benchmark_images/common_benchmark_ros1.png "ROS1")
@@ -32,6 +33,9 @@ ros2 run orbbec_camera common_benchmark_node.py \
- `--run_time`:监控持续时间,指定为时间字符串,如 `"10s"`、`"5m"`、`"1h"`、`"2d"`。默认为 10 秒。
- `--csv_file`:输出 CSV 文件的路径。默认情况下,它保存在工作空间目录中,名称为 `camera_monitor_log.csv`。
- `--ideal_fps`:订阅端丢帧估算使用的理想帧率。大于 `0` 时覆盖根据图像时间戳学习的帧间隔。
- `--camera_names`:要监控的相机命名空间,多个名称用逗号分隔。
- `--topics`:要监控的 topic,多个值用逗号分隔。可以填写原始流名称(例如 `color,left_color,right_color`),也可以填写完整的原始/压缩图像或点云 topic。自动发现只选择原始图像 topic;压缩图像和点云需要填写完整 topic 名称。
多相机监控示例:
@@ -39,7 +43,8 @@ ros2 run orbbec_camera common_benchmark_node.py \
ros2 run orbbec_camera common_benchmark_node.py \
--run_time 1h \
--csv_file /tmp/cam_log.csv \
--camera_names camera_01,camera_02
--camera_names camera_01,camera_02 \
--topics color,left_color,right_color
```
## service_benchmark_node.py
@@ -207,7 +212,7 @@ ros2 run orbbec_camera ob_benchmark_node
## start_benchmark_node
`start_benchmark_node` 是 benchmark 流程中的订阅端,会按 `start_benchmark_params.json` 中的 `camera_name` 订阅多相机 color、depth、IR 和 point cloud topic。它通常与 benchmark launch 配合使用。
`start_benchmark_node` 是 benchmark 流程中的订阅端,会按 `start_benchmark_params.json` 中的 `camera_name` 订阅多相机 `color`、`left_color`、`right_color`、`depth`、`left_ir`、`right_ir` 和 point cloud topic。它通常与 benchmark launch 配合使用。
```bash
ros2 run orbbec_camera start_benchmark_node
@@ -4,7 +4,7 @@
## multi_save_rgbir_node
`multi_save_rgbir_node` 根据 `multi_save_rgbir_params.json` 配置订阅多相机 RGB/IR 图像和 metadata,并通过 `start_capture` 服务触发保存。使用前需要先启动对应的多相机节点。
`multi_save_rgbir_node` 根据 `multi_save_rgbir_params.json` 配置订阅多相机 RGB/IR 图像和 metadata,并通过 `start_capture` 服务触发保存。支持的流名称为 `color`、`left_color`、`right_color`、`ir`、`left_ir` 和 `right_ir`。使用前需要先启动对应的多相机节点。
```bash
ros2 run orbbec_camera multi_save_rgbir_node
@@ -16,6 +16,14 @@ ros2 run orbbec_camera multi_save_rgbir_node
orbbec_camera/config/tools/multisavergbir/multi_save_rgbir_params.json
```
在配置文件的 `stream_names` 中填写要保存的流名称,例如:
```json
"stream_names": ["color", "left_color", "right_color"]
```
`stream_names` 为空数组时,节点会在启动后自动发现稳定可用的流。配置流名称后,触发保存时需要每个指定流都收到所需帧数。
触发保存 10 帧:
```bash
@@ -26,7 +34,7 @@ ros2 service call /start_capture orbbec_camera_msgs/srv/SetInt32 "{data: 10}"
`image_sync_example_node` 用于在线验证多路图像时间戳同步情况。它会订阅 1 到 8 路图像 topic,显示同步图像,并输出时间戳差和 FPS 统计。使用前需要先启动相机节点。
未设置 `sync_topics` 时,节点会自动发现 color/depth 图像 topic:
未设置 `sync_topics` 时,节点会自动发现以下图像流的 topic:`left_color`、`right_color`、`left_ir`、`right_ir`、`color`、`depth` 和 `ir`。节点最多同步 8 路图像:
```bash
ros2 run orbbec_camera image_sync_example_node