mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 03:57:46 +08:00
Add Chinese documentation for camera and lidar devices
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
高级指南
|
||||
======================================================
|
||||
|
||||
本章介绍SDK的高级功能,包括多相机使用和特殊配置模式。
|
||||
|
||||
|
||||
|
||||
性能与优化
|
||||
------------------------------------------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
performance/lower_cpu_usage.md
|
||||
performance/efficient_intra_process_communication.md
|
||||
performance/fastdds_tuning.md
|
||||
|
||||
|
||||
多相机
|
||||
------------------------------------------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
multi_camera/multi_camera.md
|
||||
multi_camera/multi_camera_synced.md
|
||||
multi_camera/multi_camera_synced_verification_tool.md
|
||||
multi_camera/gmsl_camera.md
|
||||
|
||||
|
||||
配置与模式
|
||||
------------------------------------------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
configuration/align_depth_color.md
|
||||
configuration/configuration_of_depth_NFOV_and_WFOV_modes.md
|
||||
configuration/depth_work_mode_switch.md
|
||||
configuration/disparity_search_offset.md
|
||||
configuration/interleave_ae_mode.md
|
||||
configuration/predefined_presets.md
|
||||
configuration/net_camera.md
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
## 在 ROS 2 中对齐深度到彩色
|
||||
|
||||
本节说明如何使用 ROS 2 将深度图像与彩色图像对齐以创建叠加图像。这对于需要来自不同传感器模态的同步视觉信息的应用特别有用。
|
||||
|
||||
### 对齐和查看深度和彩色图像的命令
|
||||
|
||||
1. **基本深度到彩色对齐:**
|
||||
|
||||
要简单地将深度图像对齐到彩色图像,请使用以下命令:
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera gemini_330_series.launch.py depth_registration:=true
|
||||
```
|
||||
|
||||
此命令激活深度配准功能,但不打开查看器。
|
||||
|
||||
2. **查看深度到彩色叠加:**
|
||||
|
||||
如果您希望查看深度到彩色叠加,需要使用以下命令启用查看器:
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera gemini_330_series.launch.py depth_registration:=true enable_d2c_viewer:=true
|
||||
```
|
||||
|
||||
这将启动带有深度到彩色配准的相机节点并打开查看器以显示叠加图像。
|
||||
|
||||
### 在 RViz2 中选择话题
|
||||
|
||||
要在 RViz2 中可视化对齐的图像:
|
||||
|
||||
1. 运行上述命令之一后启动 RViz2。
|
||||
2. 选择深度到彩色叠加图像的话题。话题选择示例如下所示:
|
||||
|
||||

|
||||
|
||||
### 深度到彩色叠加示例
|
||||
|
||||
在 RViz2 中选择适当的话题后,您将能够看到深度到彩色叠加图像。它可能看起来像这样:
|
||||
|
||||

|
||||
+12
@@ -0,0 +1,12 @@
|
||||
# 深度 NFOV 和 WFOV 模式配置
|
||||
|
||||
对于 Femto Mega 和 Femto Bolt 设备,NFOV 和 WFOV 模式通过在启动文件中配置深度和 IR 的分辨率来实现。
|
||||
|
||||
在启动文件中,depth_width、depth_height、ir_width、ir_height 分别表示深度的分辨率和 IR 的分辨率。
|
||||
|
||||
IR 的帧率和分辨率必须与深度保持一致。不同模式与分辨率的对应关系如下:
|
||||
|
||||
- NFOV unbinned:640 x 576
|
||||
- NFOV binned:320 x 288
|
||||
- WFOV unbinned:1024 x 1024
|
||||
- WFOV binned:512 x 512
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
# 深度工作模式切换
|
||||
|
||||
Orbbec SDK ROS 2 支持深度工作模式切换。Gemini 2、Gemini 2 L 和 Femto 以及 Femto Bolt 相机支持深度工作模式切换。
|
||||
|
||||
- 在启动相机之前,可以为相应的 xxx.launch.py 文件的支持配置深度工作模式(depth_work_mode)。
|
||||
- Gemini 2、Gemini 2 L 和 Gemini 2 XL 相机支持深度工作模式切换。
|
||||
- xxx.launch.py 的默认深度工作模式配置是相机的默认配置。如果需要修改,可以根据需要切换到相应的模式。
|
||||
- 具体相机深度工作模式支持类型可以在深度模式的注释中找到。
|
||||
|
||||
```python
|
||||
# 深度工作模式支持如下:
|
||||
# Unbinned Dense Default
|
||||
# Unbinned Sparse Default
|
||||
# Binned Sparse Default
|
||||
# Obstacle Avoidance
|
||||
DeclareLaunchArgument('depth_work_mode', default_value='')
|
||||
```
|
||||
|
||||
- 查看深度工作模式:
|
||||
|
||||
```bash
|
||||
ros2 run orbbec_camera list_depth_work_mode_node
|
||||
```
|
||||
|
||||
* 示例:
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera gemini2L.launch.py depth_work_mode:="Unbinned Dense Default"
|
||||
```
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
# 视差搜索偏移
|
||||
|
||||
> 本节介绍如何在 Gemini330 系列相机中使用 disparity_search_offset 功能(相机固件最低版本 [1.4.60](https://www.orbbec.com/docs/g330-firmware-release/))。Disparity_search_offset 仅对深度流的 1280×720、1280×800 和 640×400 分辨率有效。
|
||||
|
||||
## 功能介绍
|
||||
|
||||
视差搜索范围的定义:对于左图像中的任何像素 *(u_l, v)*,默认情况下,右图像中对应的视差搜索范围为 *[ (u_l - 255, v)*, *(u_l, v) ]*,其中视差搜索长度为 256,最大整数视差为 255。如果将搜索的起点调整为 *[ (u_l - 255 - offset, v)*, *(u_l - offset, v) ]*,则偏移量定义为视差偏移。因此,我们的视差搜索范围配置包括视差搜索长度和搜索位置偏移(也可称为视差偏移)。
|
||||
|
||||

|
||||
|
||||
## 参数介绍
|
||||
|
||||
disparity_search_offset 相关参数在 [gemini_330_series.launch.py](https://github.com/orbbec/OrbbecSDK_ROS2/blob/v2-main/orbbec_camera/launch/gemini_330_series.launch.py) 中设置
|
||||
|
||||
* `disparity_range_mode`:视差搜索长度,只能设置为 64、128 和 256。
|
||||
|
||||
* `disparity_search_offset`:视差搜索偏移值,可以设置为 0 到 127。
|
||||
|
||||
* `disparity_offset_config`:视差搜索偏移交错帧。
|
||||
|
||||
* `offset_index0`:帧 0 视差搜索偏移值。
|
||||
|
||||
* `offset_index1`:帧 1 视差搜索偏移值。
|
||||
|
||||
| 视差范围模式 | 视差搜索偏移 | 倾斜墙最小深度 (mm) |
|
||||
| :------------------: | :---------------------: | :---------------------------------: |
|
||||
| 64 | 85 | Gemini 335L 388-406 |
|
||||
| 64 | 127 | Gemini 335L 302-317 |
|
||||
|
||||
| 视差范围模式 | 视差搜索偏移 | 倾斜墙最小深度 (mm) |
|
||||
| :------------------: | :---------------------: | :---------------------------------------------: |
|
||||
| 128 | 0 | Gemini 335 233-249<br />Gemini 335L 453-475 |
|
||||
| 128 | 45 | Gemini 335 172-184<br />Gemini 335L 334-349 |
|
||||
| 128 | 127 | Gemini 335 117-125<br />Gemini 335L 226-236 |
|
||||
|
||||
| 视差范围模式 | 视差搜索偏移 | 倾斜墙最小深度 (mm) |
|
||||
| :------------------: | :---------------------: | :---------------------------------: |
|
||||
| 256 | 85 | Gemini 335L 169-178 |
|
||||
| 256 | 127 | Gemini 335L 151-158 |
|
||||
|
||||
## 运行启动文件
|
||||
|
||||
设置 disparity_search_offset 参数,重新 `colcon build` 并运行启动文件
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera gemini_330_series.launch.py
|
||||
```
|
||||
@@ -0,0 +1,81 @@
|
||||
# 在 Gemini330 系列相机中使用 interleave_ae
|
||||
|
||||
> 本节介绍如何在 Gemini 330 系列相机中使用 interleave_ae(相机固件最低版本 [1.4.00](https://www.orbbec.com/docs/g330-firmware-release/))
|
||||
|
||||
## 参数介绍
|
||||
|
||||
interleave_ae 相关参数在 [gemini_330_series.launch.py](https://github.com/orbbec/OrbbecSDK_ROS2/blob/v2-main/orbbec_camera/launch/gemini_330_series.launch.py) 中设置
|
||||
|
||||
* `interleave_ae_mode`:设置激光或 hdr 交错。
|
||||
|
||||
* `interleave_frame_enable`:启用交错帧模式。
|
||||
|
||||
* `interleave_skip_enable`:启用跳帧模式。
|
||||
|
||||
* `interleave_skip_index`:设置为 0 跳过图案 ir,设置为 1 跳过泛光 ir。
|
||||
|
||||
**interleave hdr**
|
||||
|
||||
当 `interleave_ae_mode` 参数设置为 `hdr` 且 `interleave_frame_enable` 设置为 `true` 时,将启用 interleave hdr
|
||||
|
||||
* `hdr_index1_laser_control`:帧 1 激光开关设置。
|
||||
|
||||
* `hdr_index1_depth_exposure`:帧 1 深度曝光值设置,非 AE 模式。
|
||||
|
||||
* `hdr_index1_depth_gain`:帧 1 深度增益值设置,非 AE 模式。
|
||||
|
||||
* `hdr_index1_ir_brightness`:帧 1 ir 增益值设置。
|
||||
|
||||
* `hdr_index1_ir_ae_max_exposure`:AE(自动曝光)中帧 1 ir 最大曝光值设置。
|
||||
|
||||
* `hdr_index0_laser_control`:帧 0 激光开关设置。
|
||||
|
||||
* `hdr_index0_depth_exposure`:帧 0 深度曝光值设置,非 AE 模式。
|
||||
|
||||
* `hdr_index0_depth_gain`:帧 0 深度增益值设置,非 AE 模式。
|
||||
|
||||
* `hdr_index0_ir_brightness`:帧 0 ir 增益值设置。
|
||||
|
||||
* `hdr_index0_ir_ae_max_exposure`:AE(自动曝光)中帧 0 ir 最大曝光值设置。
|
||||
|
||||
**interleave laser**
|
||||
|
||||
当 `interleave_ae_mode` 参数设置为 `laser` 且 `interleave_frame_enable` 设置为 `true` 时,将启用 interleave laser
|
||||
|
||||
* `laser_index1_laser_control`:帧 1 激光开关设置。
|
||||
|
||||
* `laser_index1_depth_exposure`:帧 1 深度曝光值设置,非 AE 模式。
|
||||
|
||||
* `laser_index1_depth_gain`:帧 1 深度增益值设置,非 AE 模式。
|
||||
|
||||
* `laser_index1_ir_brightness`:帧 1 ir 增益值设置。
|
||||
|
||||
* `laser_index1_ir_ae_max_exposure`:AE(自动曝光)中帧 1 ir 最大曝光值设置。
|
||||
|
||||
* `laser_index0_laser_control`:帧 0 激光开关设置。
|
||||
|
||||
* `laser_index0_depth_exposure`:帧 0 深度曝光值设置,非 AE 模式。
|
||||
|
||||
* `laser_index0_depth_gain`:帧 0 深度增益值设置,非 AE 模式。
|
||||
|
||||
* `laser_index0_ir_brightness`:帧 0 ir 增益值设置。
|
||||
|
||||
* `laser_index0_ir_ae_max_exposure`:AE(自动曝光)中帧 0 ir 最大曝光值设置。
|
||||
|
||||
## 运行启动文件
|
||||
|
||||
设置 interleave_ae 参数,重新 `colcon build` 并运行启动文件
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera gemini_330_series.launch.py
|
||||
```
|
||||
|
||||
**示例可视化**
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Multi_camera_synced + Interleave_ae
|
||||
|
||||
请参考 [multi_camera_synced](./multi_camera_synced.md) 和 [参数介绍](#参数介绍)
|
||||
@@ -0,0 +1,99 @@
|
||||
# 网络相机
|
||||
|
||||
> 本节介绍如何在 OrbbecSDK_ROS2 中使用网络相机。目前仅支持 Femto_Mega、Gemini 335Le 和 Gemini 435Le 设备,其他网络设备将在不久的将来得到支持。
|
||||
|
||||
您可以在 [example](https://github.com/orbbec/OrbbecSDK_ROS2/tree/v2-main/orbbec_camera/examples) 中找到示例使用代码。
|
||||
|
||||
## Femto Mega & Gemini 435Le & Gemini 335Le
|
||||
|
||||
**参数介绍**
|
||||
|
||||
网络设备设置:`enumerate_net_device` 设置为 true,将自动枚举网络设备。
|
||||
|
||||
如果您不想自动枚举网络设备,可以将 `enumerate_net_device` 设置为 false,将 `net_device_ip` 设置为设备的 IP 地址,并将 `net_device_port` 设置为默认值 8090。
|
||||
|
||||
* `enumerate_net_device`:启用自动枚举网络设备。
|
||||
* `net_device_ip`:设置网络设备的 IP 地址。
|
||||
* `net_device_port`:设置网络设备的端口。通常可以设置为 8090。
|
||||
|
||||
**单个网络相机**
|
||||
|
||||
> 如果您需要运行 Gemini 435Le/Gemini 335Le,只需在运行命令中将 [femto_mega.launch.py](https://github.com/orbbec/OrbbecSDK_ROS2/tree/v2-main/orbbec_camera/launch/femto_mega.launch.py) 替换为 [gemini435_le.launch.py](https://github.com/orbbec/OrbbecSDK_ROS2/tree/v2-main/orbbec_camera/launch/gemini435_le.launch.py)/[gemini_330_series.launch.py](https://github.com/orbbec/OrbbecSDK_ROS2/tree/v2-main/orbbec_camera/launch/gemini_330_series.launch.py)
|
||||
|
||||
以 [femto_mega.launch.py](https://github.com/orbbec/OrbbecSDK_ROS2/tree/v2-main/orbbec_camera/launch/femto_mega.launch.py) 为例:
|
||||
|
||||
- **自动枚举网络设备:**
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera femto_mega.launch.py enumerate_net_device:=true
|
||||
```
|
||||
|
||||
- **指定 IP 地址启动设备:**
|
||||
|
||||
注意:`net_device_ip` 需要更改为设备的 IP 地址,这里是 192.168.1.10
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera femto_mega.launch.py enumerate_net_device:=false net_device_ip:=192.168.1.10 net_device_port:=8090
|
||||
```
|
||||
|
||||
**多个网络相机**
|
||||
|
||||
以 [multi_net_camera.launch.py](https://github.com/orbbec/OrbbecSDK_ROS2/blob/v2-main/orbbec_camera/examples/net_camera/multi_net_camera.launch.py) 为例:
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera multi_net_camera.launch.py
|
||||
```
|
||||
|
||||
## set_device_ip 工具
|
||||
|
||||
**`set_device_ip`** 可执行文件允许您直接从 ROS 2 配置网络相机的 IP 设置,包括在 DHCP 和静态 IP 之间切换,以及设置子网掩码和网关。这对于快速分配或更新 IP 地址而无需修改启动文件非常有用。
|
||||
|
||||
> **注意:**使用 `set_device_ip` 应用的 IP 设置是**永久性的**,如果设备断电或重启,**不会重置**。
|
||||
|
||||
**示例用法**
|
||||
|
||||
```bash
|
||||
ros2 run orbbec_camera set_device_ip --ros-args \
|
||||
-p old_ip:=192.168.1.10 \
|
||||
-p dhcp:=false \
|
||||
-p new_ip:=192.168.1.11 \
|
||||
-p mask:=255.255.255.0 \
|
||||
-p gateway:=192.168.1.1
|
||||
```
|
||||
|
||||
**参数**
|
||||
|
||||
- **`old_ip`** – 设备的当前 IP 地址。
|
||||
- **`dhcp`** – 设置为 `true` 使用 DHCP 或 `false` 使用静态 IP。
|
||||
- **`new_ip`** – 禁用 DHCP 时要分配的静态 IP 地址。
|
||||
- **`mask`** – 新 IP 的子网掩码。
|
||||
- **`gateway`** – 新 IP 的网关地址。
|
||||
|
||||
## 强制 IP 功能
|
||||
|
||||
**强制 IP** 功能允许您为网络相机分配**静态 IP 地址**,覆盖 DHCP 设置。当连接多个网络相机时,这非常有用,您需要每个设备具有固定的 IP 以实现可靠的通信。
|
||||
|
||||
> **注意:**如果设备断电或重启,强制 IP 配置**将被重置**。您需要在重启后重新应用设置。
|
||||
|
||||
**参数**
|
||||
|
||||
- **`force_ip_enable`** – 启用强制 IP 功能。**默认值:** `false`
|
||||
- **`force_ip_mac`** – 连接多个相机时的目标设备 MAC 地址(例如 `"54:14:FD:06:07:DA"`)。您可以使用 `list_devices_node` 查找每个设备的 MAC。**默认值:** `""`
|
||||
- **`force_ip_address`** – 要分配的静态 IP 地址。**默认值:** `192.168.1.10`
|
||||
- **`force_ip_subnet_mask`** – 静态 IP 的子网掩码。**默认值:** `255.255.255.0`
|
||||
- **`force_ip_gateway`** – 静态 IP 的网关地址。**默认值:** `192.168.1.1`
|
||||
|
||||
**示例用法**
|
||||
|
||||
- **为特定设备启用强制 IP:**
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera gemini_330_series.launch.py \
|
||||
force_ip_enable:=true \
|
||||
force_ip_mac:=54:14:FD:06:07:DA \
|
||||
force_ip_address:=192.168.1.50 \
|
||||
force_ip_subnet_mask:=255.255.255.0 \
|
||||
force_ip_gateway:=192.168.1.1 \
|
||||
net_device_ip:=192.168.1.50 \
|
||||
net_device_port:=8090
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
# 预定义预设
|
||||
|
||||
| 预设 | 特点 | 推荐使用场景 |
|
||||
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| Default | - 最佳视觉感知<br>- 在精度、填充率、微小物体等方面的整体性能良好 | - 通用场景<br>- 机器人应用 |
|
||||
| Hand | - 清晰的手部和手指边缘 | - 手势识别 |
|
||||
| High Accuracy | - 高置信度深度<br>- 几乎无噪声深度值<br>- 填充率较低 | - 避障<br>- 物体扫描 |
|
||||
| High Density | - 更高填充率<br>- 更多微小物体<br>- 可能存在噪声深度值 | - 物体识别<br>- 抓取和放置<br>- 前景和背景动画 |
|
||||
| Medium Density | - 填充率和精度的平衡性能<br>- 与 Default 相比:填充率较低,边缘质量更好 | - 通用场景和 Default 的替代方案 |
|
||||
| Custom | - 用户自定义预设<br>- 从上述预设派生,具有自定义修改,例如后处理管道的新配置、深度 AE 功能的修改平均强度设定点等 | - 通过使用自定义配置可获得比预定义预设更好的深度性能<br>- 适用于已建立的自定义配置 |
|
||||
|
||||
根据您的具体使用场景选择合适的预设名称,并将其设置为 `device_preset` 参数的值。
|
||||
@@ -0,0 +1,66 @@
|
||||
# GMSL 相机
|
||||
|
||||
> 本节介绍如何在 OrbbecSDK_ROS2 中使用 GMSL 相机。目前仅支持 Gemini 335Lg 和 Gemini 345Lg 设备,其他 GMSL 设备将在不久的将来得到支持。
|
||||
|
||||
您可以在 [example](https://github.com/orbbec/OrbbecSDK_ROS2/tree/v2-main/orbbec_camera/examples) 中找到示例使用代码。
|
||||
|
||||
## 单个 GMSL 相机
|
||||
|
||||
GMSL 相机在 OrbbecSDK_ROS2 中的使用与通过 USB 的 Gemini 330 系列相机相同。
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera gemini_330_gmsl.launch.py
|
||||
```
|
||||
|
||||
## 多个 GMSL 相机
|
||||
|
||||
要获取 GMSL 相机的 `usb_port`,插入相机并在终端中运行以下命令:
|
||||
|
||||
```bash
|
||||
ros2 run orbbec_camera list_devices_node
|
||||
```
|
||||
|
||||
例如,获得的 gmsl 相机 `usb_port`:`gmsl2-1`
|
||||
|
||||
转到 [multi_gmsl_camera.launch.py](https://github.com/orbbec/OrbbecSDK_ROS2/blob/v2-main/orbbec_camera/examples/gmsl_camera/multi_gmsl_camera.launch.py) 文件并更改 `usb_port`。
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera multi_gmsl_camera.launch.py
|
||||
```
|
||||
|
||||
> 注意:默认情况下,multi_gmsl_camera.launch.py 仅启动 color 和 depth。如果您想启动其他传感器,请转到 [camera_secondary_params.yaml](https://github.com/orbbec/OrbbecSDK_ROS2/blob/v2-main/orbbec_camera/config/camera_secondary_params.yaml) 进行修改。
|
||||
|
||||
## 多个 GMSL 相机同步
|
||||
|
||||
首先,请查看如何使用 [multi_camera_synced](./multi_camera_synced.md)。
|
||||
|
||||
此外,GMSL 多相机同步不需要 Multi-Camera Sync Hub Pro,因此无需设置 `primary` 模式。每个 GMSL 相机都是 `secondary`。
|
||||
|
||||
**额外的参数设置**
|
||||
|
||||
* `gmsl_trigger_fps`:设置硬件 soc 触发源帧率。
|
||||
* `enable_gmsl_trigger`:启用硬件 soc 触发。
|
||||
|
||||
**运行启动文件**
|
||||
|
||||
请参考 [multi_gmsl_camera_synced.launch.py](https://github.com/orbbec/OrbbecSDK_ROS2/blob/v2-main/orbbec_camera/examples/gmsl_camera/multi_gmsl_camera_synced.launch.py) 中的配置。
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera multi_gmsl_camera_synced.launch.py
|
||||
```
|
||||
|
||||
> 注意:默认情况下,multi_gmsl_camera_synced.launch.py 仅启动 color 和 depth。如果您想启动其他传感器,请转到 [camera_secondary_params.yaml](https://github.com/orbbec/OrbbecSDK_ROS2/blob/v2-main/orbbec_camera/config/camera_secondary_params.yaml) 进行修改。
|
||||
|
||||
## GMSL 相机的使用限制
|
||||
|
||||
GMSL 相机与各种反序列化器芯片(如 MAX9296 和 MAX92716)接口。Orbbec GMSL 相机支持多个流,包括深度、彩色、IR 和 IMU 数据,但存在某些使用限制:
|
||||
|
||||
- GMSL 仅支持 V4L2 和 YUYV 格式;不支持 MJPG 格式。RGB 输出源自 YUYV 格式转换。
|
||||
- Gemini-335Lg 的元数据通过单独的节点提供,而其他型号的元数据嵌入在视频帧中,这对用户保持透明。
|
||||
- 当使用 Max96712 作为反序列化器芯片时,由于 Max96712 芯片的特性,在 secondary_synced 模式下必须提供多机同步触发信号。否则,在切换数据流时会发生数据流中断。
|
||||
- 连接在同一个 MAX9296、MAX96712 LinkA/B 或 MAX96712 LinkC/D 上的两个相机有以下限制:
|
||||
- 在驱动程序版本 v1.2.02 之前,存在一个限制,即一个相机的 RGB 和另一个相机的右 IR 不能同时流式传输。在驱动程序版本 v1.2.02 之后,限制修改为一个相机的 RGB 和另一个相机的左 IR 不能同时流式传输。
|
||||
- 在驱动程序版本 v1.2.02 之前,存在一个限制,即一个相机的 DEPTH 和另一个相机的左 IR 不能同时流式传输。在驱动程序版本 v1.2.02 之后,限制修改为一个相机的 DEPTH 和另一个相机的右 IR 不能同时流式传输。
|
||||
- 两个相机的活动流的组合最大数量限制为四个(满足上述两个条件即可确保合规)。
|
||||
|
||||
有关更多已知限制,请参考 [Orbbec GMSL 相机的使用限制](https://github.com/orbbec/MIPI_Camera_Platform_Driver/blob/main/doc/Instructions%20for%20Using%20GMSL%20Camera.md)
|
||||
@@ -0,0 +1,91 @@
|
||||
# 多相机
|
||||
|
||||
- 要获取相机的 `usb_port`,插入相机并在终端中运行以下命令:
|
||||
|
||||
```bash
|
||||
ros2 run orbbec_camera list_devices_node
|
||||
```
|
||||
|
||||
- 将 `device_num` 参数设置为您拥有的相机数量。
|
||||
- 转到 `OrbbecSDK_ROS2/launch/multi_xxx.launch.py` 文件并更改 `usb_port`。
|
||||
- 不要忘记将 `include` 标签放在 `group` 标签内。
|
||||
否则,不同相机的参数值可能会被污染。
|
||||
|
||||
```python
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, GroupAction, ExecuteProcess
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch_ros.actions import Node
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
import os
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
# Include launch files
|
||||
package_dir = get_package_share_directory('orbbec_camera')
|
||||
launch_file_dir = os.path.join(package_dir, 'launch')
|
||||
launch1_include = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
os.path.join(launch_file_dir, 'gemini2L.launch.py')
|
||||
),
|
||||
launch_arguments={
|
||||
'camera_name': 'camera_01',
|
||||
'usb_port': '6-2.4.4.2', # replace your usb port here
|
||||
'device_num': '2'
|
||||
}.items()
|
||||
)
|
||||
|
||||
launch2_include = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
os.path.join(launch_file_dir, 'gemini2L.launch.py')
|
||||
),
|
||||
launch_arguments={
|
||||
'camera_name': 'camera_02',
|
||||
'usb_port': '6-2.4.1', # replace your usb port here
|
||||
'device_num': '2'
|
||||
}.items()
|
||||
)
|
||||
|
||||
# If you need more cameras, just add more launch_include here, and change the usb_port and device_num
|
||||
|
||||
# Launch description
|
||||
ld = LaunchDescription([
|
||||
GroupAction([launch1_include]),
|
||||
GroupAction([launch2_include]),
|
||||
])
|
||||
|
||||
return ld
|
||||
|
||||
```
|
||||
|
||||
- 要启动相机,运行以下命令:
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera multi_camera.launch.py
|
||||
```
|
||||
|
||||
## 多相机无数据流
|
||||
|
||||
**电源供应不足**:
|
||||
|
||||
- 确保每个相机连接到单独的集线器。
|
||||
- 使用带电源的集线器为每个相机提供足够的电力。
|
||||
|
||||
**高分辨率**:
|
||||
|
||||
- 尝试降低分辨率以解决数据流问题。
|
||||
|
||||
**增加 usbfs_memory_mb 值**:
|
||||
|
||||
- 将 `usbfs_memory_mb` 值增加到 128MB(这是一个参考值,可以根据系统需求进行调整)
|
||||
通过运行以下命令:
|
||||
|
||||
```bash
|
||||
echo 128 | sudo tee /sys/module/usbcore/parameters/usbfs_memory_mb
|
||||
```
|
||||
|
||||
- 要使此更改永久生效,请查看[此链接](https://github.com/OpenKinect/libfreenect2/issues/807)。
|
||||
|
||||
## 多相机图像话题帧率过低
|
||||
|
||||
请参考 [Fast DDS 配置](../performance/fastdds_tuning.md) 文件。
|
||||
@@ -0,0 +1,55 @@
|
||||
# 多相机同步说明
|
||||
|
||||
> 本文档的目的是说明如何在 OrbbecSDK_ROS2 中使用多相机同步
|
||||
|
||||
### 设置说明
|
||||
|
||||
* 请阅读多相机同步设置指南:[多相机同步设置](https://www.orbbec.com/docs/set-up-cameras-for-external-synchronization_v1-2/)
|
||||
* 确保相机正确连接到多相机同步器。
|
||||
|
||||

|
||||
|
||||
### 使用 OrbbecSDK_ROS2 检查相机端口
|
||||
|
||||
```bash
|
||||
ros2 run orbbec_camera list_devices_node
|
||||
```
|
||||
|
||||
### OrbbecSDK_ROS2 多相机同步配置
|
||||
|
||||
打开 multi_camera_synced.launch.py,并按照下面所示配置相机设置:
|
||||
|
||||

|
||||
|
||||
1. `gemini_330_series.launch.py` 是用于启动相机的启动文件。
|
||||
|
||||
2. 将 `camera_name` 设置为 `G330_0`。例如,发布的彩色图像话题将是 `/G330_0/color/image_raw`。
|
||||
|
||||
3. 将 `usb_port` 设置为 `2-2`,表示正在使用端口 `2-2` 上的相机设备。此值可以在 `ros2 run orbbec_camera list_devices_node` 命令的输出中找到。
|
||||
|
||||
4. 将 `device_num` 设置为 `2`,表示将使用两个相机。
|
||||
|
||||
5. 将 `sync_mode` 设置为 `primary`,表示 `2-7` 相机设备处于主模式。多相机同步模式选项可以在下图中找到。
|
||||
|
||||
6. 来自 `config_file_path` 的参数可以覆盖在 `gemini_330_series.launch.py` 中设置的参数(可选)。
|
||||
|
||||
7. 对于从属相机,将 `trigger_out_enabled` 设置为 false。
|
||||
|
||||
| **模式名称** | **设置效果说明** |
|
||||
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| free_run | - 支持不同的帧率设置<br />- 8 针同步接口不支持外部输出同步相关信号 |
|
||||
| standalone(默认) | ● 默认与 Primary 相同<br />● 内置 RGBD 帧同步<br />● 8 针同步接口默认不向外部输出信号 |
|
||||
| primary | ● 设置为主相机<br />● 8 针同步接口向外部设备输出信号 |
|
||||
| secondary | ● 设置为从属(被动同步;当外部有硬件连续触发信号输入且连续触发信号与当前设置的帧率匹配时,根据外部触发信号采集图像;当没有外部触发信号时,停止流)<br />● 8 针同步接口向外部设备输出信号 |
|
||||
| secondary_synced | ● 设置为从属同步(被动同步;当外部有硬件连续触发信号输入且连续触发信号与当前设置的帧率匹配时,根据外部触发信号采集图像;当没有外部触发信号时,根据设置的帧率的内部触发信号采集图像)<br />● 8 针同步接口向外部设备输出信号 |
|
||||
| hardware_triggering | ● 设置为硬件触发(被动触发;当外部有硬件触发信号输入且触发信号时间间隔不小于当前上限时,根据外部触发信号采集图像;当没有外部触发信号时,不采集图像)<br />● 8 针同步接口向外部设备输出信号 |
|
||||
| software_triggering | ● 设置为软件触发(被动触发;当主机有触发命令输入且触发命令时间间隔不小于当前上限时,根据触发命令采集图像;当没有触发命令时,不采集图像)<br />● 8 针同步接口向外部设备输出信号 |
|
||||
|
||||
* 主相机应该最后启动。
|
||||
* 理想情况下,启动每个相机之间应该有 2 秒的延迟。
|
||||
|
||||
### 运行以下命令启动多相机同步
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera multi_camera_synced.launch.py
|
||||
```
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
# 多相机同步验证节点
|
||||
|
||||
文件路径:[image_sync_example_node.cpp](https://github.com/orbbec/OrbbecSDK_ROS2/blob/v2-main/orbbec_camera/examples/multi_camera_time_sync/image_sync_example_node.cpp)
|
||||
|
||||
此示例节点用于 **4 台 Orbbec 相机** 的同步采集与时间戳验证。
|
||||
它可用于验证多相机主从同步(Primary / Secondary Synced)模式下的帧对齐精度。
|
||||
|
||||
---
|
||||
|
||||
## 使用教程
|
||||
|
||||
### **在 `multi_camera_synced.launch.py` 的基础上做以下修改**
|
||||
|
||||
- 增加 `launch_include` 以适配 4 台相机
|
||||
|
||||
- 根据设备型号选择对应的 launch 文件,如 330 系列选择 gemini_330_series.launch.py
|
||||
|
||||
- 命名规范:camera_name 命名方式 camera_01、camera_02、camera_03 ...
|
||||
|
||||
- 设置 device_num 数量为 4
|
||||
|
||||
- USB 端口配置 usb_port,使用以下命令查看并绑定正确的端口
|
||||
`ros2 run orbbec_camera list_devices_node`
|
||||
|
||||
- 同步模式设置为主从模式,一个 primary 相机,其他设置为 secondary_synced
|
||||
|
||||
- 启动顺序:主相机(Primary)应最后启动,以确保同步信号建立正确。
|
||||
|
||||
---
|
||||
|
||||
### **参数文件修改**
|
||||
|
||||
修改 `config` 目录下的以下两个配置文件:
|
||||
|
||||
- `camera_params.yaml`
|
||||
|
||||
- `camera_secondary_params.yaml`
|
||||
|
||||
确保以下内容统一:
|
||||
|
||||
- 启用 **depth** 与 **color** 流;
|
||||
|
||||
- 统一各相机的 **帧率(fps)**。
|
||||
|
||||
---
|
||||
|
||||
### **启动与验证**
|
||||
- 启动多机同步 launch: `multi_camera_synced.launch.py`
|
||||
|
||||
- 打开新终端运行同步验证节点: `ros2 run orbbec_camera image_sync_example_node`
|
||||
该节点会输出多相机图像的时间戳差异信息,用于验证同步效果。
|
||||
|
||||
---
|
||||
|
||||
### **参考 launch 文件**
|
||||
|
||||
```
|
||||
import os
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
from launch.actions import IncludeLaunchDescription, GroupAction, TimerAction
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch_ros.actions import Node, LoadComposableNodes
|
||||
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
# Include launch files
|
||||
package_dir = get_package_share_directory("orbbec_camera")
|
||||
launch_file_dir = os.path.join(package_dir, "launch")
|
||||
config_file_dir = os.path.join(package_dir, "config")
|
||||
config_file_path = os.path.join(config_file_dir, "camera_params.yaml")
|
||||
secondary_config_file_path = os.path.join(config_file_dir, "camera_secondary_params.yaml")
|
||||
|
||||
launch1_include = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
os.path.join(launch_file_dir, "gemini_330_series.launch.py")
|
||||
),
|
||||
launch_arguments={
|
||||
"camera_name": "camera_01",
|
||||
"usb_port": "2-2.3",
|
||||
"device_num": "4",
|
||||
"sync_mode": "primary",
|
||||
"config_file_path": config_file_path,
|
||||
"trigger_out_enabled": "true"
|
||||
}.items(),
|
||||
)
|
||||
|
||||
launch2_include = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
os.path.join(launch_file_dir, "gemini_330_series.launch.py")
|
||||
),
|
||||
launch_arguments={
|
||||
"camera_name": "camera_02",
|
||||
"usb_port": "2-1",
|
||||
"device_num": "4",
|
||||
"sync_mode": "secondary_synced",
|
||||
"config_file_path": secondary_config_file_path,
|
||||
"trigger_out_enabled": "false"
|
||||
}.items(),
|
||||
)
|
||||
|
||||
launch3_include = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
os.path.join(launch_file_dir, "gemini_330_series.launch.py")
|
||||
),
|
||||
launch_arguments={
|
||||
"camera_name": "camera_03",
|
||||
"usb_port": "2-3",
|
||||
"device_num": "4",
|
||||
"sync_mode": "secondary_synced",
|
||||
"config_file_path": secondary_config_file_path,
|
||||
"trigger_out_enabled": "false"
|
||||
}.items(),
|
||||
)
|
||||
|
||||
launch4_include = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
os.path.join(launch_file_dir, "gemini_330_series.launch.py")
|
||||
),
|
||||
launch_arguments={
|
||||
"camera_name": "camera_04",
|
||||
"usb_port": "2-4",
|
||||
"device_num": "4",
|
||||
"sync_mode": "secondary_synced",
|
||||
"config_file_path": secondary_config_file_path,
|
||||
"trigger_out_enabled": "false"
|
||||
}.items(),
|
||||
)
|
||||
|
||||
|
||||
|
||||
# Launch description
|
||||
ld = LaunchDescription(
|
||||
[
|
||||
|
||||
TimerAction(period=0.0, actions=[GroupAction([launch2_include])]),
|
||||
TimerAction(period=2.0, actions=[GroupAction([launch3_include])]),
|
||||
TimerAction(period=4.0, actions=[GroupAction([launch4_include])]),
|
||||
TimerAction(period=6.0, actions=[GroupAction([launch1_include])]),
|
||||
# The primary camera should be launched at last
|
||||
]
|
||||
)
|
||||
|
||||
return ld
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 必要系统配置
|
||||
|
||||
### **提升 USB 缓冲区容量**
|
||||
|
||||
```
|
||||
echo 512 | sudo tee /sys/module/usbcore/parameters/usbfs_memory_mb
|
||||
```
|
||||
|
||||
### **配置 Fast DDS**
|
||||
|
||||
优化 ROS2 节点间通信延迟,可以有效减少图像传输延迟,[配置过程见此章节](../performance/fastdds_tuning.md)。
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
# 高效的进程内通信:
|
||||
|
||||
### 简介
|
||||
|
||||
如果我们的ROS2封装器节点与订阅者节点加载在同一进程中,它支持零拷贝通信。这可以减少图像/点云话题的拷贝时间,特别是在大帧分辨率和高FPS的情况下。
|
||||
|
||||
您需要启动一个组件容器,并将我们的节点作为组件与其他组件节点一起启动。有关"在单个进程中组合多个节点"的更多详细信息,请参见 [此处](https://docs.ros.org/en/rolling/Tutorials/Composition.html)。
|
||||
|
||||
有关高效进程内通信的更多详细信息,请参见 [此处](https://docs.ros.org/en/humble/Tutorials/Intra-Process-Communication.html#efficient-intra-process-communication)。
|
||||
|
||||
### 示例
|
||||
|
||||
**手动将多个组件加载到同一进程中**
|
||||
|
||||
* 启动组件:
|
||||
|
||||
```bash
|
||||
ros2 run rclcpp_components component_container
|
||||
```
|
||||
|
||||
* 添加封装器:
|
||||
|
||||
```bash
|
||||
ros2 component load /ComponentManager orbbec_camera orbbec_camera::OBCameraNodeDriver -e use_intra_process_comms:=true
|
||||
```
|
||||
|
||||
以相同方式加载其他组件节点(封装器话题的消费者)。
|
||||
|
||||
**使用启动文件**
|
||||
|
||||
```bash
|
||||
ros2 launch orbbec_camera gemini_intra_process_demo_launch.py
|
||||
```
|
||||
|
||||
**限制**
|
||||
|
||||
* RCLPY目前不支持节点组件
|
||||
|
||||
* 使用 `image_transport` 的压缩图像将被禁用,因为进程内通信不支持此功能
|
||||
@@ -0,0 +1,146 @@
|
||||
# 针对Orbbec相机与ROS2的Fast DDS优化
|
||||
|
||||
使用默认配置时,Fast DDS表现出次优的传输效率,导致在ROS2中使用Orbbec相机时图像传输延迟显著。本文档提供了优化Fast DDS以提高图像传输效率的指导。
|
||||
|
||||
## 调整系统参数
|
||||
|
||||
**IP分片时间**
|
||||
|
||||
- **路径**: `/proc/sys/net/ipv4/ipfrag_time`(默认值:30秒)
|
||||
- **目的**: 定义IP分片保留在内存中的持续时间。
|
||||
- **调整**: 减少此值以缩短未接收到分片的时间窗口,这有助于减少延迟。考虑到您环境的具体需求,因为此设置会影响所有传入的分片。
|
||||
|
||||
**示例**: 设置为3秒。
|
||||
|
||||
```bash
|
||||
sudo sysctl net.ipv4.ipfrag_time=3
|
||||
```
|
||||
|
||||
**IP分片内存阈值**
|
||||
|
||||
- **路径**: `/proc/sys/net/ipv4/ipfrag_high_thresh`(默认值:262144字节)
|
||||
- **目的**: 设置用于重组IP分片的最大内存。
|
||||
- **调整**: 增加此值以允许更多内存用于分片重组,这可以改善较大数据包的处理。
|
||||
|
||||
**示例**: 增加到128 MB。
|
||||
|
||||
```bash
|
||||
sudo sysctl net.ipv4.ipfrag_high_thresh=134217728
|
||||
```
|
||||
|
||||
**最大缓冲区大小**
|
||||
|
||||
- **目的**: 配置接收和发送数据的最大缓冲区大小,这对高吞吐量数据传输至关重要。
|
||||
- **调整**: 设置接收和发送操作的最大缓冲区大小。
|
||||
|
||||
**命令**:
|
||||
|
||||
```bash
|
||||
sudo sysctl -w net.core.rmem_max=2147483647
|
||||
sudo sysctl -w net.core.rmem_default=2147483647
|
||||
sudo sysctl -w net.core.wmem_max=2147483647
|
||||
sudo sysctl -w net.core.wmem_default=2147483647
|
||||
```
|
||||
|
||||
或者,通过将这些设置添加到 `/etc/sysctl.d/10-fastrtps-max.conf` 文件中使其永久生效。
|
||||
|
||||
```bash
|
||||
sudo gedit /etc/sysctl.d/10-fastrtps-max.conf
|
||||
```
|
||||
|
||||
将以下行添加到文件中:
|
||||
|
||||
```bash
|
||||
net.core.rmem_max=2147483647
|
||||
net.core.rmem_default=2147483647
|
||||
net.core.wmem_max=2147483647
|
||||
net.core.wmem_default=2147483647
|
||||
```
|
||||
|
||||
然后保存并退出文件。运行 `sudo sysctl -p` 以应用更改。
|
||||
|
||||
有关详细指导,请参考 [ROS 2 DDS调优文档](https://docs.ros.org/en/foxy/How-To-Guides/DDS-tuning.html)。
|
||||
|
||||
## Fast DDS配置
|
||||
|
||||
以下是针对Orbbec相机与ROS2使用而优化的Fast DDS配置文件示例。此配置通过调整缓冲区大小和传输设置来增强整体数据传输。
|
||||
|
||||
**配置文件:** `shm_fastdds.xml`
|
||||
|
||||
将此文件放在 `$HOME` 目录中。
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
|
||||
<transport_descriptors>
|
||||
<transport_descriptor>
|
||||
<transport_id>UDP_transport</transport_id>
|
||||
<type>UDPv4</type>
|
||||
<maxInitialPeersRange>10</maxInitialPeersRange>
|
||||
<maxMessageSize>65000</maxMessageSize>
|
||||
<sendBufferSize>1048576</sendBufferSize>
|
||||
<receiveBufferSize>1048576</receiveBufferSize>
|
||||
</transport_descriptor>
|
||||
</transport_descriptors>
|
||||
<participant profile_name="participant_profile_ros2" is_default_profile="true">
|
||||
<rtps>
|
||||
<name>profile_for_ros2_context</name>
|
||||
<userTransports>
|
||||
<transport_id>UDP_transport</transport_id>
|
||||
</userTransports>
|
||||
<useBuiltinTransports>false</useBuiltinTransports>
|
||||
<sendSocketBufferSize>1048576</sendSocketBufferSize>
|
||||
<listenSocketBufferSize>1048576</listenSocketBufferSize>
|
||||
<builtin>
|
||||
<initialPeersList>
|
||||
<locator>
|
||||
<udpv4>
|
||||
<address>127.0.0.1</address>
|
||||
</udpv4>
|
||||
</locator>
|
||||
</initialPeersList>
|
||||
</builtin>
|
||||
</rtps>
|
||||
</participant>
|
||||
<data_writer profile_name="default publisher profile" is_default_profile="true">
|
||||
<qos>
|
||||
<publishMode>
|
||||
<kind>ASYNCHRONOUS</kind>
|
||||
</publishMode>
|
||||
<latencyBudget>
|
||||
<duration>
|
||||
<sec>0</sec>
|
||||
<nanosec>1000000</nanosec>
|
||||
</duration>
|
||||
</latencyBudget>
|
||||
</qos>
|
||||
<historyMemoryPolicy>PREALLOCATED_WITH_REALLOC</historyMemoryPolicy>
|
||||
</data_writer>
|
||||
<data_reader profile_name="default subscription profile" is_default_profile="true">
|
||||
<qos>
|
||||
<data_sharing>
|
||||
<kind>AUTOMATIC</kind>
|
||||
</data_sharing>
|
||||
<latencyBudget>
|
||||
<duration>
|
||||
<sec>0</sec>
|
||||
<nanosec>1000000</nanosec>
|
||||
</duration>
|
||||
</latencyBudget>
|
||||
</qos>
|
||||
<historyMemoryPolicy>PREALLOCATED_WITH_REALLOC</historyMemoryPolicy>
|
||||
</data_reader>
|
||||
</profiles>
|
||||
```
|
||||
|
||||
**环境变量**
|
||||
|
||||
设置以下环境变量以使用自定义Fast DDS配置文件:
|
||||
|
||||
```bash
|
||||
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
|
||||
export FASTRTPS_DEFAULT_PROFILES_FILE=$HOME/shm_fastdds.xml
|
||||
export RMW_FASTRTPS_USE_QOS_FROM_XML=1
|
||||
```
|
||||
|
||||
此配置旨在优化数据流并减少传输延迟,提高Orbbec相机系统在ROS2环境中的响应性和可靠性。
|
||||
@@ -0,0 +1,95 @@
|
||||
## 使用Orbbec ROS包降低CPU使用率
|
||||
|
||||
您可以在 [示例](https://github.com/orbbec/OrbbecSDK_ROS2/tree/v2-main/orbbec_camera/examples) 中找到使用示例代码。
|
||||
|
||||
本文档概述了在使用 **Gemini 330系列相机** 的 **OrbbecSDK_ROS2 v2** 环境中最小化CPU使用率的策略。固件版本必须 **不低于1.4.10**,且 `device` 应设置为 **Default**。
|
||||
|
||||
### 降低CPU使用率的推荐设置
|
||||
|
||||
要在OrbbecSDK_ROS2中实现最低的CPU使用率,建议配置以下参数。
|
||||
|
||||
| 参数 | 推荐值 | 说明 |
|
||||
| :--------------: | :------------------------------------: | :--------------------------------------------: |
|
||||
| `uvc_backend` | `v4l2` | 与 `libuvc` 相比CPU使用率更低 |
|
||||
| `color_format` | `RGB` | CPU使用率低于 `MJPG` |
|
||||
| `filter` | 仅使用 `hardware_noise_removal_filter` | 其他滤波器会显著增加CPU使用率 |
|
||||
|
||||
### 用于测试的启动文件
|
||||
|
||||
* `gemini_330_series_lower_cpu_usage.launch.py`
|
||||
* `multi_camera_lower_cpu_usage.launch.py`
|
||||
|
||||
### 测试环境
|
||||
|
||||
**硬件配置**
|
||||
|
||||
* **CPU**: Intel i7-8700 @ 3.20GHz
|
||||
|
||||
* **内存**: 24 GB
|
||||
|
||||
* **存储**: Micron 2200S NVMe 256GB
|
||||
|
||||
* **GPU**: NVIDIA GeForce GTX 1660Ti
|
||||
|
||||
* **操作系统**: Ubuntu22.04
|
||||
|
||||
**ROS配置**
|
||||
|
||||
* **ROS版本**: ROS2 Humble
|
||||
|
||||
* **SDK版本**: OrbbecSDK_ROS2 v2.2.1
|
||||
|
||||
**相机设置**
|
||||
|
||||
* 设备: 2x Gemini 335, 1x Gemini 336, 1x Gemini 336L
|
||||
|
||||
* 固件版本: 1.4.10
|
||||
|
||||
|
||||
### 测试设置
|
||||
|
||||
**数据流设置:**
|
||||
|
||||
* 深度/左IR/右IR: 848×480 @ 30fps
|
||||
* 彩色: 848×480 @ 30fps
|
||||
|
||||
注意:以下CPU使用率数据重点关注 `uvc_backend`、`color_format` 和各种滤波器组合。
|
||||
|
||||
### 测试结果
|
||||
|
||||
**`uvc_backend` 对比(RGB格式)**
|
||||
|
||||
| libuvc CPU使用率 | v4l2 CPU使用率 | 绝对变化 |
|
||||
| :--------------: | :------------: | :-------------: |
|
||||
| 182.8% | 118.8% | -64.0% |
|
||||
|
||||
使用v4l2后端可以显著降低CPU使用率。在我们的实现中,v4l2无需对Linux内核进行任何补丁即可工作,允许用户轻松在v4l2和libuvc之间切换,并保持与标准Linux发行版的完全兼容性。
|
||||
|
||||
**`color_format` 对比(MJPG vs RGB)**
|
||||
|
||||
| 后端 | MJPG CPU使用率 | RGB CPU使用率 | 绝对变化 |
|
||||
| :-----: | :------------: | :-----------: | :-------------: |
|
||||
| libuvc | 347.7% | 182.8% | -164.9% |
|
||||
| v4l2 | 170.0% | 118.8% | -51.2% |
|
||||
|
||||
如果选择RGB格式而不是MJPG,可以降低CPU使用率,因为MJPG图像的解码会消耗主机CPU资源。
|
||||
|
||||
**滤波器配置影响**
|
||||
|
||||
| 应用的滤波器 | libuvc CPU使用率 | CPU使用率增加 | v4l2 CPU使用率 | CPU使用率增加 |
|
||||
| ----------------------------------------------------- | ---------------- | ------------------ | -------------- | ------------------ |
|
||||
| 无滤波器(基准) | 182.8% | 0.0%(基准) | 118.8% | 0.0%(基准) |
|
||||
| `(软件)noise_removal_filter` | 218.0% | +35.2% | 128.5% | +9.7% |
|
||||
| `(软件)noise_removal_filter + spatial_filter` | 469.6% | +286.8% | 336.7% | +217.9% |
|
||||
| `hardware_noise_removal_filter` | 186.3% | +3.5% | 115.4% | -3.4% |
|
||||
| `hardware_noise_removal_filter + spatial_filter` | 251.3% | +68.5% | 152.5% | +33.7% |
|
||||
|
||||
根据测试结果,仅使用 `hardware_noise_removal_filter` 相比无滤波器基准,对 `libuvc`(+3.5%)和 `v4l2`(-3.4%)的CPU使用率变化可以忽略不计,因为此滤波器在相机硬件内部运行。相比之下,其他滤波器在主机系统上执行。将 `spatial_filter` 添加到硬件滤波器会导致CPU使用率适度增加,而应用基于软件的 `noise_removal_filter`——无论是单独使用还是与 `spatial_filter` 结合——都会显著增加CPU负载。为保持较低的CPU使用率,建议避免使用基于软件的滤波器,仅依赖 `hardware_noise_removal_filter`。
|
||||
|
||||
### 进一步优化
|
||||
|
||||
| 参数 | 推荐值 | 说明 |
|
||||
| :----------------------------: | :----------------------------------------------: | :---------------------------------------------: |
|
||||
| `depth_registration` | `false` 或 `true` 配合 `align_mode=HW` | 软件对齐消耗更多CPU |
|
||||
| `enable_point_cloud` | `false` | 禁用点云可降低CPU使用率 |
|
||||
| `enable_colored_point_cloud` | `false` | 禁用彩色点云可降低CPU使用率 |
|
||||
Reference in New Issue
Block a user