@@ -258,12 +258,14 @@ def _create_behavior(self):
258
258
Basic behavior do nothing, i.e. Idle
259
259
"""
260
260
261
- stories_behavior = py_trees .composites .Parallel (policy = py_trees .common .ParallelPolicy .SUCCESS_ON_ALL , name = "OSCStories" )
261
+ stories_behavior = py_trees .composites .Parallel (policy = py_trees .common .ParallelPolicy .SUCCESS_ON_ALL ,
262
+ name = "OSCStories" )
262
263
joint_actor_list = self .other_actors + self .ego_vehicles + [None ]
263
264
264
265
for story in self .config .stories :
265
266
story_name = story .get ("name" )
266
- story_behavior = py_trees .composites .Parallel (policy = py_trees .common .ParallelPolicy .SUCCESS_ON_ALL , name = story_name )
267
+ story_behavior = py_trees .composites .Parallel (policy = py_trees .common .ParallelPolicy .SUCCESS_ON_ALL ,
268
+ name = story_name )
267
269
for act in story .iter ("Act" ):
268
270
269
271
act_sequence = py_trees .composites .Sequence (
@@ -289,7 +291,8 @@ def _create_behavior(self):
289
291
for entity in actor .iter ("EntityRef" ):
290
292
entity_name = entity .attrib .get ('entityRef' , None )
291
293
for k , _ in enumerate (joint_actor_list ):
292
- if joint_actor_list [k ] and entity_name == joint_actor_list [k ].attributes ['role_name' ]:
294
+ if (joint_actor_list [k ] and
295
+ entity_name == joint_actor_list [k ].attributes ['role_name' ]):
293
296
actor_ids .append (k )
294
297
break
295
298
@@ -298,10 +301,11 @@ def _create_behavior(self):
298
301
sequence .attrib .get ('name' )))
299
302
actor_ids .append (len (joint_actor_list ) - 1 )
300
303
301
- # Collect catalog reference maneuvers in order to process them at the same time as normal maneuvers
304
+ # Collect catalog reference maneuvers to process them at the same time as normal maneuvers
302
305
catalog_maneuver_list = []
303
306
for catalog_reference in sequence .iter ("CatalogReference" ):
304
- catalog_maneuver = OpenScenarioParser .get_catalog_entry (self .config .catalogs , catalog_reference )
307
+ catalog_maneuver = OpenScenarioParser .get_catalog_entry (self .config .catalogs ,
308
+ catalog_reference )
305
309
catalog_maneuver_list .append (catalog_maneuver )
306
310
all_maneuvers = itertools .chain (iter (catalog_maneuver_list ), sequence .iter ("Maneuver" ))
307
311
single_sequence_iteration = py_trees .composites .Parallel (
@@ -319,14 +323,15 @@ def _create_behavior(self):
319
323
if child .tag == "Action" :
320
324
for actor_id in actor_ids :
321
325
maneuver_behavior = OpenScenarioParser .convert_maneuver_to_atomic (
322
- child , joint_actor_list [actor_id ], joint_actor_list , self .config .catalogs )
326
+ child , joint_actor_list [actor_id ],
327
+ joint_actor_list , self .config .catalogs )
323
328
maneuver_behavior = StoryElementStatusToBlackboard (
324
329
maneuver_behavior , "ACTION" , child .attrib .get ('name' ))
325
330
parallel_actions .add_child (
326
- oneshot_with_check (variable_name = # See note in get_xml_path
327
- get_xml_path (story , sequence ) + '>' + \
328
- get_xml_path (maneuver , child ),
329
- behaviour = maneuver_behavior ))
331
+ oneshot_with_check (variable_name = # See note in get_xml_path
332
+ get_xml_path (story , sequence ) + '>' + \
333
+ get_xml_path (maneuver , child ),
334
+ behaviour = maneuver_behavior ))
330
335
331
336
if child .tag == "StartTrigger" :
332
337
# There is always one StartConditions block per Event
@@ -340,14 +345,14 @@ def _create_behavior(self):
340
345
event_sequence .add_child (parallel_actions )
341
346
maneuver_parallel .add_child (
342
347
oneshot_with_check (variable_name = get_xml_path (story , sequence ) + '>' +
343
- get_xml_path (maneuver , event ), # See get_xml_path
344
- behaviour = event_sequence ))
348
+ get_xml_path (maneuver , event ), # See get_xml_path
349
+ behaviour = event_sequence ))
345
350
maneuver_parallel = StoryElementStatusToBlackboard (
346
351
maneuver_parallel , "MANEUVER" , maneuver .attrib .get ('name' ))
347
352
single_sequence_iteration .add_child (
348
353
oneshot_with_check (variable_name = get_xml_path (story , sequence ) + '>' +
349
- maneuver .attrib .get ('name' ), # See get_xml_path
350
- behaviour = maneuver_parallel ))
354
+ maneuver .attrib .get ('name' ), # See get_xml_path
355
+ behaviour = maneuver_parallel ))
351
356
352
357
# OpenSCENARIO refers to Sequences as Scenes in this instance
353
358
single_sequence_iteration = StoryElementStatusToBlackboard (
@@ -360,7 +365,7 @@ def _create_behavior(self):
360
365
if sequence_behavior .children :
361
366
parallel_sequences .add_child (
362
367
oneshot_with_check (variable_name = get_xml_path (story , sequence ),
363
- behaviour = sequence_behavior ))
368
+ behaviour = sequence_behavior ))
364
369
365
370
if parallel_sequences .children :
366
371
parallel_sequences = StoryElementStatusToBlackboard (
@@ -370,7 +375,8 @@ def _create_behavior(self):
370
375
start_triggers = act .find ("StartTrigger" )
371
376
if list (start_triggers ) is not None :
372
377
for start_condition in start_triggers :
373
- parallel_start_criteria = self ._create_condition_container (start_condition , story , "StartConditions" )
378
+ parallel_start_criteria = self ._create_condition_container (start_condition , story ,
379
+ "StartConditions" )
374
380
if parallel_start_criteria .children :
375
381
start_conditions .add_child (parallel_start_criteria )
376
382
end_triggers = act .find ("StopTrigger" )
@@ -390,8 +396,8 @@ def _create_behavior(self):
390
396
story_behavior .add_child (act_sequence )
391
397
392
398
stories_behavior .add_child (oneshot_with_check (variable_name = get_xml_path (story , story ) + '>' +
393
- story_name , # See get_xml_path
394
- behaviour = story_behavior ))
399
+ story_name , # See get_xml_path
400
+ behaviour = story_behavior ))
395
401
396
402
# Build behavior tree
397
403
behavior = py_trees .composites .Parallel (
0 commit comments