Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
plan_delegator.launch.py
Go to the documentation of this file.
1# Copyright (C) 2022 LEIDOS.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15from ament_index_python import get_package_share_directory
16from launch import LaunchDescription
17from launch_ros.actions import ComposableNodeContainer
18from launch_ros.descriptions import ComposableNode
19from launch.actions import DeclareLaunchArgument
20from launch.substitutions import LaunchConfiguration
21from carma_ros2_utils.launch.get_current_namespace import GetCurrentNamespace
22
23import os
24
25
26'''
27This file is can be used to launch the Plan Delegator Node.
28 Though in carma-platform it may be launched directly from the base launch file.
29'''
30
31def generate_launch_description():
32
33 # Declare the log_level launch argument
34 log_level = LaunchConfiguration('log_level')
35 declare_log_level_arg = DeclareLaunchArgument(
36 name ='log_level', default_value='WARN')
37
38 plan_delegator_param_file = os.path.join(
39 get_package_share_directory('plan_delegator'), 'config/plan_delegator_params.yaml')
40
41
42 # Launch node(s) in a carma container to allow logging to be configured
43 container = ComposableNodeContainer(
44 package='carma_ros2_utils',
45 name='plan_delegator_container',
46 namespace=GetCurrentNamespace(),
47 executable='carma_component_container_mt',
48 composable_node_descriptions=[
49
50 # Launch the core node(s)
51 ComposableNode(
52 package='plan_delegator',
53 plugin='plan_delegator::PlanDelegator',
54 name='plan_delegator',
55 extra_arguments=[
56 {'use_intra_process_comms': True},
57 {'--log-level' : log_level }
58 ],
59 parameters=[ plan_delegator_param_file ]
60 ),
61 ]
62 )
63
64 return LaunchDescription([
65 declare_log_level_arg,
66 container
67 ])