From 76aa7d22def51463f670d21ad9993618aad10b88 Mon Sep 17 00:00:00 2001 From: zhuangzi Date: Thu, 9 Jan 2025 17:28:33 +0800 Subject: [PATCH] add orbbec_multi_synced.launch.py --- .../launch/orbbec_multi_synced.launch.py | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 orbbec_camera/launch/orbbec_multi_synced.launch.py diff --git a/orbbec_camera/launch/orbbec_multi_synced.launch.py b/orbbec_camera/launch/orbbec_multi_synced.launch.py new file mode 100644 index 00000000..49a5c102 --- /dev/null +++ b/orbbec_camera/launch/orbbec_multi_synced.launch.py @@ -0,0 +1,65 @@ +from launch import LaunchDescription +from launch.actions import IncludeLaunchDescription, GroupAction, TimerAction +from launch.launch_description_sources import PythonLaunchDescriptionSource +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, 'orbbec_camera.launch.py') + ), + launch_arguments={ + "camera_model": "gemini330_series", + 'camera_name': 'camera_01', + "usb_port": "4-1", + "device_num": "3", + "sync_mode": "primary", + }.items() + ) + + launch2_include = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(launch_file_dir, 'orbbec_camera.launch.py') + ), + launch_arguments={ + "camera_model": "gemini330_series", + "attach_component_container_enable": "true", + 'camera_name': 'camera_02', + 'usb_port': '4-2', + 'device_num': '3', + "sync_mode": "secondary_synced", + }.items() + ) + + launch3_include = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + os.path.join(launch_file_dir, 'orbbec_camera.launch.py') + ), + launch_arguments={ + "camera_model": "gemini330_series", + "attach_component_container_enable": "true", + 'camera_name': 'camera_03', + 'usb_port': '4-3', + 'device_num': '3', + "sync_mode": "secondary_synced", + }.items() + ) + + # If you need more cameras, just add more launch_include here, and change the usb_port and device_num + + # Launch description + ld = LaunchDescription( + [ + TimerAction(period=3.0, actions=[GroupAction([launch1_include])]), + TimerAction(period=0.0, actions=[GroupAction([launch2_include])]), + TimerAction(period=1.0, actions=[GroupAction([launch3_include])]), + # The primary camera should be launched at last + ] + ) + + return ld \ No newline at end of file