aboutsummaryrefslogtreecommitdiff
path: root/operationscore
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2011-02-09 12:14:27 -0500
committerGravatar rcoh <rcoh@mit.edu>2011-02-09 12:14:27 -0500
commitb45b9079c5decd720d8275378bb0d6dc172c6234 (patch)
tree9e8df9308191bb687d14c3df8bb5078b51ba6059 /operationscore
parent03d08792f437e1ce93dc0cbfa997025029c8e74e (diff)
Early stages of support for interbehavior interactions. Fixed a bug in the config eval and added
some new tests.
Diffstat (limited to 'operationscore')
-rw-r--r--operationscore/Behavior.py8
-rw-r--r--operationscore/Input.py2
2 files changed, 6 insertions, 4 deletions
diff --git a/operationscore/Behavior.py b/operationscore/Behavior.py
index 6424842..97fa020 100644
--- a/operationscore/Behavior.py
+++ b/operationscore/Behavior.py
@@ -1,9 +1,6 @@
-
import pdb
from operationscore.SmootCoreObject import *
from logger import main_log
-#timeStep is called on every iteration of the LightInstallation
-#addInput is called on each individual input received, and the inputs queue
class Behavior(SmootCoreObject):
"""Abstract class for a behavior. On every time step, the behavior is passed the
inputs from all sensors it is bound to as well as any recursive inputs that it
@@ -44,6 +41,11 @@ class Behavior(SmootCoreObject):
else:
self.addInput(sensorInputs)
#private
+ def getLastOutput(self):
+ return self.lastState
+ def setLastOutput(self, output):
+ """Override to modify state."""
+ self.lastState = output
def addMapperToResponse(self, responses):
if self['Mapper'] != None:
if type(responses) == type(tuple):
diff --git a/operationscore/Input.py b/operationscore/Input.py
index d3d5644..5a835ec 100644
--- a/operationscore/Input.py
+++ b/operationscore/Input.py
@@ -17,7 +17,7 @@ class Input(ThreadedSmootCoreObject):
self.inputInit()
def respond(self, eventDict):
- #if eventDict != []:
+ eventDict['InputId'] = self['Id']
self.parentScope.lock.acquire()
self.parentScope.processResponse(self.argDict, eventDict)
self.parentScope.lock.release()