From 0366f46d3d7e946e254f933888aea4beb4e70658 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Wed, 1 Dec 2010 19:46:14 -0500 Subject: Added support for RecursiveHooks, RecursiveBehaviors and GaussianMapper supporting Gaussian based pixel mapping. --- behaviors/BehaviorChain.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'behaviors/BehaviorChain.py') diff --git a/behaviors/BehaviorChain.py b/behaviors/BehaviorChain.py index 8bf97bb..8b5cb1d 100644 --- a/behaviors/BehaviorChain.py +++ b/behaviors/BehaviorChain.py @@ -4,6 +4,9 @@ import pdb class BehaviorChain(Behavior): def behaviorInit(self): self.feedback = {} #dictionary to allow feedback of recursives + self.hooks = self['RecursiveHooks'] + if self.hooks == None: + self.hooks = {} def processResponse(self, sensorInputs, recursiveInputs): response = sensorInputs for behaviorId in self['ChainedBehaviors']: @@ -14,5 +17,11 @@ class BehaviorChain(Behavior): recurrence = [] (response,recurrence) = behavior.immediateProcessInput(response,\ recurrence) + + if behaviorId in self.hooks: #process recursive hook if there is one + hookBehavior = Util.getComponentById(self.hooks[behaviorId]) + (response, recurrence) = \ + hookBehavior.immediateProcessInput(response, + recurrence) self.feedback[behaviorId] = recurrence return response -- cgit v1.2.3