2024-07-09 13:55:34 +08:00
|
|
|
import os
|
2024-07-17 20:32:10 +08:00
|
|
|
from ament_index_python.packages import get_package_share_directory
|
|
|
|
|
from launch import LaunchDescription
|
2024-09-12 16:49:13 +08:00
|
|
|
from launch_ros.actions import Node
|
2024-07-17 20:32:10 +08:00
|
|
|
from launch.actions import IncludeLaunchDescription, GroupAction, TimerAction
|
|
|
|
|
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
2024-07-09 13:55:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate_launch_description():
|
|
|
|
|
# Include launch files
|
2024-09-12 16:49:13 +08:00
|
|
|
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")
|
|
|
|
|
config_file_path = os.path.join(config_file_dir, "camera_params.yaml")
|
2024-11-06 20:04:23 +08:00
|
|
|
|
2024-12-06 09:57:31 +08:00
|
|
|
G330_0 = IncludeLaunchDescription(
|
2024-07-09 13:55:34 +08:00
|
|
|
PythonLaunchDescriptionSource(
|
2024-09-12 16:49:13 +08:00
|
|
|
os.path.join(launch_file_dir, "gemini_330_series.launch.py")
|
2024-07-09 13:55:34 +08:00
|
|
|
),
|
|
|
|
|
launch_arguments={
|
2024-12-06 09:57:31 +08:00
|
|
|
"camera_name": "G330_0",
|
2024-12-06 10:08:42 +08:00
|
|
|
"usb_port": "2-7",
|
2024-12-06 09:57:31 +08:00
|
|
|
"device_num": "2",
|
|
|
|
|
"sync_mode": "primary",
|
2024-09-12 16:49:13 +08:00
|
|
|
"config_file_path": config_file_path,
|
|
|
|
|
}.items(),
|
2024-07-09 13:55:34 +08:00
|
|
|
)
|
|
|
|
|
|
2024-12-06 09:57:31 +08:00
|
|
|
G330_1 = IncludeLaunchDescription(
|
2024-07-09 13:55:34 +08:00
|
|
|
PythonLaunchDescriptionSource(
|
2024-09-12 16:49:13 +08:00
|
|
|
os.path.join(launch_file_dir, "gemini_330_series.launch.py")
|
2024-07-09 13:55:34 +08:00
|
|
|
),
|
|
|
|
|
launch_arguments={
|
2024-12-06 09:57:31 +08:00
|
|
|
"camera_name": "G330_1",
|
2024-12-06 10:08:42 +08:00
|
|
|
"usb_port": "2-1",
|
2024-12-06 09:57:31 +08:00
|
|
|
"device_num": "2",
|
2024-11-06 20:04:23 +08:00
|
|
|
"sync_mode": "secondary_synced",
|
|
|
|
|
"config_file_path": config_file_path,
|
2024-12-30 14:06:18 +08:00
|
|
|
"trigger_out_enabled": "false"
|
2024-11-06 20:04:23 +08:00
|
|
|
}.items(),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If you need more cameras, just add more launch_include here, and change the usb_port and device_num
|
2024-07-09 13:55:34 +08:00
|
|
|
|
|
|
|
|
# Launch description
|
2024-09-12 16:49:13 +08:00
|
|
|
ld = LaunchDescription(
|
|
|
|
|
[
|
2024-12-06 09:57:31 +08:00
|
|
|
|
2024-12-24 22:12:33 +08:00
|
|
|
TimerAction(period=0.0, actions=[GroupAction([G330_1])]),
|
2024-12-06 10:08:42 +08:00
|
|
|
TimerAction(period=2.0, actions=[GroupAction([G330_0])]),
|
2024-11-06 20:04:23 +08:00
|
|
|
# The primary camera should be launched at last
|
2024-09-12 16:49:13 +08:00
|
|
|
]
|
|
|
|
|
)
|
2024-07-17 20:32:10 +08:00
|
|
|
|
2024-09-12 16:49:13 +08:00
|
|
|
return ld
|
2024-12-06 09:57:31 +08:00
|
|
|
|