diff options
author | Dan <dan@rcoh-ubuntu-small.(none)> | 2011-01-28 10:11:22 -0500 |
---|---|---|
committer | Dan <dan@rcoh-ubuntu-small.(none)> | 2011-01-28 10:11:22 -0500 |
commit | a028c880c8325419a238667e71a7e919b72a4798 (patch) | |
tree | 5a07f674fcead141165a5b4fec0143c3e6c60e05 /behaviors/Expand.py | |
parent | b8bb5e82a2e8802b9adb1258463d4198f974dbd1 (diff) | |
parent | 3319a58ecc391f9aac092ade45f9f50dc2af5aa6 (diff) |
Merge branch 'fridaydemo' of github.com:rcoh/SmootLight into osc
Diffstat (limited to 'behaviors/Expand.py')
-rw-r--r-- | behaviors/Expand.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/behaviors/Expand.py b/behaviors/Expand.py new file mode 100644 index 0000000..f017c16 --- /dev/null +++ b/behaviors/Expand.py @@ -0,0 +1,22 @@ +from operationscore.Behavior import * +class Expand(Behavior): + """Expand is a behavior that generates a response that grows horizontally starting a location + specifed in input. Required Args: + <ExpandRate>123</ExpandRate> which is the expandrate in units/response""" + + 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'])+", {y}<50" + ret.append(data) + return (ret, []) + |