Skip to content

Commit

Permalink
Fixed criteria usage with multiple ego vehicles in OpenSCENARIO
Browse files Browse the repository at this point in the history
Fixed #374
  • Loading branch information
fabianoboril committed Mar 1, 2020
1 parent c242c7a commit acb495e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions Docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
## Latest Changes
### :bug: Bug Fixes
* Fixed #472: Spawning issue of pedestrians in OpenSCENARIO
* Fixed #374: Usage of evaluation critieria with multiple ego vehicles in OpenSCENARIO


## CARLA ScenarioRunner 0.9.7
Expand Down
4 changes: 4 additions & 0 deletions srunner/scenariomanager/scenarioatomics/atomic_criteria.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,8 @@ def terminate(self, new_status):
self._wrong_outside_lane_distance = 0
self.list_traffic_events.append(outsidelane_event)

super(OnSidewalkTest, self).terminate(new_status)

def _set_event_message(self, event, location, distance):
"""
Sets the message of the event
Expand Down Expand Up @@ -1107,6 +1109,8 @@ def terminate(self, new_status):
self._in_lane = True
self.list_traffic_events.append(wrong_way_event)

super(WrongLaneTest, self).terminate(new_status)

def _set_event_message(self, event, location, distance, road_id, lane_id):
"""
Sets the message of the event
Expand Down
12 changes: 7 additions & 5 deletions srunner/tools/openscenario_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,13 @@ def convert_condition_to_atomic(condition, actor_list):
raise AttributeError(
"The condition {} cannot be mapped to a criterion atomic".format(condition_name))

for triggered_actor in actor_list:
if arg_name != '':
atomic = criterion_instance(triggered_actor, arg_value)
else:
atomic = criterion_instance(triggered_actor)
if len(actor_list) > 1:
atomic = py_trees.composites.Parallel("Evaluation Criteria for multiple ego vehicles")
for triggered_actor in actor_list:
if arg_name != '':
atomic.add_child(criterion_instance(triggered_actor, arg_value))
else:
atomic.add_child(criterion_instance(triggered_actor))
elif value_condition.find('SimulationTime') is not None:
simtime_condition = value_condition.find('SimulationTime')
value = float(simtime_condition.attrib.get('value'))
Expand Down

0 comments on commit acb495e

Please sign in to comment.