diff options
author | Daniel <dmt@daniel-desktop.(none)> | 2011-01-29 18:54:50 -0800 |
---|---|---|
committer | Daniel <dmt@daniel-desktop.(none)> | 2011-01-29 18:54:50 -0800 |
commit | ff07b18748c64243c1c6bc62f489bfd03205d13a (patch) | |
tree | db95373a3511be0dd1e700a78e9f1ea7320769a4 /behaviors/MobileShakeBehavior.py | |
parent | 83931a3c8e65b4018e98b4986458d1df7172ab91 (diff) | |
parent | 277a5143165d2553ce5e97f151cc6b3cea426468 (diff) |
Merge branch 'master' of github.com:rcoh/SmootLight
Diffstat (limited to 'behaviors/MobileShakeBehavior.py')
-rw-r--r-- | behaviors/MobileShakeBehavior.py | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/behaviors/MobileShakeBehavior.py b/behaviors/MobileShakeBehavior.py index e25e929..b05cb5f 100644 --- a/behaviors/MobileShakeBehavior.py +++ b/behaviors/MobileShakeBehavior.py @@ -1,17 +1,26 @@ from operationscore.Behavior import * +import util.ComponentRegistry as compReg import util.Strings as Strings class MobileShakeBehavior(Behavior): + def behaviorInit(self): + self.mapper = None + def processResponse(self, sensorInputs, recursiveInputs): + if self.mapper == None: + try: + self.mapper = compReg.getComponent('mobilegaussmap') + except KeyError: + pass + #print sensorInputs - ret = [] for sInput in sensorInputs: - outDict = dict(sInput) - if 'type' in sInput and sInput['type'] == 2: - outDict['Location'] = '{x}>' + str(0) + ',{y}>' + str(0) - outDict['Color'] = [sInput['r'], sInput['g'], sInput['b']] - else: # dumb invisible pixel - outDict['Location'] = (-1, -1) - outDict['Color'] = [0, 0, 0] - ret.append(outDict) - return (ret, recursiveInputs) + if 'Shake' in sInput and sInput['Shake'] == 1: + #print 'increase!' + self.mapper.argDict['Width'] += 30 + #self.mapper.argDict['CutoffDist'] += 20 + sInput['Shake'] = 0 + print 'Width:' + str(compReg.getComponent('mobilegaussmap').argDict['Width']) + #print 'CutoffDist: '+ str(compReg.getComponent('mobilegaussmap').argDict['CutoffDist']) + + return (sensorInputs, recursiveInputs) |