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-05-09 18:07:04 +08:00
|
|
|
'usb_port': '2-1.1',
|
2023-10-09 19:56:35 +08:00
|
|
|
'device_num': '2',
|
2024-05-27 10:42:09 +08:00
|
|
|
'sync_mode': 'standalone'
|
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={
|
2023-08-22 22:30:41 +08:00
|
|
|
'camera_name': 'camera_02',
|
2024-05-09 18:07:04 +08:00
|
|
|
'usb_port': '2-1.2.1',
|
2023-10-09 19:56:35 +08:00
|
|
|
'device_num': '2',
|
2024-05-27 10:42:09 +08:00
|
|
|
'sync_mode': 'standalone'
|
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]),
|
|
|
|
|
GroupAction([launch2_include]),
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
return ld
|