aboutsummaryrefslogtreecommitdiff
path: root/operationscore/Behavior.py
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2011-02-12 15:59:59 -0500
committerGravatar rcoh <rcoh@mit.edu>2011-02-12 15:59:59 -0500
commit4d62e1152241854ab864142d827d735d84405078 (patch)
tree2589c6a37721e1b8362c8e8c6a580c8c185b2f86 /operationscore/Behavior.py
parentb45b9079c5decd720d8275378bb0d6dc172c6234 (diff)
Modified the test code to automatically pick up new tests. Just add your test file to
tests/__init__.py. Fixed a bug in ZigZagLayout. Added the BehaviorQuerySystem to allow querying on behaviors. Added the "ModulateColor" behavior which will continually shift a color along the HSV plane. Added TestBQS to test the behavior query system. Modified Behavior to have a getLastOutput and setLastOutput method.
Diffstat (limited to 'operationscore/Behavior.py')
-rw-r--r--operationscore/Behavior.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/operationscore/Behavior.py b/operationscore/Behavior.py
index 97fa020..7090a23 100644
--- a/operationscore/Behavior.py
+++ b/operationscore/Behavior.py
@@ -19,6 +19,7 @@ class Behavior(SmootCoreObject):
self.recursiveResponseQueue = []
self.sensorResponseQueue = []
self.outGoingQueue = []
+ self.lastState = None
self.behaviorInit()
def behaviorInit(self):
pass
@@ -44,7 +45,9 @@ class Behavior(SmootCoreObject):
def getLastOutput(self):
return self.lastState
def setLastOutput(self, output):
- """Override to modify state."""
+ """Override to modify state. For example: if you are using a behavior that does uses
+ strings for location specification, you will want to override this to point to a single
+ location. Make sure you keep lastState as a [] of {}. (List of dicts)"""
self.lastState = output
def addMapperToResponse(self, responses):
if self['Mapper'] != None:
@@ -61,5 +64,6 @@ class Behavior(SmootCoreObject):
self.recursiveResponseQueue)
self.sensorResponseQueue = []
self.recursiveResponseQueue = recursions
+ self.setLastOutput(outputs)
main_log.debug(self['Id'] + ' Ouputs ' + str(outputs))
return self.addMapperToResponse(outputs)