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.
carma_src Namespace Reference

Functions

def create_ros2_tracing_action (context, *args, **kwargs)
 
def generate_launch_description ()
 

Function Documentation

◆ create_ros2_tracing_action()

def carma_src.create_ros2_tracing_action (   context,
args,
**  kwargs 
)
Opaque Function for generating a 'Trace' ROS 2 launch action, which is dependent on the
'ROS_LOG_DIR' EnvironmentVariable and the 'is_ros2_tracing_enabled' LaunchConfiguration.

NOTE: This Opaque Function is required in order to evaluate the 'ROS_LOG_DIR' environment
variable as a string.

Definition at line 40 of file carma_src.launch.py.

40def create_ros2_tracing_action(context, *args, **kwargs):
41 """
42 Opaque Function for generating a 'Trace' ROS 2 launch action, which is dependent on the
43 'ROS_LOG_DIR' EnvironmentVariable and the 'is_ros2_tracing_enabled' LaunchConfiguration.
44
45 NOTE: This Opaque Function is required in order to evaluate the 'ROS_LOG_DIR' environment
46 variable as a string.
47 """
48 log_directory_string = launch.substitutions.EnvironmentVariable('ROS_LOG_DIR').perform(context)
49
50 trace = GroupAction(
51 condition=IfCondition(LaunchConfiguration('is_ros2_tracing_enabled')),
52 actions=[
53 Trace(
54 base_path = log_directory_string,
55 session_name='my-tracing-session-' + str(datetime.now().strftime('%Y-%m-%d_%H%M%S')),
56 events_kernel = [], # Empty since kernel tracing is not enabled for CARMA Platform
57 )
58 ]
59 )
60
61 return [trace]
62
def create_ros2_tracing_action(context, *args, **kwargs)

◆ generate_launch_description()

def carma_src.generate_launch_description ( )
Launch CARMA System.

Definition at line 63 of file carma_src.launch.py.

64 """
65 Launch CARMA System.
66 """
67
68 system_controller_param_file = os.path.join(
69 get_package_share_directory('system_controller'), 'config/config.yaml')
70
71 env_log_levels = EnvironmentVariable('CARMA_ROS_LOGGING_CONFIG', default_value='{ "default_level" : "WARN" }')
72
73 # Declare the vehicle_calibration_dir launch argument
74 vehicle_calibration_dir = LaunchConfiguration('vehicle_calibration_dir')
75 declare_vehicle_calibration_dir_arg = DeclareLaunchArgument(
76 name = 'vehicle_calibration_dir',
77 default_value = "/opt/carma/vehicle/calibration",
78 description = "Path to folder containing vehicle calibration directories"
79 )
80
81 vehicle_config_dir = LaunchConfiguration('vehicle_config_dir')
82 declare_vehicle_config_dir_arg = DeclareLaunchArgument(
83 name = 'vehicle_config_dir',
84 default_value = "/opt/carma/vehicle/config",
85 description = "Path to file containing vehicle config directories"
86 )
87
88 vehicle_characteristics_param_file = LaunchConfiguration('vehicle_characteristics_param_file')
89 declare_vehicle_characteristics_param_file_arg = DeclareLaunchArgument(
90 name = 'vehicle_characteristics_param_file',
91 default_value = [vehicle_calibration_dir, "/identifiers/UniqueVehicleParams.yaml"],
92 description = "Path to file containing unique vehicle characteristics"
93 )
94
95 # Declare the vehicle_config_param_file launch argument
96 vehicle_config_param_file = LaunchConfiguration('vehicle_config_param_file')
97 declare_vehicle_config_param_file_arg = DeclareLaunchArgument(
98 name = 'vehicle_config_param_file',
99 default_value = [vehicle_config_dir, "/VehicleConfigParams.yaml"],
100 description = "Path to file contain vehicle configuration parameters"
101 )
102
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 of simulation mode is on"
108 )
109
110 use_real_time_spat_in_sim = LaunchConfiguration('use_real_time_spat_in_sim')
111 declare_use_real_time_spat_in_sim_arg = DeclareLaunchArgument(
112 name = 'use_real_time_spat_in_sim',
113 default_value = 'False',
114 description = "True if SPaT is being published based on wall clock"
115 )
116
117 #Declare the route file folder launch argument
118 route_file_folder = LaunchConfiguration('route_file_folder')
119 declare_route_file_folder = DeclareLaunchArgument(
120 name = 'route_file_folder',
121 default_value='/opt/carma/routes/',
122 description = 'Path of folder containing routes to load'
123 )
124
125 # Declare enable_guidance_plugin_validate
126 enable_guidance_plugin_validator = LaunchConfiguration('enable_guidance_plugin_validator')
127 declare_enable_guidance_plugin_validator = DeclareLaunchArgument(
128 name = 'enable_guidance_plugin_validator',
129 default_value='false',
130 description='Flag indicating whether the Guidance Plugin Validator node will actively validate guidance strategic, tactical, and control plugins'
131 )
132
133 # Declare strategic_plugins_to_validate
134 strategic_plugins_to_validate = LaunchConfiguration('strategic_plugins_to_validate')
135 declare_strategic_plugins_to_validate = DeclareLaunchArgument(
136 name = 'strategic_plugins_to_validate',
137 default_value = '[]',
138 description = 'List of String: Guidance Strategic Plugins that will be validated by the Guidance Plugin Validator Node if enabled'
139 )
140
141 # Declare tactical_plugins_to_validate
142 tactical_plugins_to_validate = LaunchConfiguration('tactical_plugins_to_validate')
143 declare_tactical_plugins_to_validate = DeclareLaunchArgument(
144 name = 'tactical_plugins_to_validate',
145 default_value='[]',
146 description='List of String: Guidance Tactical Plugins that will be validated by the Guidance Plugin Validator Node if enabled'
147 )
148
149 # Declare control_plugins_to_validate
150 control_plugins_to_validate = LaunchConfiguration('control_plugins_to_validate')
151 declare_control_plugins_to_validate = DeclareLaunchArgument(
152 name = 'control_plugins_to_validate',
153 default_value= '[]',
154 description='List of String: Guidance Control Plugins that will be validated by the Guidance Plugin Validator Node if enabled'
155 )
156
157 # Declare enable_opening_tunnels
158 enable_opening_tunnels = LaunchConfiguration('enable_opening_tunnels')
159 declare_enable_opening_tunnels = DeclareLaunchArgument(
160 name = 'enable_opening_tunnels',
161 default_value= 'False',
162 description='Flag to enable opening http tunnesl to CARMA Cloud'
163 )
164
165 # Declare port
166 port = LaunchConfiguration('port')
167 declare_port = DeclareLaunchArgument(
168 name = 'port',
169 default_value= "9090",
170 description='The default port for rosbridge is 909'
171 )
172
173 # Declare launch arguments for points_map_loader
174 load_type = LaunchConfiguration('load_type')
175 declare_load_type= DeclareLaunchArgument(name = 'load_type', default_value = "noupdate")
176
177 single_pcd_path = LaunchConfiguration('single_pcd_path')
178 declare_single_pcd_path = DeclareLaunchArgument(name='single_pcd_path', default_value="['/opt/carma/maps/pcd_map.pcd']")
179
180 area = LaunchConfiguration('area')
181 declare_area = DeclareLaunchArgument(name='area', default_value="1x1")
182
183 arealist_path = LaunchConfiguration('arealist_path')
184 declare_arealist_path = DeclareLaunchArgument(name='arealist_path', default_value="/opt/carma/maps/arealist.txt")
185
186 vector_map_file = LaunchConfiguration('vector_map_file')
187 declare_vector_map_file = DeclareLaunchArgument(name='vector_map_file', default_value='/opt/carma/maps/vector_map.osm')
188
189 is_ros2_tracing_enabled = LaunchConfiguration('is_ros2_tracing_enabled')
190 declare_is_ros2_tracing_enabled = DeclareLaunchArgument(
191 name='is_ros2_tracing_enabled',
192 default_value = 'False',
193 description = 'True if user wants ROS 2 Tracing logs to be generated from CARMA Platform.')
194
195 # When enabled, the vehicle fuses incoming SDSM with its own sensor data to create a more accurate representation of the environment
196 # When turned off, topics get remapped to solely rely on its own sensor data
197 is_cp_mot_enabled = LaunchConfiguration('is_cp_mot_enabled')
198 declare_is_cp_mot_enabled = DeclareLaunchArgument(
199 name='is_cp_mot_enabled',
200 default_value = 'False',
201 description = 'True if user wants Cooperative Perception capability using Multiple Object Tracking to be enabled'
202 )
203
204 # When enabled, the vehicle has lidar detected objects in its external objects list
205 # TODO: Currently the stack is not shutting down automatically https://usdot-carma.atlassian.net.mcas-gov.us/browse/CAR-6109
206 is_autoware_lidar_obj_detection_enabled = LaunchConfiguration('is_autoware_lidar_obj_detection_enabled')
207 declare_is_autoware_lidar_obj_detection_enabled = DeclareLaunchArgument(
208 name='is_autoware_lidar_obj_detection_enabled',
209 default_value = 'False',
210 description = 'True if user wants Autoware Lidar Object Detection to be enabled'
211 )
212
213 # Launch ROS2 rosbag logging
214 ros2_rosbag_launch = GroupAction(
215 actions=[
216 IncludeLaunchDescription(
217 PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/ros2_rosbag.launch.py']),
218 launch_arguments = {
219 'vehicle_config_dir' : vehicle_config_dir,
220 'vehicle_config_param_file' : vehicle_config_param_file
221 }.items()
222 )
223 ]
224 )
225
226 # Nodes
227
228 transform_group = GroupAction(
229 actions=[
230 PushRosNamespace(EnvironmentVariable('CARMA_TF_NS', default_value='/')),
231 IncludeLaunchDescription(
232 PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/transforms.launch.py']),
233 launch_arguments = {
234 'vehicle_config_param_file' : vehicle_config_param_file,
235 'use_sim_time' : use_sim_time
236 }.items()
237 ),
238 ]
239 )
240
241 environment_group = GroupAction(
242 actions=[
243 PushRosNamespace(EnvironmentVariable('CARMA_ENV_NS', default_value='environment')),
244 IncludeLaunchDescription(
245 PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/environment.launch.py']),
246 launch_arguments = {
247 'subsystem_controller_param_file' : [vehicle_config_dir, '/SubsystemControllerParams.yaml'],
248 'vehicle_config_param_file' : vehicle_config_param_file,
249 'vehicle_characteristics_param_file' : vehicle_characteristics_param_file,
250 'vector_map_file' : vector_map_file,
251 'use_sim_time' : use_sim_time,
252 'is_cp_mot_enabled' : is_cp_mot_enabled,
253 'is_autoware_lidar_obj_detection_enabled' : is_autoware_lidar_obj_detection_enabled
254 }.items()
255 ),
256 ]
257 )
258
259 localization_group = GroupAction(
260 actions=[
261 PushRosNamespace(EnvironmentVariable('CARMA_LOCZ_NS', default_value='localization')),
262 IncludeLaunchDescription(
263 PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/localization.launch.py']),
264 launch_arguments = {
265 'vehicle_config_param_file' : vehicle_config_param_file,
266 'subsystem_controller_param_file' : [vehicle_config_dir, '/SubsystemControllerParams.yaml'],
267 'load_type' : load_type,
268 'single_pcd_path' : single_pcd_path,
269 'area' : area,
270 'arealist_path' : arealist_path,
271 'vector_map_file' : vector_map_file,
272 'vehicle_calibration_dir': vehicle_calibration_dir,
273 'use_sim_time' : use_sim_time
274 }.items()
275 )
276 ]
277 )
278
279 v2x_group = GroupAction(
280 actions=[
281 PushRosNamespace(EnvironmentVariable('CARMA_MSG_NS', default_value='message')),
282 IncludeLaunchDescription(
283 PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/message.launch.py']),
284 launch_arguments = {
285 'vehicle_characteristics_param_file' : vehicle_characteristics_param_file,
286 'vehicle_config_param_file' : vehicle_config_param_file,
287 'enable_opening_tunnels' : enable_opening_tunnels,
288 'subsystem_controller_param_file' : [vehicle_config_dir, '/SubsystemControllerParams.yaml'],
289 'use_sim_time' : use_sim_time
290 }.items()
291 ),
292 ]
293 )
294
295 guidance_group = GroupAction(
296 actions=[
297 PushRosNamespace(EnvironmentVariable('CARMA_GUIDE_NS', default_value='guidance')),
298
299 IncludeLaunchDescription(
300 PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/guidance.launch.py']),
301 launch_arguments={
302 'route_file_folder' : route_file_folder,
303 'vehicle_characteristics_param_file' : vehicle_characteristics_param_file,
304 'vehicle_config_param_file' : vehicle_config_param_file,
305 'enable_guidance_plugin_validator' : enable_guidance_plugin_validator,
306 'strategic_plugins_to_validate' : strategic_plugins_to_validate,
307 'tactical_plugins_to_validate' : tactical_plugins_to_validate,
308 'control_plugins_to_validate' : control_plugins_to_validate,
309 'subsystem_controller_param_file' : [vehicle_config_dir, '/SubsystemControllerParams.yaml'],
310 'use_sim_time' : use_sim_time,
311 'use_real_time_spat_in_sim' : use_real_time_spat_in_sim
312 }.items()
313 ),
314 ]
315 )
316
317 drivers_group = GroupAction(
318 actions=[
319 PushRosNamespace(EnvironmentVariable('CARMA_INTR_NS', default_value='hardware_interface')),
320 IncludeLaunchDescription(
321 PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/drivers.launch.py']),
322 launch_arguments = {
323 'subsystem_controller_param_file' : [vehicle_config_dir, '/SubsystemControllerParams.yaml'],
324 'vehicle_config_param_file' : vehicle_config_param_file,
325 'use_sim_time' : use_sim_time
326 }.items()
327 ),
328 ]
329 )
330
331 system_controller = Node(
332 package='system_controller',
333 name='system_controller',
334 executable='system_controller',
335 parameters=[
336 system_controller_param_file,
337 {"use_sim_time" : use_sim_time}],
338 on_exit = Shutdown(), # Mark the subsystem controller as required for segfaults
339 arguments=['--ros-args', '--log-level', GetLogLevel('system_controller', env_log_levels)]
340 )
341
342 ui_group = GroupAction(
343 actions=[
344 PushRosNamespace(EnvironmentVariable('CARMA_UI_NS', default_value='ui')),
345
346 IncludeLaunchDescription(
347 PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/ui.launch.py']),
348 launch_arguments={
349 'port' : port
350 }.items()
351 ),
352 ]
353 )
354
355 return LaunchDescription([
356 declare_vehicle_calibration_dir_arg,
357 declare_vehicle_config_dir_arg,
358 declare_vehicle_characteristics_param_file_arg,
359 declare_vehicle_config_param_file_arg,
360 declare_use_sim_time_arg,
361 declare_use_real_time_spat_in_sim_arg,
362 declare_route_file_folder,
363 declare_enable_guidance_plugin_validator,
364 declare_strategic_plugins_to_validate,
365 declare_tactical_plugins_to_validate,
366 declare_control_plugins_to_validate,
367 declare_enable_opening_tunnels,
368 declare_port,
369 declare_load_type,
370 declare_single_pcd_path,
371 declare_area,
372 declare_arealist_path,
373 declare_vector_map_file,
374 declare_is_ros2_tracing_enabled,
375 declare_is_cp_mot_enabled,
376 declare_is_autoware_lidar_obj_detection_enabled,
377 ros2_rosbag_launch,
378 OpaqueFunction(function=create_ros2_tracing_action),
379 drivers_group,
380 transform_group,
381 environment_group,
382 localization_group,
383 v2x_group,
384 guidance_group,
385 ui_group,
386 system_controller
387 ])
def generate_launch_description()