From c8316a35a1eb292f09db8b7ff36dd33b43dfe8b6 Mon Sep 17 00:00:00 2001 From: rcoh Date: Sat, 12 Feb 2011 20:39:58 -0500 Subject: 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. --- behaviors/Square.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'behaviors') 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 -- cgit v1.2.3