diff options
author | rcoh <rcoh@mit.edu> | 2011-02-12 20:39:58 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2011-02-12 20:39:58 -0500 |
commit | c8316a35a1eb292f09db8b7ff36dd33b43dfe8b6 (patch) | |
tree | 4abd076114d333440c239af950f630cbbbcf329b /behaviors | |
parent | a239c7accdc634459d2db014b8d8b6d5b78bab1b (diff) |
Added an override of setLastOutput to square.py. Added some pre-built queries into the BQS.
Modified the default behavior or setLastOutput to make a deep copy of ouput to prevent accidental
interference.
Diffstat (limited to 'behaviors')
-rw-r--r-- | behaviors/Square.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/behaviors/Square.py b/behaviors/Square.py index 9d3223a..5fdaeef 100644 --- a/behaviors/Square.py +++ b/behaviors/Square.py @@ -7,6 +7,7 @@ class Square(Behavior): def processResponse(self, sensorInputs, recursiveInputs): for sensory in sensorInputs:#TODO: consider replicating the dict + sensory['CenterLoc'] = list(sensory['Location']) xLoc = sensory['Location'][0] yLoc = sensory['Location'][1] width = self['Width'] @@ -15,3 +16,9 @@ class Square(Behavior): '{x}<'+str(xLoc+width)+',{x}>'+str(xLoc-width)+\ ',{y}<'+str(yLoc+width)+',{y}>'+str(yLoc-width) return (sensorInputs, recursiveInputs) + + def setLastOutput(self, output): + coutput = Behavior.deepCopyPacket(output) + for data in coutput: + data['Location'] = data['CenterLoc'] + return coutput |