15from ament_index_python
import get_package_share_directory
16from launch.actions
import Shutdown
17from launch
import LaunchDescription
18from launch_ros.actions
import Node
19from launch_ros.actions
import ComposableNodeContainer
20from launch_ros.descriptions
import ComposableNode
21from launch.substitutions
import EnvironmentVariable
22from carma_ros2_utils.launch.get_log_level
import GetLogLevel
23from carma_ros2_utils.launch.get_current_namespace
import GetCurrentNamespace
24from launch.substitutions
import LaunchConfiguration
25from launch.actions
import DeclareLaunchArgument, ExecuteProcess
26from launch.conditions
import IfCondition
31from launch.actions
import IncludeLaunchDescription
32from launch.launch_description_sources
import PythonLaunchDescriptionSource
33from launch.actions
import GroupAction
34from launch_ros.actions
import set_remap
41 Launch V2X subsystem nodes.
44 env_log_levels = EnvironmentVariable('CARMA_ROS_LOGGING_CONFIG', default_value=
'{ "default_level" : "WARN" }')
46 subsystem_controller_default_param_file = os.path.join(
47 get_package_share_directory(
'subsystem_controllers'),
'config/v2x_controller_config.yaml')
49 mobilitypath_publisher_param_file = os.path.join(
50 get_package_share_directory(
'mobilitypath_publisher'),
'config/parameters.yaml')
52 bsm_generator_param_file = os.path.join(
53 get_package_share_directory(
'bsm_generator'),
'config/parameters.yaml')
55 vehicle_characteristics_param_file = LaunchConfiguration(
'vehicle_characteristics_param_file')
56 declare_vehicle_characteristics_param_file_arg = DeclareLaunchArgument(
57 name =
'vehicle_characteristics_param_file',
58 default_value =
"/opt/carma/vehicle/calibration/identifiers/UniqueVehicleParams.yaml",
59 description =
"Path to file containing unique vehicle calibrations"
63 vehicle_config_param_file = LaunchConfiguration(
'vehicle_config_param_file')
64 declare_vehicle_config_param_file_arg = DeclareLaunchArgument(
65 name =
'vehicle_config_param_file',
66 default_value =
"/opt/carma/vehicle/config/VehicleConfigParams.yaml",
67 description =
"Path to file contain vehicle configuration parameters"
70 subsystem_controller_param_file = LaunchConfiguration(
'subsystem_controller_param_file')
71 declare_subsystem_controller_param_file_arg = DeclareLaunchArgument(
72 name =
'subsystem_controller_param_file',
73 default_value = subsystem_controller_default_param_file,
74 description =
"Path to file containing override parameters for the subsystem controller"
78 enable_opening_tunnels = LaunchConfiguration(
'enable_opening_tunnels')
79 declare_enable_opening_tunnels = DeclareLaunchArgument(
80 name =
'enable_opening_tunnels',
81 default_value=
'True',
82 description=
'Flag to enable opening http tunnesl to CARMA Cloud'
85 carma_cloud_client_param_file = os.path.join(
86 get_package_share_directory(
'carma_cloud_client'),
'config/parameters.yaml')
88 use_sim_time = LaunchConfiguration(
'use_sim_time')
89 declare_use_sim_time_arg = DeclareLaunchArgument(
90 name =
'use_sim_time',
91 default_value =
"False",
92 description =
"True if simulation mode is on"
96 carma_v2x_container = ComposableNodeContainer(
97 package=
'carma_ros2_utils',
98 name=
'carma_v2x_container',
99 executable=
'carma_component_container_mt',
100 namespace=GetCurrentNamespace(),
101 composable_node_descriptions=[
104 package=
'mobilitypath_publisher',
105 plugin=
'mobilitypath_publisher::MobilityPathPublication',
106 name=
'mobilitypath_publisher_node',
108 {
'use_intra_process_comms':
True},
109 {
'--log-level' : GetLogLevel(
'mobilitypath_publisher', env_log_levels) }
112 (
"plan_trajectory", [ EnvironmentVariable(
'CARMA_GUIDE_NS', default_value=
''),
"/plan_trajectory" ] ),
113 (
"guidance_state", [ EnvironmentVariable(
'CARMA_GUIDE_NS', default_value=
''),
"/state" ] ),
114 (
"georeference", [ EnvironmentVariable(
'CARMA_LOCZ_NS', default_value=
''),
"/map_param_loader/georeference" ] ),
115 (
"mobility_path_msg", [ EnvironmentVariable(
'CARMA_MSG_NS', default_value=
''),
"/outgoing_mobility_path" ] )
118 mobilitypath_publisher_param_file,
119 vehicle_characteristics_param_file,
120 vehicle_config_param_file
124 package=
'bsm_generator',
125 plugin=
'bsm_generator::BSMGenerator',
126 name=
'bsm_generator_node',
128 {
'use_intra_process_comms':
True},
129 {
'--log-level' : GetLogLevel(
'bsm_generator', env_log_levels) }
132 (
"velocity_accel_cov", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/velocity_accel_cov" ] ),
133 (
"ekf_twist", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/vehicle/twist" ] ),
134 (
"imu_raw", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/imu_raw" ] ),
135 (
"transmission_state", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/can/transmission_state" ] ),
136 (
"brake_position", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/can/brake_position" ] ),
137 (
"steering_wheel_angle", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/can/steering_wheel_angle" ] ),
138 (
"gnss_fix_fused", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/gnss_fix_fused" ] ),
139 (
"pose", [ EnvironmentVariable(
'CARMA_LOCZ_NS', default_value=
''),
"/current_pose" ] ),
140 (
"georeference", [ EnvironmentVariable(
'CARMA_LOCZ_NS', default_value=
''),
"/map_param_loader/georeference" ] )
143 bsm_generator_param_file,
144 vehicle_characteristics_param_file,
145 vehicle_config_param_file
149 package=
'cpp_message',
150 plugin=
'cpp_message::Node',
151 name=
'cpp_message_node',
153 {
'use_intra_process_comms':
True},
154 {
'--log-level' : GetLogLevel(
'cpp_message', env_log_levels) }
157 (
"inbound_binary_msg", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/comms/inbound_binary_msg" ] ),
158 (
"outbound_binary_msg", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/comms/outbound_binary_msg" ] ),
161 vehicle_config_param_file
165 package=
'j2735_convertor',
166 plugin=
'j2735_convertor::Node',
167 name=
'j2735_convertor_node',
169 {
'use_intra_process_comms':
True},
170 {
'--log-level' : GetLogLevel(
'j2735_convertor', env_log_levels) }
173 (
"outgoing_bsm",
"bsm_outbound" )
176 vehicle_config_param_file
180 package=
'carma_cloud_client',
181 plugin=
'carma_cloud_client::CarmaCloudClient',
182 name=
'carma_cloud_client_node',
184 {
'use_intra_process_comms':
True},
185 {
'--log-level' : GetLogLevel(
'carma_cloud_client', env_log_levels) }
188 (
"incoming_geofence_control", [ EnvironmentVariable(
'CARMA_MSG_NS', default_value=
''),
"/incoming_geofence_control" ] ),
191 vehicle_config_param_file, carma_cloud_client_param_file
199 subsystem_controller = Node(
200 package=
'subsystem_controllers',
201 name=
'v2x_controller',
202 executable=
'v2x_controller',
204 subsystem_controller_default_param_file,
205 subsystem_controller_param_file,
206 {
"use_sim_time" : use_sim_time}],
208 arguments=[
'--ros-args',
'--log-level', GetLogLevel(
'subsystem_controllers', env_log_levels)]
214 REMOTE_ADDR=
"www.carma-cloud.com"
215 KEY_FILE=
"carma-cloud-test-1.pem"
218 param_launch_path = os.path.join(
219 get_package_share_directory(
'carma_cloud_client'),
'launch/scripts')
221 script = param_launch_path +
'/open_tunnels.sh'
223 subprocess.check_call([
'chmod',
'u+x', script])
225 key_path =
"/opt/carma/vehicle/calibration/cloud_permission"
227 keyfile = key_path +
'/' + KEY_FILE
229 subprocess.check_call([
'sudo',
'chmod',
'400', keyfile])
232 open_tunnels_action = ExecuteProcess(
234 condition=IfCondition(enable_opening_tunnels),
235 cmd = [
'sudo', script,
'-u', REMOTE_USER,
'-a', REMOTE_ADDR,
'-k', keyfile,
'-p', REMOTE_PORT,
'-r', HOST_PORT],
240 return LaunchDescription([
241 declare_vehicle_config_param_file_arg,
242 declare_use_sim_time_arg,
243 declare_vehicle_characteristics_param_file_arg,
244 declare_subsystem_controller_param_file_arg,
245 declare_enable_opening_tunnels,
def generate_launch_description()