Skip to content

Commit

Permalink
SOFT actions also cause driving to stop.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben.holden committed Oct 12, 2023
1 parent 50f551b commit 2cb4c41
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions vda5050_connector/vda5050_connector_py/vda5050_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,23 +1435,24 @@ def get_list_type(type):
for action in execution_list["soft"] + execution_list["none"]:
self.send_adapter_process_vda_action(action)

def _check_hard_actions(self, action_list):
def _check_hard_soft_actions(self, action_list):
"""
Check a list of actions for HARD actions.
Check a list of actions for HARD or SOFT actions.
Returns
-------
True if an action in the list is HARD blocking
True if an action in the list is HARD or SOFT blocking
"""
_hard_action_found = False
_hard_soft_action_found = False
for action in action_list:
# Hard actions should be the last in the list
# because they must be the only thing running
if action.blocking_type == VDAAction.HARD:
_hard_action_found = True
# Hard or SOFT actions should be the last in the list
# because they cannot be performed when driving
if action.blocking_type == VDAAction.HARD or \
action.blocking_type == VDAAction.SOFT:
_hard_soft_action_found = True
break
return _hard_action_found
return _hard_soft_action_found

def _get_released_edges(self):
"""
Expand All @@ -1473,8 +1474,8 @@ def _get_released_edges(self):
if edge.sequence_id >= self._current_state.last_node_sequence_id + 1:
if edge.released:
released_edges.append(edge)
# if we find a hard action break
if self._check_hard_actions(edge.actions):
# if we find a hard or soft action break
if self._check_hard_soft_actions(edge.actions):
break
elif len(released_edges) == 0:
# If there's no released edge available then request more and break
Expand Down Expand Up @@ -1508,8 +1509,8 @@ def _get_released_nodes(self):
if node.sequence_id >= self._current_state.last_node_sequence_id + 2:
if node.released:
released_nodes.append(node)
# if we find a hard action break
if self._check_hard_actions(node.actions):
# if we find a hard or soft action break
if self._check_hard_soft_actions(node.actions):
break
else:
# There are no released nodes after a non released node
Expand All @@ -1522,7 +1523,7 @@ def _process_next_navigation(self):
The edges and nodes are checked to see if they're released.
Multiple released nodes/edges are sent to the navigate through nodes actions.
Any node/edge actions that are hard will be the end of a single navigate.
Any node/edge actions that are hard or soft will be the end of a single navigate.
"""
released_edges = self._get_released_edges()
if len(released_edges) == 0:
Expand Down

0 comments on commit 2cb4c41

Please sign in to comment.