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

54 lines
1.9 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, TimerAction
2023-08-22 21:59:43 +08:00
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',
2025-03-03 11:19:29 +08:00
'usb_port': '2-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',
'log_level': 'none',
'log_file_name': 'camera_01.log',
2023-08-22 21:59:43 +08:00
}.items()
)
launch2_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={
'camera_name': 'camera_02',
2025-03-03 11:19:29 +08:00
'usb_port': '2-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',
'log_level': 'none',
'log_file_name': 'camera_02.log',
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([
TimerAction(period=0.0, actions=[GroupAction([launch2_include])]),
TimerAction(period=2.0, actions=[GroupAction([launch1_include])]),
2023-08-22 21:59:43 +08:00
])
return ld