Skip to content

Commit

Permalink
Merge pull request #80 from luisrayas3/luis/disambiguate-concurrence-…
Browse files Browse the repository at this point in the history
…outcome-map

Fix outcome_map disambiguation for Concurrence
  • Loading branch information
130s committed Jun 13, 2023
2 parents d4226ba + 115ea23 commit 0a62d3e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions smach/src/smach/concurrence.py
Expand Up @@ -281,10 +281,16 @@ def execute(self, parent_ud = smach.UserData()):

# Determine the outcome from the outcome map
smach.logdebug("SMACH Concurrence determining contained state outcomes.")
max_child_outcomes_satisfied = 0
for (container_outcome, outcomes) in ((k,self._outcome_map[k]) for k in self._outcome_map):
child_outcomes_satisfied = len(outcomes)
if all([self._child_outcomes[label] == outcomes[label] for label in outcomes]):
smach.logdebug("Terminating concurrent split with mapped outcome.")
outcome = container_outcome
if child_outcomes_satisfied > max_child_outcomes_satisfied:
smach.logdebug("Terminating concurrent split with mapped outcome.")
outcome = container_outcome
max_child_outcomes_satisfied = child_outcomes_satisfied
else:
smach.logdebug("Skipping mapped outcome '%s' with fewer constraints." % container_outcome)

# Check outcome callback
if self._outcome_cb:
Expand Down

0 comments on commit 0a62d3e

Please sign in to comment.