示例#1
0
def generate_launch_description():
    container_1 = ComposableNodeContainer(
        node_name='container_1',
        node_namespace='',
        package='rclcpp_components',
        node_executable='component_container',
        composable_node_descriptions=[
            ComposableNode(package='hello_world_cpp',
                           node_plugin='hello_world_cpp::Talker',
                           node_name='talker')
        ],
        output='screen',
    )
    container_2 = ComposableNodeContainer(
        node_name='container_2',
        node_namespace='',
        package='rclcpp_components',
        node_executable='component_container',
        composable_node_descriptions=[
            ComposableNode(package='hello_world_cpp',
                           node_plugin='hello_world_cpp::Listener',
                           node_name='listener')
        ],
        output='screen',
    )
    return launch.LaunchDescription([container_1, container_2])
示例#2
0
def generate_launch_description():

    ld = launch.LaunchDescription()

    config = os.path.join(
        get_package_share_directory('triton_object_recognition'), 'config',
        'tiny_yolov3.yaml')

    object_recognizer = ComposableNode(
        name='object_recognizer',
        namespace='/triton',
        package='triton_object_recognition',
        parameters=[config],
        plugin='triton_object_recognition::ObjectRecognizer')

    object_recognizer_container = ComposableNodeContainer(
        name='object_recognizer_container',
        namespace='/tritonimage_underwater',
        package='rclcpp_components',
        executable='component_container',
        composable_node_descriptions=[object_recognizer],
        output='screen')

    ld.add_action(object_recognizer_container)

    return ld
示例#3
0
def generate_launch_description():

    ld = LaunchDescription()

    component_one = ComposableNode(name='component_one',
                                   namespace='/triton',
                                   package='triton_example',
                                   plugin='triton_example::ComponentOne')

    component_two = ComposableNode(name='component_two',
                                   namespace='/triton',
                                   package='triton_example',
                                   plugin='triton_example::ComponentTwo')

    example_container = ComposableNodeContainer(
        name='example_container',
        namespace='/triton',
        package='rclcpp_components',
        executable='component_container',
        composable_node_descriptions=[component_one, component_two],
        output='screen')

    ld.add_action(example_container)

    return ld
def generate_launch_description():
    """Generate launch description with multiple components."""
    container = ComposableNodeContainer(
        name='object_tracking_container',
        namespace='',
        package='rclcpp_components',
        executable='component_container_mt',
        composable_node_descriptions=[
            ComposableNode(package='raspimouse_ros2_examples',
                           plugin='object_tracking::Tracker',
                           name='tracker'),
            ComposableNode(package='raspimouse',
                           plugin='raspimouse::Raspimouse',
                           name='raspimouse',
                           parameters=[{
                               'use_light_sensors': False
                           }]),
        ],
        output='screen',
    )

    manager = Node(name='manager',
                   package='raspimouse_ros2_examples',
                   executable='lifecycle_node_manager',
                   output='screen',
                   parameters=[{
                       'components': ['raspimouse', 'tracker']
                   }])

    return launch.LaunchDescription([container, manager])
示例#5
0
def generate_launch_description():
    container = ComposableNodeContainer(
            name='preception_bringup_container',
            namespace='perception',
            package='rclcpp_components',
            executable='component_container_mt',
            composable_node_descriptions=[
                # getImageDecompressorComponent('front_camera'),
                # getImageRectifyComponent('front_camera'),
                getScanSgementationComponent(),
                getCropHullFilterComponent(),
                getPointCloudToLaserScanComponent(),
                getRadiusOutlierRemovalComponent('front_lidar'),
                getRadiusOutlierRemovalComponent('rear_lidar'),
                getRadiusOutlierRemovalComponent('right_lidar'),
                getRadiusOutlierRemovalComponent('left_lidar'),
                getPointsTransformComponent('front_lidar'),
                getPointsTransformComponent('rear_lidar'),
                getPointsTransformComponent('right_lidar'),
                getPointsTransformComponent('left_lidar'),
                getPointsConcatenateComponent()#,
                #getCostmapCalculatorComponent()
            ],
            output='screen'
    )
    return launch.LaunchDescription([
        container
        ])
示例#6
0
def generate_launch_description():
    """Generate launch description with multiple components."""
    ros2_serial_example_directory = os.path.join(
        get_package_share_directory('ros2_serial_example'), 'config')

    param_config = os.path.join(ros2_serial_example_directory,
                                'default_ros2_to_serial_bridge_params.yaml')

    with open(param_config, 'r') as f:
        params = yaml.safe_load(
            f)['iris_0/ros2_to_serial_bridge']['ros__parameters']

    print(params)

    container = ComposableNodeContainer(
        node_name='componsable_drone_node',
        node_namespace='/iris_0',
        package='rclcpp_components',
        node_executable='component_container',
        composable_node_descriptions=[
            ComposableNode(
                node_name='ros2_to_serial_bridge',
                node_namespace='/iris_0',
                package='ros2_serial_example',
                node_plugin='ros2_to_serial_bridge::ROS2ToSerialBridge',
                parameters=[params]),
        ],
        output='screen',
    )

    return launch.LaunchDescription([container])
示例#7
0
def generate_launch_description():

    ld = launch.LaunchDescription()

    imu_driver = ComposableNode(name='driver',
                                namespace='/tr/drivers/imu',
                                package='phidgets_spatial',
                                plugin='phidgets::SpatialRosI')

    imu_filter = ComposableNode(name='filter',
                                namespace='/tr/drivers/imu',
                                package='imu_filter_madgwick',
                                plugin='ImuFilterMadgwickRos')

    imu_container = ComposableNodeContainer(
        name='imu_container',
        namespace='/tr/drivers/imu',
        package='rclcpp_components',
        executable='component_container',
        composable_node_descriptions=[imu_driver, imu_filter],
        output='screen')

    ld.add_action(imu_container)

    return ld
示例#8
0
def generate_launch_description():
    """Generate launch description with multiple components."""
    container = ComposableNodeContainer(
            node_name='phidget_container',
            node_namespace='',
            package='rclcpp_components',
            node_executable='component_container',
            composable_node_descriptions=[
                ComposableNode(
                    package='phidgets_digital_inputs',
                    node_plugin='phidgets::DigitalInputsRosI',
                    node_name='phidgets_digital_inputs1',
                    parameters=[{'serial':-1,'hub_port':1,'is_hub_port_device':True,'publish_rate':0}],
                ),
                ComposableNode(
                    package='phidgets_digital_inputs',
                    node_plugin='phidgets::DigitalInputsRosI',
                    node_name='phidgets_digital_inputs3',
                    parameters=[{'serial':-1,'hub_port':3,'is_hub_port_device':True,'publish_rate':0}],
                ),
                # ComposableNode(
                #     package='phidgets_motors',
                #     node_plugin='phidgets::MotorsRosI',
                #     node_name='phidgets_motors',
                #     parameters=[{'serial':-1,'hub_port':0,'braking_strength':0.0,'data_interval_ms':250,'publish_rate':0}],
                # ),
            ],
            output='screen',
    )

    return launch.LaunchDescription([container])
示例#9
0
def generate_launch_description():
    default_yaml = os.path.join(get_package_share_directory('dynamic_vino_sample'), 'param',
                                'pipeline_composite_object_topic.yaml')
    container = ComposableNodeContainer(
        node_name='vision_pipeline',
        node_namespace='',
        package='rclcpp_components',
        node_executable='component_container',
        composable_node_descriptions=[
            ComposableNode(
                package='realsense_ros',
                node_plugin='realsense::RealSenseNodeFactory',
                node_name='realsense',
                parameters=[get_package_share_directory('realsense_examples')+'/config/d435i.yaml'],
                extra_arguments=[{'use_intra_process_comms':'true'}]),
            ComposableNode(
                package='dynamic_vino_sample',
                node_plugin='ComposablePipeline',
                node_name='composable_pipeline',
                parameters=[{"config":default_yaml}],
                remappings=[
                ('/openvino_toolkit/object/detected_objects',
                 '/ros2_openvino_toolkit/detected_objects'),
                ('/openvino_toolkit/object/images', '/ros2_openvino_toolkit/image_rviz')],
                extra_arguments=[{'use_intra_process_comms':'true'}]
            )
            ],
            output='screen',
    )

    return launch.LaunchDescription([container])
def generate_launch_description():
    """Generate launch description with multiple components."""
    container = ComposableNodeContainer(
        name='my_container',
        namespace='maila',
        package='rclcpp_components',
        executable='component_container',
        composable_node_descriptions=[
            ComposableNode(package='i2c_server',
                           plugin='i2c_server::I2CServer',
                           name='custom_i2c_server'),
            ComposableNode(package='encoders',
                           plugin='encoders::EncodersComponent',
                           name='custom_encoders',
                           parameters=[
                               os.path.join(
                                   get_package_share_directory('encoders'),
                                   "config", "defaults.yaml")
                           ])
        ],
        output='screen',
        emulate_tty=True,
    )

    return launch.LaunchDescription([container])
示例#11
0
def generate_launch_description():

    localization_config = load_yaml('crs_application',
                                    'config/localization.yaml')
    general_params = {'general': localization_config['general']}
    icp_params = {'icp': localization_config['icp']}
    crop_boxes_params = {'crop_boxes': localization_config['crop_boxes']}

    # ComposableNodeContainer not used because it fails to load parameters, using node instead
    container = ComposableNodeContainer(
        node_name='perception',
        node_namespace=
        GLOBAL_NS,  #launch.substitutions.LaunchConfiguration('global_ns'),
        package='rclcpp_components',
        node_executable='component_container',
        composable_node_descriptions=[
            ComposableNode(
                package='crs_perception',
                node_plugin='crs_perception::LocalizeToPart',
                node_name='part_localization',
                node_namespace=
                GLOBAL_NS,  #launch.substitutions.LaunchConfiguration('global_ns')),
                parameters=[icp_params, crop_boxes_params])
        ],
        output='screen')

    part_localization_node = Node(
        node_executable='localize_to_part',
        package='crs_perception',
        node_name='part_localization',
        node_namespace=GLOBAL_NS,
        output='screen',
        parameters=[general_params, icp_params, crop_boxes_params])

    return launch.LaunchDescription([part_localization_node])
def generate_launch_description():

    ld = launch.LaunchDescription()

    pkg_name = "ros2_examples"
    pkg_share_path = get_package_share_directory(pkg_name)

    namespace = 'nmspc1'
    ld.add_action(
        ComposableNodeContainer(
            namespace='',
            name=namespace + '_tf2_broadcaster_example',
            package='rclcpp_components',
            executable=
            'component_container_mt',  # this struggles to maintain timer rates!!!!!!!!!!
            # executable='component_container', # this maintains the rates fine
            composable_node_descriptions=[
                ComposableNode(
                    package=pkg_name,
                    plugin='ros2_examples::Tf2BroadcasterExample',
                    namespace=namespace,
                    name='tf2_broadcaster_example',
                ),
            ],
            output='screen',
        ))

    return ld
示例#13
0
def generate_launch_description():

    ld = launch.LaunchDescription()

    pkg_name = "ros2_examples"
    pkg_share_path = get_package_share_directory(pkg_name)

    namespace='nmspc1'
    ld.add_action(ComposableNodeContainer(
        namespace='',
        name=namespace+'_service_client_example',
        package='rclcpp_components',
        executable='component_container_mt',
        composable_node_descriptions=[
            ComposableNode(
                package=pkg_name,
                plugin='ros2_examples::ServiceClientExample',
                namespace=namespace,
                name='service_client_example',
                parameters=[
                    pkg_share_path + '/config/service_client_example.yaml',
                ],
                remappings=[
                    # services
                    ("~/set_bool_out", "/nmspc1/service_server_example/set_bool"),
                ],
            )
        ],
        output='screen',
    ))

    return ld
示例#14
0
def generate_launch_description():

    ld = launch.LaunchDescription()

    pkg_name = "ros2_examples"
    pkg_share_path = get_package_share_directory(pkg_name)

    namespace = 'nmspc1'
    ld.add_action(
        ComposableNodeContainer(
            namespace='',
            name=namespace + '_subscriber_example',
            package='rclcpp_components',
            executable='component_container_mt',
            composable_node_descriptions=[
                ComposableNode(
                    package=pkg_name,
                    plugin='ros2_examples::SubscriberExample',
                    namespace=namespace,
                    name='subscriber_example',
                    parameters=[
                        pkg_share_path + '/config/subscriber_example.yaml',
                    ],
                    remappings=[
                        # topics
                        ("~/topic_in", "/nmspc1/publisher_example/topic"),
                    ],
                )
            ],
            output='screen',
        ))

    return ld
示例#15
0
def generate_launch_description():
    return LaunchDescription([
        # We can't include this file in a <group> tag if it declares arguments
        # Related issue: https://github.com/ros2/launch_ros/issues/114
        # DeclareLaunchArgument(
        #     name='approximate_sync', default_value='True',
        #     description='Whether to use approximate synchronization of topics. Set to true if '
        #                 'the left and right cameras do not produce exactly synced timestamps.'
        # ),
        ComposableNodeContainer(
            package='rclcpp_components', node_executable='component_container',
            name='stereo_image_proc_container', namespace='', output='screen',
            composable_node_descriptions=[
                ComposableNode(
                    package='stereo_image_proc',
                    plugin='stereo_image_proc::DisparityNode',
                    namespace='/mycamera',
                    parameters=[{'approximate_sync': True, 'use_sim_time': True}],
                    remappings=[
                        ('right/image_rect', 'right/image_filtered'),
                        ('left/image_rect', 'left/image_filtered'),
                        ('left/image_rect_color', 'left/image_filtered')
                    ]
                ),
                ComposableNode(
                    package='stereo_image_proc',
                    plugin='stereo_image_proc::PointCloudNode',
                    namespace='/mycamera',
                    parameters=[{'approximate_sync': True, 'use_sim_time': True}],
                    remappings=[('left/image_rect_color', 'left/image_filtered')]
                ),
            ],
        ),
    ])
示例#16
0
def generate_launch_description():

    ld = launch.LaunchDescription()

    pkg_name = "ros2_examples"
    pkg_share_path = get_package_share_directory(pkg_name)

    namespace = 'nmspc1'
    ld.add_action(
        ComposableNodeContainer(
            namespace='',
            name=namespace + '_publisher_example',
            package='rclcpp_components',
            executable=
            'component_container_mt',  # this struggles to maintain timer rates!!!!!!!!!!
            # executable='component_container', # this maintains the rates fine
            composable_node_descriptions=[
                ComposableNode(
                    package=pkg_name,
                    plugin='ros2_examples::PublisherExample',
                    namespace=namespace,
                    name='publisher_example',
                    parameters=[
                        pkg_share_path + '/config/publisher_example.yaml',
                    ],
                    remappings=[
                        # topics
                        ("~/topic_out", "~/topic"),
                    ],
                ),
            ],
            output='screen',
        ))

    return ld
示例#17
0
def generate_launch_description():
    """create exposure control node."""
    container = ComposableNodeContainer(
            name='exposure_control_container',
            namespace='',
            package='rclcpp_components',
            executable='component_container',
            composable_node_descriptions=[
                ComposableNode(
                    package='exposure_control_ros2',
                    plugin='exposure_control_ros2::ExposureControl',
                    name=LaunchConfig('node_name'),
                    parameters=[{'cam_name': LaunchConfig('camera_name'),
                                 'max_gain': 10.0,
                                 'gain_priority': False,
                                 'brightness_target': 100,
                                 'max_exposure_time': 9000.0,
                                 'min_exposure_time': 3000.0
                    }],
                    remappings=[('~/meta', ['/', LaunchConfig('camera_name'),'/meta']),],
                    extra_arguments=[{'use_intra_process_comms': True}],
                ),
            ],
            output='screen',
    )
    name_arg = LaunchArg('node_name', default_value=['exposure_control'], description='name of node')
    cam_arg = LaunchArg('camera_name', default_value=['cam_0'], description='name of camera')
    return launch.LaunchDescription([name_arg, cam_arg, container])
示例#18
0
def generate_launch_description():
    
    """Generate launch description with multiple components."""
    container = ComposableNodeContainer(
            name='my_container',
            namespace='maila',
            package='rclcpp_components',
            executable='component_container',
            composable_node_descriptions=[
                ComposableNode(
                    package='i2c_server',
                    plugin='i2c_server::I2CServer',
                    name='custom_i2c_server'),
                ComposableNode(
                    package='joystick_command',
                    plugin='motor::JoystickCommand',
                    name='custom_joystick_command',
                    parameters = [os.path.join(get_package_share_directory('joystick_command'),"config","defaults.yaml")]),
                ComposableNode(
                    package='motors_interface',
                    plugin='motor::MotorComponent',
                    name='custom_motors_interface',
                    parameters = [os.path.join(get_package_share_directory('motors_interface'),"config","defaults.yaml")])
                    #parameters=[{'topics.in_mode':"cucu"}])
            ],
            output='screen',
            emulate_tty=True,
    )

    return launch.LaunchDescription([container])
def generate_launch_description():
    """Generate launch description with multiple components."""
    container = ComposableNodeContainer(
            package='rclcpp_components',
            node_name='ComponentManager',
            node_namespace=None,
            node_executable='component_container',
            composable_node_descriptions=[
                ComposableNode(
                    package='jetson_camera',
                    node_plugin='jetson_camera::JetsonCameraNode',
                    remappings=[('/image_raw', '/apriltag/image'), ('/camera_info', '/apriltag/camera_info')], 
                ), 
                ComposableNode(
                    package='apriltag_ros',
                    node_plugin='AprilTagNode',
                    parameters=[
                        '../config/apriltag.yaml', 
                    ]
                ), 
            ],
            #output='screen',
    )

    return launch.LaunchDescription([container])
def generate_launch_description():

    movie = 'test.mov'

    camera_info_path = 'info.ini'

    container = ComposableNodeContainer(
        node_name='my_container',
        node_namespace='',
        package='rclcpp_components',
        node_executable='component_container',
        composable_node_descriptions=[
            ComposableNode(package='opencv_cam',
                           node_plugin='opencv_cam::OpencvCamNode',
                           node_name='image_publisher',
                           parameters=[{
                               'file': False,
                               'filename': movie,
                               'camera_info_path': camera_info_path,
                           }]),
            ComposableNode(
                package='opencv_cam',
                node_plugin='opencv_cam::ImageSubscriberNode',
                node_name='image_subscriber',
            ),
        ],
        output='screen',
    )

    return launch.LaunchDescription([container])
示例#21
0
def generate_test_description():
    ld = LaunchDescription()

    pkg_name = 'triton_example'
    components = ['triton_example::ComponentOne', 'triton_example::ComponentTwo']

    example_container = ComposableNodeContainer(
        name='example_container',
        namespace='/',
        package='rclcpp_components',
        executable='component_container',
        output='screen'
    )

    # There is a bug when using launch_test with ComposableNode, need to use cli
    load_processes = {}
    load_actions = []
    for component in components:
        load_component = ExecuteProcess(
            cmd=['ros2', 'component', 'load' ,'/example_container', pkg_name, component]
        )
        name = component[component.index("::")+2:].lower()
        load_processes[name] = load_component
        load_actions.append(load_component)
    # Delay so container can start up before loading
    delayed_load = TimerAction(
        period=3.0,
        actions=load_actions
    )

    ld.add_action(example_container)
    ld.add_action(delayed_load)
    ld.add_action(launch_testing.actions.ReadyToTest())
    return ld, load_processes
示例#22
0
def generate_launch_description():

    producer = ComposableNode(
        package="intra_process",
        plugin="ProducerComponent",
        name="producer",
        extra_arguments=[{"use_intra_process_comms": True}],
    )

    consumer = ComposableNode(
        package="intra_process",
        plugin="ConsumerComponent",
        name="consumer",
        extra_arguments=[{"use_intra_process_comms": True}],
    )

    container = ComposableNodeContainer(
        package="rclcpp_components",
        namespace="/",
        executable='component_container_mt',
        name="intra_process_container",
        composable_node_descriptions=[producer, consumer],
    )

    return launch.LaunchDescription([container])
示例#23
0
def generate_test_description():
    ld = launch.LaunchDescription()

    pipeline_manager = Node(
        name='pipeline_manager',
        namespace='/triton',
        package='triton_pipeline',
        executable='pipeline_manager',
        output='screen'
    )

    pipeline_container = ComposableNodeContainer(
        name='pipeline',
        namespace='/triton',
        package='rclcpp_components',
        executable='component_container'
    )

    ld.add_action(pipeline_manager)
    ld.add_action(pipeline_container)
    ld.add_action(launch_testing.actions.ReadyToTest())

    return ld, {
        'pipeline_manager': pipeline_manager,
        'pipeline_container': pipeline_container
    }
示例#24
0
def generate_launch_description():
    urdf = os.path.join(get_package_share_directory('confbot_description'),
                        'urdf', 'confbot.urdf')

    return LaunchDescription([
        Node(package='robot_state_publisher',
             node_executable='robot_state_publisher',
             output='screen',
             arguments=[urdf]),
        Node(package='confbot_sensors',
             node_executable='confbot_laser',
             output='screen'),
        Node(package='confbot_tools',
             node_executable='safe_zone_publisher',
             output='screen'),
        ComposableNodeContainer(
            node_name='confbot_driver_container',
            node_namespace='',
            package='rclcpp_components',
            node_executable='component_container',
            composable_node_descriptions=[
                ComposableNode(
                    package='confbot_driver',
                    node_plugin='confbot_driver::nodes::ConfbotDriver',
                    node_name='confbot_driver'),
                ComposableNode(
                    package='confbot_driver',
                    node_plugin='confbot_driver::nodes::TwistPublisher',
                    node_name='twist_publisher')
            ],
            output='screen',
        )
    ])
示例#25
0
def generate_launch_description():
    """Generate launch description with multiple components."""
    container = ComposableNodeContainer(
        node_name='my_container',
        node_namespace='my_namespace',
        package='rclcpp_components',
        node_executable='component_container',
        composable_node_descriptions=[
            ComposableNode(package='demo_nodes_cpp',
                           node_plugin='demo_nodes_cpp::Talker',
                           node_name='talker'),
            ComposableNode(package='sw_watchdog',
                           node_plugin='sw_watchdog::SimpleHeartbeat',
                           node_name='heartbeat',
                           parameters=[{
                               'period': 200
                           }],
                           extra_arguments=[{
                               'use_intra_process_comms': True
                           }]),
        ],
        output='screen')

    # When Shutdown is requested (launch), clean up all child processes
    shutdown_handler = RegisterEventHandler(
        OnShutdown(
            on_shutdown=[
                # Log
                LogInfo(msg="heartbeat_composition was asked to shutdown."),
                # Clean up
                OpaqueFunction(function=group_stop),
            ], ))

    return launch.LaunchDescription([container, shutdown_handler])
示例#26
0
def generate_launch_description():

    param_config = os.path.join(
        get_package_share_directory('imu_filter_madgwick'), 'config',
        'imu_filter.yaml')

    # https://github.com/ros2/rclcpp/issues/715#issuecomment-490425249
    # Composable Nodes use different yaml parsing than a standalone node.
    # This code will load the parameters from the yaml (removing the namespace/nodename/ros__parameters heading) so
    # that the parameters are parsed and named properly for the composable node.
    with open(param_config, 'r') as f:
        params = yaml.safe_load(f)['imu_filter']['ros__parameters']

    container = ComposableNodeContainer(
        node_name='imu_filter_container',
        node_namespace='',
        package='rclcpp_components',
        node_executable='component_container',
        composable_node_descriptions=[
            ComposableNode(package='imu_filter_madgwick',
                           node_plugin='ImuFilterMadgwickRos',
                           node_name='imu_filter',
                           parameters=[params])
        ],
        output='screen')

    return launch.LaunchDescription([container])
示例#27
0
def generate_launch_description():
    share_dir = ament_index_python.packages.get_package_share_directory(
        'kobuki_safety_controller')
    # Passing parameters to a composed node must be done via a dictionary of
    # key -> value pairs.  Here we read in the data from the configuration file
    # and create a dictionary of it that the ComposableNode will accept.
    params_file = os.path.join(share_dir, 'config',
                               'safety_controller_params.yaml')
    with open(params_file, 'r') as f:
        params = yaml.safe_load(
            f)['kobuki_safety_controller_node']['ros__parameters']
    container = ComposableNodeContainer(
        node_name='safety_controller_container',
        node_namespace='',
        package='rclcpp_components',
        node_executable='component_container',
        composable_node_descriptions=[
            ComposableNode(
                package='kobuki_safety_controller',
                node_plugin='kobuki_safety_controller::SafetyController',
                node_name='safety_controller_node',
                parameters=[params]),
        ],
        output='both',
    )

    return LaunchDescription([container])
示例#28
0
    def container(self, name, namespace='', **container_args):
        '''
        Opens a Composition group to add nodes
        '''
        prev_index = self.index

        self.entities.append([])
        self.index = len(self.entities) - 1
        self.composed = True
        try:
            yield self
        finally:

            # restore state
            new_entities = self.entities[self.index]
            self.index = prev_index
            self.composed = False

            # store ComposableNodes inside a Container
            self.entity(
                ComposableNodeContainer(
                    name=name,
                    namespace=namespace,
                    package='rclcpp_components',
                    executable='component_container',
                    composable_node_descriptions=new_entities,
                    **container_args))
def generate_launch_description():
    rviz_config_dir = os.path.join(get_package_share_directory('navi_sim'),
                                   'config', 'navi_sim.rviz')
    description_dir = os.path.join(
        get_package_share_directory('wamv_description'), 'launch')
    simulator = ComposableNodeContainer(
        name='navi_sim_bringup_container',
        namespace='sensing',
        package='rclcpp_components',
        executable='component_container',
        composable_node_descriptions=[
            getNaviSimComponent(),
            getLidarSimComponent('front_lidar'),
            getLidarSimComponent('rear_lidar'),
            getLidarSimComponent('right_lidar'),
            getLidarSimComponent('left_lidar'),
            getCameraSimComponent('front_left_camera'),
            getCameraSimComponent('front_right_camera'),
            getCameraSimComponent('rear_left_camera'),
            getCameraSimComponent('rear_right_camera'),
            getCameraSimComponent('left_camera'),
            getCameraSimComponent('right_camera')
        ],
        output='screen')

    hermite_path_planner_package_path = get_package_share_directory(
        'hermite_path_planner_bringup')
    hermite_path_planner_launch_dir = os.path.join(
        hermite_path_planner_package_path, 'launch')
    perception_bringup_package_path = get_package_share_directory(
        'perception_bringup')
    perception_bringup_launch_dir = os.path.join(
        perception_bringup_package_path, 'launch')
    return LaunchDescription([
        simulator,
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource(
                [description_dir, '/wamv_description.launch.py']), ),
        Node(package='rviz2',
             executable='rviz2',
             name='rviz2',
             arguments=['-d', rviz_config_dir],
             output='screen'),
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource(
                [hermite_path_planner_launch_dir, '/bringup.launch.py'])),
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource([
                perception_bringup_launch_dir, '/perception_bringup.launch.py'
            ])),
        Node(package='robotx_bt_planner',
             executable='robotx_bt_planner_node',
             name='robotx_bt_planner_node',
             parameters=[{
                 'config_package': 'robotx_bt_planner',
                 'config_file': 'config/qualifytask.yaml',
                 'update_rate': 20.0
             }])
    ])
示例#30
0
def generate_launch_description():
    composable_nodes = [
        ComposableNode(
            package='image_proc',
            plugin='image_proc::DebayerNode',
            name='debayer_node',
        ),
        ComposableNode(
            package='image_proc',
            plugin='image_proc::RectifyNode',
            name='rectify_mono_node',
            # Remap subscribers and publishers
            remappings=[('image', 'image_mono'),
                        ('camera_info', 'camera_info'),
                        ('image_rect', 'image_rect')],
        ),
        ComposableNode(
            package='image_proc',
            plugin='image_proc::RectifyNode',
            name='rectify_color_node',
            # Remap subscribers and publishers
            remappings=[('image', 'image_color'),
                        ('image_rect', 'image_rect_color')],
        )
    ]

    arg_container = DeclareLaunchArgument(
        name='container',
        default_value='',
        description=(
            'Name of an existing node container to load launched nodes into. '
            'If unset, a new container will be created.'))

    # If an existing container is not provided, start a container and load nodes into it
    image_processing_container = ComposableNodeContainer(
        condition=LaunchConfigurationEquals('container', ''),
        name='image_proc_container',
        namespace='',
        package='rclcpp_components',
        executable='component_container',
        composable_node_descriptions=composable_nodes,
        output='screen')

    # If an existing container name is provided, load composable nodes into it
    # This will block until a container with the provided name is available and nodes are loaded
    load_composable_nodes = LoadComposableNodes(
        condition=LaunchConfigurationNotEquals('container', ''),
        composable_node_descriptions=composable_nodes,
        target_container=LaunchConfiguration('container'),
    )

    return LaunchDescription([
        arg_container,
        image_processing_container,
        load_composable_nodes,
    ])