diff options
author | rcoh <rcoh@mit.edu> | 2011-01-25 14:07:05 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2011-01-25 14:07:05 -0500 |
commit | ad8ad25072f55413ecfd696eff1e07c1cd08984e (patch) | |
tree | 98eae0d23f8def7765b490d8d37e9716628aed60 /behaviors/ModifyParam.py | |
parent | 2019fb2895237aa9d86450daaf6d90831189fc13 (diff) |
Fancy param modification
Diffstat (limited to 'behaviors/ModifyParam.py')
-rw-r--r-- | behaviors/ModifyParam.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/behaviors/ModifyParam.py b/behaviors/ModifyParam.py index f589e05..6e76d05 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): @@ -16,6 +17,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) |