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
40 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"
62 vehicle_config_param_file = LaunchConfiguration(
'vehicle_config_param_file')
63 declare_vehicle_config_param_file_arg = DeclareLaunchArgument(
64 name =
'vehicle_config_param_file',
65 default_value =
"/opt/carma/vehicle/config/VehicleConfigParams.yaml",
66 description =
"Path to file contain vehicle configuration parameters"
69 subsystem_controller_param_file = LaunchConfiguration(
'subsystem_controller_param_file')
70 declare_subsystem_controller_param_file_arg = DeclareLaunchArgument(
71 name =
'subsystem_controller_param_file',
72 default_value = subsystem_controller_default_param_file,
73 description =
"Path to file containing override parameters for the subsystem controller"
76 vehicle_config_dir = LaunchConfiguration(
'vehicle_config_dir')
77 declare_vehicle_config_dir_arg = DeclareLaunchArgument(
78 name =
'vehicle_config_dir',
79 default_value =
"/opt/carma/vehicle/config",
80 description =
"Path to vehicle configuration directory populated by carma-config"
85 global_params_override_file = LaunchConfiguration(
'global_params_override_file')
86 declare_global_params_override_file_arg = DeclareLaunchArgument(
87 name =
'global_params_override_file',
88 default_value = [vehicle_config_dir,
"/GlobalParamsOverride.yaml"],
89 description =
"Path to global file containing the parameters overwrite"
93 enable_opening_tunnels = LaunchConfiguration(
'enable_opening_tunnels')
94 declare_enable_opening_tunnels = DeclareLaunchArgument(
95 name =
'enable_opening_tunnels',
96 default_value=
'True',
97 description=
'Flag to enable opening http tunnesl to CARMA Cloud'
100 carma_cloud_client_param_file = os.path.join(
101 get_package_share_directory(
'carma_cloud_client'),
'config/parameters.yaml')
103 use_sim_time = LaunchConfiguration(
'use_sim_time')
104 declare_use_sim_time_arg = DeclareLaunchArgument(
105 name =
'use_sim_time',
106 default_value =
"False",
107 description =
"True if simulation mode is on"
111 carma_v2x_container = ComposableNodeContainer(
112 package=
'carma_ros2_utils',
113 name=
'carma_v2x_container',
114 executable=
'carma_component_container_mt',
115 namespace=GetCurrentNamespace(),
116 composable_node_descriptions=[
119 package=
'mobilitypath_publisher',
120 plugin=
'mobilitypath_publisher::MobilityPathPublication',
121 name=
'mobilitypath_publisher_node',
123 {
'use_intra_process_comms':
True},
126 (
"plan_trajectory", [ EnvironmentVariable(
'CARMA_GUIDE_NS', default_value=
''),
"/plan_trajectory" ] ),
127 (
"guidance_state", [ EnvironmentVariable(
'CARMA_GUIDE_NS', default_value=
''),
"/state" ] ),
128 (
"georeference", [ EnvironmentVariable(
'CARMA_LOCZ_NS', default_value=
''),
"/map_param_loader/georeference" ] ),
129 (
"mobility_path_msg", [ EnvironmentVariable(
'CARMA_MSG_NS', default_value=
''),
"/outgoing_mobility_path" ] )
132 mobilitypath_publisher_param_file,
133 vehicle_characteristics_param_file,
134 vehicle_config_param_file,
135 global_params_override_file
139 package=
'bsm_generator',
140 plugin=
'bsm_generator::BSMGenerator',
141 name=
'bsm_generator_node',
143 {
'use_intra_process_comms':
True},
146 (
"velocity_accel_cov", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/velocity_accel_cov" ] ),
147 (
"ekf_twist", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/vehicle/twist" ] ),
148 (
"imu_raw", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/imu_raw" ] ),
149 (
"transmission_state", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/can/transmission_state" ] ),
150 (
"brake_position", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/can/brake_position" ] ),
151 (
"steering_wheel_angle", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/can/steering_wheel_angle" ] ),
152 (
"gnss_fix_fused", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/gnss_fix_fused" ] ),
153 (
"pose", [ EnvironmentVariable(
'CARMA_LOCZ_NS', default_value=
''),
"/current_pose" ] ),
154 (
"georeference", [ EnvironmentVariable(
'CARMA_LOCZ_NS', default_value=
''),
"/map_param_loader/georeference" ] )
157 bsm_generator_param_file,
158 vehicle_characteristics_param_file,
159 vehicle_config_param_file,
160 global_params_override_file
164 package=
'cpp_message',
165 plugin=
'cpp_message::Node',
166 name=
'cpp_message_node',
168 {
'use_intra_process_comms':
True},
171 (
"inbound_binary_msg", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/comms/inbound_binary_msg" ] ),
172 (
"outbound_binary_msg", [ EnvironmentVariable(
'CARMA_INTR_NS', default_value=
''),
"/comms/outbound_binary_msg" ] ),
175 vehicle_config_param_file,
176 global_params_override_file
180 package=
'j2735_convertor',
181 plugin=
'j2735_convertor::Node',
182 name=
'j2735_convertor_node',
184 {
'use_intra_process_comms':
True},
187 (
"outgoing_bsm",
"bsm_outbound" )
190 vehicle_config_param_file,
191 global_params_override_file
195 package=
'carma_cloud_client',
196 plugin=
'carma_cloud_client::CarmaCloudClient',
197 name=
'carma_cloud_client_node',
199 {
'use_intra_process_comms':
True},
202 (
"incoming_geofence_control", [ EnvironmentVariable(
'CARMA_MSG_NS', default_value=
''),
"/incoming_geofence_control" ] ),
205 vehicle_config_param_file,
206 carma_cloud_client_param_file,
207 global_params_override_file
215 subsystem_controller = Node(
216 package=
'subsystem_controllers',
217 name=
'v2x_controller',
218 executable=
'v2x_controller',
220 subsystem_controller_default_param_file,
221 subsystem_controller_param_file,
222 {
"use_sim_time" : use_sim_time}],
224 arguments=[
'--ros-args',
'--log-level', GetLogLevel(
'subsystem_controllers', env_log_levels)]
230 REMOTE_ADDR=
"carma-cloud.com"
231 KEY_FILE=
"carma-cloud-1.pem"
234 param_launch_path = os.path.join(
235 get_package_share_directory(
'carma_cloud_client'),
'launch/scripts')
237 script = param_launch_path +
'/open_tunnels.sh'
239 subprocess.check_call([
'chmod',
'u+x', script])
241 key_path =
"/opt/carma/vehicle/calibration/cloud_permission"
243 keyfile = key_path +
'/' + KEY_FILE
245 subprocess.check_call([
'sudo',
'chmod',
'400', keyfile])
247 open_tunnels_action = ExecuteProcess(
249 condition=IfCondition(enable_opening_tunnels),
250 cmd = [
'sudo', script,
'-u', REMOTE_USER,
'-a', REMOTE_ADDR,
'-k', keyfile,
'-p', REMOTE_PORT,
'-r', HOST_PORT],
254 return LaunchDescription([
255 declare_vehicle_config_param_file_arg,
256 declare_vehicle_config_dir_arg,
257 declare_global_params_override_file_arg,
258 declare_use_sim_time_arg,
259 declare_vehicle_characteristics_param_file_arg,
260 declare_subsystem_controller_param_file_arg,
261 declare_enable_opening_tunnels,
def generate_launch_description()