diff options
Diffstat (limited to 'behaviors/Expand.py')
-rw-r--r-- | behaviors/Expand.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/behaviors/Expand.py b/behaviors/Expand.py new file mode 100644 index 0000000..3415966 --- /dev/null +++ b/behaviors/Expand.py @@ -0,0 +1,17 @@ +from operationscore.Behavior import * +class Expand(Behavior): + def processResponse(self, sensorInputs, recurs): + ret = [] + for data in sensorInputs: + if not 'Left' in data: #If this is the first time we have seen this input + data['Left'] = data['Location'][0] + data['Right'] = data['Location'][0] + data['ExpandRate'] = self['ExpandRate'] + + data = dict(data) + data['Left'] -= data['ExpandRate'] + data['Right'] += data['ExpandRate'] + data['Location'] = "{x}>" + str(data['Left']) + ", {x}<" + str(data['Right']) + ret.append(data) + return (ret, []) + |