diff options
Diffstat (limited to 'behaviors/BehaviorChain.py')
-rw-r--r-- | behaviors/BehaviorChain.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/behaviors/BehaviorChain.py b/behaviors/BehaviorChain.py index 15f7d74..8bf97bb 100644 --- a/behaviors/BehaviorChain.py +++ b/behaviors/BehaviorChain.py @@ -2,9 +2,17 @@ from operationscore.Behavior import * import Util import pdb class BehaviorChain(Behavior): + def behaviorInit(self): + self.feedback = {} #dictionary to allow feedback of recursives def processResponse(self, sensorInputs, recursiveInputs): response = sensorInputs for behaviorId in self['ChainedBehaviors']: behavior = Util.getComponentById(behaviorId) - response = behavior.immediateProcessInput(response) + if behaviorId in self.feedback: + recurrence = self.feedback[behaviorId] + else: + recurrence = [] + (response,recurrence) = behavior.immediateProcessInput(response,\ + recurrence) + self.feedback[behaviorId] = recurrence return response |