aboutsummaryrefslogtreecommitdiff
path: root/behaviors/Square.py
diff options
context:
space:
mode:
authorGravatar Dan <dan@rcoh-ubuntu-small.(none)>2011-01-28 10:11:22 -0500
committerGravatar Dan <dan@rcoh-ubuntu-small.(none)>2011-01-28 10:11:22 -0500
commita028c880c8325419a238667e71a7e919b72a4798 (patch)
tree5a07f674fcead141165a5b4fec0143c3e6c60e05 /behaviors/Square.py
parentb8bb5e82a2e8802b9adb1258463d4198f974dbd1 (diff)
parent3319a58ecc391f9aac092ade45f9f50dc2af5aa6 (diff)
Merge branch 'fridaydemo' of github.com:rcoh/SmootLight into osc
Diffstat (limited to 'behaviors/Square.py')
-rw-r--r--behaviors/Square.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/behaviors/Square.py b/behaviors/Square.py
index ecd000c..9d3223a 100644
--- a/behaviors/Square.py
+++ b/behaviors/Square.py
@@ -1,13 +1,17 @@
from operationscore.Behavior import *
class Square(Behavior):
- def processResponse(self, sensorInputs, recursiveInputs):
- for sensory in sensorInputs:#TODO: consider replicating the dict
- if 'Location' in sensory:
- xLoc = sensory['Location'][0]
- yLoc = sensory['Location'][1]
- width = self['Width']
- #sensory['Location'] = 'True'
- sensory['Location'] =\
- '{x}<'+str(xLoc+width)+',{x}>'+str(xLoc-width)+\
- ',{y}<'+str(yLoc+width)+',{y}>'+str(yLoc-width)
- return (sensorInputs, recursiveInputs)
+ """Square is a simple behavior that makes a square with side lengths Width*2 around locations in
+ the sensor input. Specify:
+ <Width> -- the sidelength/2
+ """
+
+ def processResponse(self, sensorInputs, recursiveInputs):
+ for sensory in sensorInputs:#TODO: consider replicating the dict
+ xLoc = sensory['Location'][0]
+ yLoc = sensory['Location'][1]
+ width = self['Width']
+ #sensory['Location'] = 'True'
+ sensory['Location'] =\
+ '{x}<'+str(xLoc+width)+',{x}>'+str(xLoc-width)+\
+ ',{y}<'+str(yLoc+width)+',{y}>'+str(yLoc-width)
+ return (sensorInputs, recursiveInputs)