forked from orbbec/OrbbecSDK_ROS2
-
Notifications
You must be signed in to change notification settings - Fork 0
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
15 changed files
with
318 additions
and
4 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 @@ | ||
## Aligning Depth to Color in ROS 2 | ||
|
||
This section explains how to align depth images with color images to create an overlay image using ROS 2. This is particularly useful for applications requiring synchronized visual information from different sensor modalities. | ||
|
||
### Commands to Align and View Depth and Color Images | ||
|
||
1. **Basic Depth to Color Alignment:** | ||
|
||
To simply align the depth image to the color image, use the following command: | ||
|
||
```bash | ||
ros2 launch orbbec_camera gemini2R.launch.py depth_registration:=true | ||
``` | ||
|
||
This command activates the depth registration feature without opening a viewer. | ||
|
||
2. **Viewing Depth to Color Overlay:** | ||
|
||
If you wish to view the depth to color overlay, you need to enable the viewer by using the command below: | ||
|
||
```bash | ||
ros2 launch orbbec_camera gemini2R.launch.py depth_registration:=true enable_d2c_viewer:=true | ||
``` | ||
|
||
This launches the camera node with depth to color registration and opens a viewer to display the overlay image. | ||
|
||
### Selecting Topics in RViz2 | ||
|
||
To visualize the aligned images in RViz2: | ||
|
||
1. Launch RViz2 after running one of the above commands. | ||
2. Select the topic for the depth to color overlay image. An example topic selection is shown here: | ||
|
||
 | ||
|
||
### Example of Depth to Color Overlay | ||
|
||
After selecting the appropriate topic in RViz2, you will be able to see the depth to color overlay image. Here's what it might look like: | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,108 @@ | ||
## Using Multiple Cameras with the Orbbec ROS 2 Package | ||
|
||
This section describes how to configure and use multiple Orbbec cameras simultaneously in a ROS 2 environment. | ||
|
||
### Identifying Camera USB Ports | ||
|
||
#### Script to List Connected Cameras | ||
|
||
To determine which USB ports the cameras are connected to, you can use the following bash script. This script lists all Orbbec devices attached to the system along with their USB port and serial number. | ||
|
||
```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) # product name | ||
serial=$(cat "$dev/serial" 2>/dev/null) # serial number | ||
echo "Found Orbbec device $product, usb port $port, serial number $serial" | ||
fi | ||
fi | ||
done | ||
``` | ||
|
||
Save this script to a file and execute it in your terminal to output a list of connected cameras. | ||
|
||
### Launching Multiple Cameras | ||
|
||
#### Setup for Multiple Camera Launch | ||
|
||
You can launch multiple cameras by specifying different USB ports for each camera. Below is an example Python script that uses the ROS 2 launch system to start two cameras with individual configurations. | ||
|
||
```python | ||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, GroupAction, ExecuteProcess | ||
from launch.launch_description_sources 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, 'gemini2R.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, 'gemini2R.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 | ||
``` | ||
|
||
#### Running the Launch File | ||
|
||
To execute the launch configuration for multiple cameras, use the command: | ||
|
||
```bash | ||
ros2 launch orbbec_camera multi_camera.launch.py | ||
``` | ||
|
||
### Configuring the TF Tree for Multiple Cameras | ||
|
||
#### Example TF Configuration for Two Cameras | ||
|
||
When using multiple cameras, it's essential to calibrate them and publish a static TF tree for each camera. The following Python script configures the TF tree based on your calibration results: | ||
|
||
```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 | ||
``` | ||
|
||
Save this configuration as `multi_camera_tf.launch.py` in the launch directory of the Orbbec camera package. To run it, use: | ||
|
||
```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 @@ | ||
## Enabling and Visualizing Point Cloud in ROS 2 | ||
|
||
This section demonstrates how to enable point cloud data output from the camera node and visualize it using RViz2, similarly to the initial camera node setup discussed in the [Starting Camera Node](./start_camera_node.MD) document. | ||
|
||
### Enabling Depth Point Cloud | ||
|
||
#### Command to Enable Depth Point Cloud | ||
|
||
To activate the point cloud data stream for depth information, use the following command: | ||
|
||
```bash | ||
ros2 launch orbbec_camera gemini2R.launch.py enable_point_cloud:=true | ||
``` | ||
|
||
#### Visualizing Depth Point Cloud in RViz2 | ||
|
||
After running the above command, perform the following steps to visualize the depth point cloud: | ||
|
||
1. Open RViz2. | ||
2. Add a `PointCloud2` display. | ||
3. Select the `/camera/depth/points` topic for visualization. | ||
4. Set the fixed frame to `camera_link` to properly align the data. | ||
|
||
##### Example Visualization | ||
|
||
Here is what the depth point cloud might look like in RViz2: | ||
|
||
 | ||
|
||
### Enabling Colored Point Cloud | ||
|
||
#### Command to Enable Colored Point Cloud | ||
|
||
To enable the colored point cloud feature, enter the following command: | ||
|
||
```bash | ||
ros2 launch orbbec_camera gemini2R.launch.py enable_colored_point_cloud:=true | ||
``` | ||
|
||
#### Visualizing Colored Point Cloud in RViz2 | ||
|
||
To visualize the colored point cloud data: | ||
|
||
1. Launch RViz2 following the command execution. | ||
2. Add a `PointCloud2` display panel. | ||
3. Choose the `/camera/depth_registered/points` topic from the list. | ||
4. Ensure the fixed frame is set to `camera_link`. | ||
|
||
##### Example Visualization | ||
|
||
The result of the colored point cloud in RViz2 should look similar to this: | ||
|
||
 |
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,83 @@ | ||
## Starting the Camera Node in ROS 2 | ||
|
||
This guide provides instructions on how to launch the camera node with a colored point cloud feature enabled using ROS 2. | ||
|
||
### Command to Start the Node | ||
|
||
To start the camera node, execute the following command in your terminal: | ||
|
||
```bash | ||
ros2 launch orbbec_camera gemini2R.launch.py enable_colored_point_cloud:=true | ||
``` | ||
|
||
This command initiates the camera node and enables the colored point cloud. | ||
|
||
### Published Topics | ||
|
||
Once the camera node is running, it will publish data on several ROS topics. Below is a list of the available topics: | ||
|
||
- **IMU and Gyro Information:** | ||
- `camera/accel/imu_info` | ||
- `camera/gyro/imu_info` | ||
- `camera/gyro_accel/sample` | ||
|
||
- **Color Camera Topics:** | ||
- `/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` | ||
|
||
- **Depth Camera Topics:** | ||
- `/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` | ||
|
||
- **Infrared Camera Topics:** | ||
- `/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` | ||
|
||
- **Miscellaneous Topics:** | ||
- `/diagnostics` | ||
- `/parameter_events` | ||
- `/rosout` | ||
- `/rosout_agg` | ||
|
||
### Visualizing Data in RViz2 | ||
|
||
To view the PointCloud or Image data, use RViz2: | ||
|
||
1. Launch RViz2. | ||
2. Select the topic you wish to visualize from the list of published topics. | ||
3. Add the selected topic to RViz2 to start viewing the data. | ||
|
||
### Example Visualizations | ||
|
||
Here are examples of how the visualization might appear in RViz2: | ||
|
||
- **PointCloud Visualization** | ||
 | ||
|
||
- **Image Data Visualization** | ||
 | ||
|
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
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
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
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
Binary file not shown.