aboutsummaryrefslogtreecommitdiff
path: root/behaviors
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2011-01-27 17:24:32 -0500
committerGravatar rcoh <rcoh@mit.edu>2011-01-27 17:24:32 -0500
commit3bca013bad5730ce0749de38fba334af67dd4bc1 (patch)
tree050c711a7b0b21d5ef4e0c04218535fa738185e9 /behaviors
parent4fbb65efee8a214d9a35395e46c582f251ea2a35 (diff)
parentad8ad25072f55413ecfd696eff1e07c1cd08984e (diff)
Merge branch 'experimental'
Conflicts: config/6thFloor.xml
Diffstat (limited to 'behaviors')
-rw-r--r--behaviors/ModifyParam.py4
-rw-r--r--behaviors/XYMove.py1
2 files changed, 5 insertions, 0 deletions
diff --git a/behaviors/ModifyParam.py b/behaviors/ModifyParam.py
index 4f45be0..2c8f12d 100644
--- a/behaviors/ModifyParam.py
+++ b/behaviors/ModifyParam.py
@@ -1,4 +1,5 @@
from operationscore.Behavior import *
+import math
import pdb
#Class to perform a given operation on some element of an argDict. Designed to be used a recursive hook, but can serve sensor-based functions as well. Specify ParamType (Sensor or Recurse), ParamName, and ParamOp, (a valid python statement with the old value represented as {val})
class ModifyParam(Behavior):
@@ -25,6 +26,9 @@ class ModifyParam(Behavior):
if paramName in behaviorInput: #TODO: copy -> modify instead of just
#copying
paramOp = paramOp.replace('{val}', 'behaviorInput[paramName]') #convert the {val} marker to something we can execute
+ #TODO: move elsewhere
+ paramOp = paramOp.replace('{y}', "behaviorInput['Location'][1]")
+ paramOp = paramOp.replace('{x}', "behaviorInput['Location'][0]")
behaviorInput[paramName] = eval(paramOp)
if paramType == 'Sensor': #return accordingly
return (searchSet, recursiveInputs)
diff --git a/behaviors/XYMove.py b/behaviors/XYMove.py
index 11cee96..0ba3baf 100644
--- a/behaviors/XYMove.py
+++ b/behaviors/XYMove.py
@@ -13,6 +13,7 @@ class XYMove(Behavior):
for loc in sensor:
oploc = dict(loc)
self.insertStepIfMissing(oploc)
+ print oploc['YStep']
oploc['Location'] = Geo.addLocations((oploc['XStep'], oploc['YStep']), oploc['Location'])
ret.append(oploc)
return (ret, [])