aboutsummaryrefslogtreecommitdiff
path: root/behaviors/BehaviorChain.py
diff options
context:
space:
mode:
authorGravatar Russell Cohen <rcoh@mit.edu>2010-12-01 19:46:14 -0500
committerGravatar Russell Cohen <rcoh@mit.edu>2010-12-01 19:46:14 -0500
commit0366f46d3d7e946e254f933888aea4beb4e70658 (patch)
tree81e69d857c41d9ff6ab0ee49315c26cd6112f3a9 /behaviors/BehaviorChain.py
parentcf1f2224b3625b01a6aa7db221403849b308b3bc (diff)
Added support for RecursiveHooks, RecursiveBehaviors and GaussianMapper
supporting Gaussian based pixel mapping.
Diffstat (limited to 'behaviors/BehaviorChain.py')
-rw-r--r--behaviors/BehaviorChain.py9
1 files changed, 9 insertions, 0 deletions
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