refactor: reorganize multi-camera examples

This commit is contained in:
slz
2026-09-07 11:27:57 +08:00
parent d38f0db90d
commit 7c4954791c
9 changed files with 315 additions and 290 deletions
@@ -0,0 +1,22 @@
# GMSL Multi-Camera Synchronization
This example starts two GMSL-connected Gemini 330 Series cameras in hardware synchronization
mode. It uses the package's standard `gemini_330_series.launch.py` file.
Before starting the cameras, grant access to the camera synchronization device:
```bash
sudo chmod 777 /dev/camsync
```
Before starting the example, update the `usb_port` values in
`multi_gmsl_camera_synced.launch.py` if your system reports different GMSL links. The default
values are `gmsl2-1` and `gmsl2-3`.
```bash
ros2 launch orbbec_camera multi_gmsl_camera_synced.launch.py
```
Both cameras use `secondary_synced` mode. `camera_01` enables the host-side GMSL trigger at
30 fps (`gmsl_trigger_fps=3000`), while `camera_02` receives the same trigger. The receiving
camera is started first, followed by the trigger-generating camera after two seconds.
@@ -0,0 +1,52 @@
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription, GroupAction, TimerAction
from launch.launch_description_sources import PythonLaunchDescriptionSource
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")
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": "gmsl2-1",
"device_num": "2",
"sync_mode": "secondary_synced",
"gmsl_trigger_fps": "3000",
"enable_gmsl_trigger": "true",
"config_file_path": secondary_config_file_path,
}.items(),
)
launch2_include = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(launch_file_dir, "gemini_330_series.launch.py")
),
launch_arguments={
"camera_name": "camera_02",
"usb_port": "gmsl2-3",
"device_num": "2",
"sync_mode": "secondary_synced",
"config_file_path": secondary_config_file_path,
}.items(),
)
# Launch description
ld = LaunchDescription(
[
TimerAction(period=0.0, actions=[GroupAction([launch2_include])]),
TimerAction(period=2.0, actions=[GroupAction([launch1_include])]),
# The camera that enables the GMSL trigger should be launched at last
]
)
return ld