Package SmootLight :: Package behaviors :: Module Expand
[hide private]
[frames] | no frames]

Source Code for Module SmootLight.behaviors.Expand

 1  from operationscore.Behavior import * 
2 -class Expand(Behavior):
3 """Expand is a behavior that generates a response that grows horizontally starting a location 4 specifed in input. Required Args: 5 <ExpandRate>123</ExpandRate> which is the expandrate in units/response""" 6
7 - def processResponse(self, sensorInputs, recurs):
8 ret = [] 9 for data in sensorInputs: 10 if not 'Left' in data: #If this is the first time we have seen this input 11 data['Left'] = data['Location'][0] 12 data['Right'] = data['Location'][0] 13 data['ExpandRate'] = self['ExpandRate'] 14 15 data = dict(data) 16 data['Left'] -= data['ExpandRate'] 17 data['Right'] += data['ExpandRate'] 18 data['Location'] = "{x}>" + str(data['Left']) + ", {x}<" +\ 19 str(data['Right'])+", {y}<50" 20 ret.append(data) 21 return (ret, [])
22