mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-10 14:39:49 +08:00
[launch]Update multi_camera_synced_components.launch.py
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
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
|
|
||||||
from ament_index_python.packages import get_package_share_directory
|
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
|
from ament_index_python.packages import get_package_share_directory
|
||||||
|
from launch import LaunchDescription
|
||||||
|
from launch_ros.actions import Node
|
||||||
|
from launch.actions import IncludeLaunchDescription, GroupAction, TimerAction
|
||||||
|
from launch.event_handlers import OnProcessExit
|
||||||
|
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||||
|
from launch.actions import DeclareLaunchArgument
|
||||||
from launch.conditions import UnlessCondition, IfCondition
|
from launch.conditions import UnlessCondition, IfCondition
|
||||||
from launch.substitutions import LaunchConfiguration
|
from launch.substitutions import LaunchConfiguration
|
||||||
from launch.actions import TimerAction
|
from launch.substitutions import TextSubstitution
|
||||||
def generate_launch_description():
|
def generate_launch_description():
|
||||||
# Include launch files
|
# Include launch files
|
||||||
package_dir = get_package_share_directory("orbbec_camera")
|
package_dir = get_package_share_directory("orbbec_camera")
|
||||||
@@ -15,50 +18,57 @@ def generate_launch_description():
|
|||||||
config_file_335_path = os.path.join(config_file_dir, "camera_335_params.yaml")
|
config_file_335_path = os.path.join(config_file_dir, "camera_335_params.yaml")
|
||||||
config_file_335L_path = os.path.join(config_file_dir, "camera_335L_params.yaml")
|
config_file_335L_path = os.path.join(config_file_dir, "camera_335L_params.yaml")
|
||||||
|
|
||||||
use_intra_process_comms_arg = DeclareLaunchArgument(
|
use_intra_process_comms_declare = DeclareLaunchArgument(
|
||||||
'use_intra_process_comms', default_value='false',
|
'use_intra_process_comms', default_value='false',
|
||||||
)
|
)
|
||||||
attach_to_shared_component_container_arg = DeclareLaunchArgument(
|
attach_to_shared_component_container_declare = DeclareLaunchArgument(
|
||||||
'attach_to_shared_component_container', default_value='false',
|
'attach_to_shared_component_container', default_value='false',
|
||||||
)
|
)
|
||||||
|
component_container_name_declare = DeclareLaunchArgument(
|
||||||
|
'component_container_name', default_value='shared_orbbec_container'
|
||||||
|
)
|
||||||
|
|
||||||
shared_container_name = "shared_orbbec_container"
|
attach_to_shared_component_container_arg = LaunchConfiguration('attach_to_shared_component_container', default=False)
|
||||||
shared_container = Node(
|
component_container_name_arg = LaunchConfiguration('component_container_name', default='shared_orbbec_container')
|
||||||
name=shared_container_name,
|
|
||||||
|
shared_orbbec_container = Node(
|
||||||
|
name=component_container_name_arg,
|
||||||
package='rclcpp_components',
|
package='rclcpp_components',
|
||||||
executable='component_container_mt',
|
executable='component_container_mt',
|
||||||
output='screen',
|
output='screen',
|
||||||
condition=IfCondition(LaunchConfiguration('attach_to_shared_component_container'))
|
condition=UnlessCondition(attach_to_shared_component_container_arg)
|
||||||
)
|
)
|
||||||
|
|
||||||
G0_6D = IncludeLaunchDescription(
|
attach_to_shared_component_container_arg = TextSubstitution(text='true')
|
||||||
|
|
||||||
|
G0_41 = IncludeLaunchDescription(
|
||||||
PythonLaunchDescriptionSource(
|
PythonLaunchDescriptionSource(
|
||||||
os.path.join(launch_file_dir, "gemini_330_series_interleave_laser_g335_components.launch.py")
|
os.path.join(launch_file_dir, "gemini_330_series_interleave_laser_g335_components.launch.py")
|
||||||
),
|
),
|
||||||
launch_arguments={
|
launch_arguments={
|
||||||
"camera_name": "G0_6D",
|
"camera_name": "G0_41",
|
||||||
"usb_port": "2-3.2",
|
"usb_port": "2-7",
|
||||||
"device_num": "2",
|
"device_num": "2",
|
||||||
"sync_mode": "primary",
|
"sync_mode": "primary",
|
||||||
'use_intra_process_comms': LaunchConfiguration("use_intra_process_comms"),
|
'use_intra_process_comms': LaunchConfiguration("use_intra_process_comms"),
|
||||||
'attach_to_shared_component_container': LaunchConfiguration("attach_to_shared_component_container"),
|
'attach_to_shared_component_container': attach_to_shared_component_container_arg,
|
||||||
'component_container_name': shared_container_name,
|
'component_container_name': component_container_name_arg,
|
||||||
"config_file_path": config_file_335_path,
|
"config_file_path": config_file_335_path,
|
||||||
}.items(),
|
}.items(),
|
||||||
)
|
)
|
||||||
|
|
||||||
G1_6H = IncludeLaunchDescription(
|
G1_50 = IncludeLaunchDescription(
|
||||||
PythonLaunchDescriptionSource(
|
PythonLaunchDescriptionSource(
|
||||||
os.path.join(launch_file_dir, "gemini_330_series_interleave_laser_g335_components.launch.py")
|
os.path.join(launch_file_dir, "gemini_330_series_interleave_laser_g335_components.launch.py")
|
||||||
),
|
),
|
||||||
launch_arguments={
|
launch_arguments={
|
||||||
"camera_name": "G1_6H",
|
"camera_name": "G1_50",
|
||||||
"usb_port": "2-3.1",
|
"usb_port": "2-1",
|
||||||
"device_num": "2",
|
"device_num": "2",
|
||||||
"sync_mode": "secondary_synced",
|
"sync_mode": "secondary_synced",
|
||||||
'use_intra_process_comms': LaunchConfiguration("use_intra_process_comms"),
|
'use_intra_process_comms': LaunchConfiguration("use_intra_process_comms"),
|
||||||
'attach_to_shared_component_container': LaunchConfiguration("attach_to_shared_component_container"),
|
'attach_to_shared_component_container': attach_to_shared_component_container_arg,
|
||||||
'component_container_name': shared_container_name,
|
'component_container_name': component_container_name_arg,
|
||||||
"config_file_path": config_file_335_path,
|
"config_file_path": config_file_335_path,
|
||||||
}.items(),
|
}.items(),
|
||||||
)
|
)
|
||||||
@@ -66,14 +76,13 @@ def generate_launch_description():
|
|||||||
|
|
||||||
# If you need more cameras, just add more launch_include here, and change the usb_port and device_num
|
# If you need more cameras, just add more launch_include here, and change the usb_port and device_num
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ld = LaunchDescription([
|
ld = LaunchDescription([
|
||||||
use_intra_process_comms_arg,
|
use_intra_process_comms_declare,
|
||||||
attach_to_shared_component_container_arg,
|
attach_to_shared_component_container_declare,
|
||||||
shared_container,
|
component_container_name_declare,
|
||||||
GroupAction([G0_6D]),
|
shared_orbbec_container,
|
||||||
TimerAction(period=0.5, actions=[GroupAction([G1_6H])]),
|
G1_50,
|
||||||
|
TimerAction(period=3.0, actions=[G0_41]),
|
||||||
])
|
])
|
||||||
|
|
||||||
return ld
|
return ld
|
||||||
|
|||||||
Reference in New Issue
Block a user