-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
284 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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中选择合适的主题后,您将能够看到深度到彩色叠加图像。这是它可能看起来的样子: | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
## 使用Orbbec ROS 2包配置多个摄像头 | ||
|
||
本节介绍如何在ROS 2环境中同时配置和使用多个Orbbec摄像头。 | ||
|
||
### 识别摄像头USB端口 | ||
|
||
#### 列出连接的摄像头的脚本 | ||
|
||
要确定摄像头连接到哪些USB端口,您可以使用以下bash脚本。该脚本列出了连接到系统的所有Orbbec设备及其USB端口和序列号。 | ||
|
||
```bash | ||
#!/bin/bash | ||
|
||
VID="2bc5" | ||
|
||
for dev in /sys/bus/usb/devices/*; do | ||
if [ -e "$dev/idVendor" ]; then | ||
vid=$(cat "$dev/idVendor") | ||
if [ "$vid" == "${VID}" ]; then | ||
port=$(basename $dev) | ||
product=$(cat "$dev/product" 2>/dev/null) # 产品名称 | ||
serial=$(cat "$dev/serial" 2>/dev/null) # 序列号 | ||
echo "发现Orbbec设备 $product,usb端口 $port,序列号 $serial" | ||
fi | ||
fi | ||
done | ||
``` | ||
|
||
将此脚本保存为一个文件,并在您的终端中执行,以输出连接的摄像头列表。 | ||
|
||
### 启动多个摄像头 | ||
|
||
#### 多摄像头启动配置 | ||
|
||
您可以通过为每个摄像头指定不同的USB端口来启动多个摄像头。下面是一个使用ROS 2启动系统启动两个摄像头的Python脚本示例。 | ||
|
||
```python | ||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, GroupAction, ExecuteProcess | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from ament_index_python.packages import get_package_share_directory | ||
import os | ||
|
||
def generate_launch_description(): | ||
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, 'gemini_330_series.launch.py')), | ||
launch_arguments={'camera_name': 'camera_01', 'usb_port': '2-3.4.4.4.1', 'device_num': '2', 'sync_mode': 'free_run'}.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-3.4.4.4.3', 'device_num': '2', 'sync_mode': 'free_run'}.items() | ||
) | ||
|
||
ld = LaunchDescription([ | ||
GroupAction([launch1_include]), | ||
GroupAction([launch2_include]) | ||
]) | ||
|
||
return ld | ||
``` | ||
|
||
#### 运行启动文件 | ||
|
||
要执行多摄像头的启动配置,请使用命令: | ||
|
||
```bash | ||
ros2 launch orbbec_camera multi_camera.launch.py | ||
``` | ||
|
||
### 配置多摄像头的TF树 | ||
|
||
#### 两个摄像头的TF配置示例 | ||
|
||
使用多个摄像头时,校准它们并为每个摄像头发布静态TF树是必不可少的。以下Python脚本基于您的校准结果配置TF树: | ||
|
||
```python | ||
from launch import LaunchDescription | ||
from launch_ros.actions import Node | ||
|
||
def generate_launch_description(): | ||
ld = LaunchDescription([ | ||
Node( | ||
package='tf2_ros', | ||
executable='static_transform_publisher', | ||
name='camera_01_tf', | ||
arguments=['0', '0', '0', '0', '0', '0', 'base_link', 'camera_01_link'], | ||
output='screen' | ||
), | ||
Node( | ||
package='tf2_ros', | ||
executable='static_transform_publisher', | ||
name='camera_02_tf', | ||
arguments=['0', '0', '0', '0', '0', '0', 'base_link', 'camera_02_link'], | ||
output='screen' | ||
) | ||
]) | ||
|
||
return ld | ||
``` | ||
|
||
将此配置保存为 `multi_camera_tf.launch.py` 在Orbbec摄像头包的启动目录中。运行它,请使用: | ||
|
||
```bash | ||
ros2 launch orbbec_camera multi_camera_tf.launch.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## 在ROS 2中启用和可视化点云 | ||
|
||
本节演示如何从相机节点启用点云数据输出,并使用RViz2进行可视化,类似于之前讨论的[启动相机节点](./start_camera_node.MD)文档中的初始相机节点设置。 | ||
|
||
### 启用深度点云 | ||
|
||
#### 启用深度点云的命令 | ||
|
||
要激活深度信息的点云数据流,请使用以下命令: | ||
|
||
```bash | ||
ros2 launch orbbec_camera gemini_330_series.launch.py enable_point_cloud:=true | ||
``` | ||
|
||
#### 在RViz2中可视化深度点云 | ||
|
||
运行上述命令后,执行以下步骤来可视化深度点云: | ||
|
||
1. 打开RViz2。 | ||
2. 添加一个`PointCloud2`显示。 | ||
3. 选择`/camera/depth/points`主题进行可视化。 | ||
4. 将固定帧设置为`camera_link`以正确对齐数据。 | ||
|
||
##### 示例可视化 | ||
|
||
以下是在RViz2中可能看到的深度点云的样子: | ||
|
||
 | ||
|
||
### 启用彩色点云 | ||
|
||
#### 启用彩色点云的命令 | ||
|
||
要启用彩色点云功能,请输入以下命令: | ||
|
||
```bash | ||
ros2 launch orbbec_camera gemini_330_series.launch.py enable_colored_point_cloud:=true | ||
``` | ||
|
||
#### 在RViz2中可视化彩色点云 | ||
|
||
要可视化彩色点云数据: | ||
|
||
1. 在执行命令后启动RViz2。 | ||
2. 添加一个`PointCloud2`显示面板。 | ||
3. 从列表中选择`/camera/depth_registered/points`主题。 | ||
4. 确保固定帧设置为`camera_link`。 | ||
|
||
##### 示例可视化 | ||
|
||
在RViz2中彩色点云的结果应类似于这样: | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
## 在ROS 2中启动相机节点 | ||
|
||
本指南提供了使用ROS 2启动启用彩色点云功能的相机节点的指令。 | ||
|
||
### 启动节点的命令 | ||
|
||
要启动相机节点,请在终端执行以下命令: | ||
|
||
```bash | ||
ros2 launch orbbec_camera gemini_330_series.launch.py enable_colored_point_cloud:=true | ||
``` | ||
|
||
此命令将启动相机节点并启用彩色点云。 | ||
|
||
### 发布的主题 | ||
|
||
一旦相机节点运行,它将在多个ROS主题上发布数据。以下是可用主题的列表: | ||
|
||
- **IMU数据和IMU信息:** | ||
- `camera/accel/imu_info` | ||
- `camera/gyro/imu_info` | ||
- `camera/gyro_accel/sample` | ||
|
||
- **彩色相机主题:** | ||
- `/camera/color/camera_info` | ||
- `/camera/color/image_raw` | ||
- `/camera/color/image_raw/compressed` | ||
- `/camera/color/image_raw/compressedDepth` | ||
- `/camera/color/image_raw/theora` | ||
- `/camera/color/metadata` | ||
|
||
- **深度相机主题:** | ||
- `/camera/depth/camera_info` | ||
- `/camera/depth/image_raw` | ||
- `/camera/depth/image_raw/compressed` | ||
- `/camera/depth/image_raw/compressedDepth` | ||
- `/camera/depth/image_raw/theora` | ||
- `/camera/depth/metadata` | ||
- `/camera/depth/points` | ||
- `/camera/depth_filter_status` | ||
- `/camera/depth_registered/points` | ||
- `/camera/depth_to_color` | ||
- `/camera/depth_to_left_ir` | ||
- `/camera/depth_to_right_ir` | ||
|
||
- **红外相机主题:** | ||
- `/camera/left_ir/camera_info` | ||
- `/camera/left_ir/image_raw` | ||
- `/camera/left_ir/image_raw/compressed` | ||
- `/camera/left_ir/image_raw/compressedDepth` | ||
- `/camera/left_ir/image_raw/theora` | ||
- `/camera/left_ir/metadata` | ||
- `/camera/right_ir/camera_info` | ||
- `/camera/right_ir/image_raw` | ||
- `/camera/right_ir/image_raw/compressed` | ||
- `/camera/right_ir/image_raw/compressedDepth` | ||
- `/camera/right_ir/image_raw/theora` | ||
- `/camera/right_ir/metadata` | ||
|
||
- **杂项主题:** | ||
- `/diagnostics` | ||
- `/parameter_events` | ||
- `/rosout` | ||
- `/rosout_agg` | ||
|
||
### 在RViz2中可视化数据 | ||
|
||
要查看点云或图像数据,请使用RViz2: | ||
|
||
1. 启动RViz2。 | ||
2. 从发布的主题列表中选择您希望可视化的主题。 | ||
3. 将选定的主题添加到RViz2中开始查看数据。 | ||
|
||
### 示例可视化 | ||
|
||
以下是在RViz2中可视化可能出现的示例: | ||
|
||
- **点云可视化** | ||
 | ||
|
||
- **图像数据可视化** | ||
 |