Files
OrbbecSDK_ROS2/orbbec_camera/launch/multi_camera.launch.py
T

65 lines
2.1 KiB
Python
Raw Normal View History

2023-08-22 21:59:43 +08:00
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
2023-08-22 22:30:41 +08:00
from ament_index_python.packages import get_package_share_directory
import os
2023-08-22 21:59:43 +08:00
def generate_launch_description():
# Include launch files
2023-08-22 22:30:41 +08:00
package_dir = get_package_share_directory('orbbec_camera')
launch_file_dir = os.path.join(package_dir, 'launch')
2023-08-22 21:59:43 +08:00
launch1_include = IncludeLaunchDescription(
2023-08-22 22:30:41 +08:00
PythonLaunchDescriptionSource(
2024-05-09 18:07:04 +08:00
os.path.join(launch_file_dir, 'gemini_330_series.launch.py')
2023-08-22 22:30:41 +08:00
),
2023-08-22 21:59:43 +08:00
launch_arguments={
2023-08-22 22:30:41 +08:00
'camera_name': 'camera_01',
2024-10-16 22:25:35 +08:00
'usb_port': 'gmsl2-1',
2023-10-09 19:56:35 +08:00
'device_num': '2',
2024-10-16 22:25:35 +08:00
'sync_mode': 'standalone',
'enable_left_ir': 'true',
'enable_right_ir': 'true',
2023-08-22 21:59:43 +08:00
}.items()
)
2024-10-16 22:25:35 +08:00
# launch2_include = IncludeLaunchDescription(
# PythonLaunchDescriptionSource(
# os.path.join(launch_file_dir, 'gemini_330_series.launch.py')
# ),
# launch_arguments={
# 'camera_name': 'camera_02',
# 'usb_port': 'gmsl2-2',
# 'device_num': '3',
# 'sync_mode': 'standalone',
# 'enable_left_ir': 'false',
# 'enable_right_ir': 'false',
# }.items()
# )
launch3_include = IncludeLaunchDescription(
2023-08-22 22:30:41 +08:00
PythonLaunchDescriptionSource(
2024-05-09 18:07:04 +08:00
os.path.join(launch_file_dir, 'gemini_330_series.launch.py')
2023-08-22 22:30:41 +08:00
),
2023-08-22 21:59:43 +08:00
launch_arguments={
2024-10-16 22:25:35 +08:00
'camera_name': 'camera_03',
2024-09-10 22:07:31 +08:00
'usb_port': 'gmsl2-3',
2023-10-09 19:56:35 +08:00
'device_num': '2',
2024-10-16 22:25:35 +08:00
'sync_mode': 'standalone',
'enable_left_ir': 'true',
'enable_right_ir': 'true',
2023-08-22 21:59:43 +08:00
}.items()
)
2023-08-22 22:30:41 +08:00
# If you need more cameras, just add more launch_include here, and change the usb_port and device_num
2023-08-22 21:59:43 +08:00
# Launch description
ld = LaunchDescription([
GroupAction([launch1_include]),
2024-10-16 22:25:35 +08:00
# GroupAction([launch2_include]),
GroupAction([launch3_include]),
2023-08-22 21:59:43 +08:00
])
return ld