diff options
author | Russell Cohen <rcoh@mit.edu> | 2011-01-26 22:24:55 -0500 |
---|---|---|
committer | Russell Cohen <rcoh@mit.edu> | 2011-01-26 22:24:55 -0500 |
commit | 5d29906fff79bc6e4ba83be7028e1380a0014d21 (patch) | |
tree | 0bb2350046aa69c3b1095983fea59c49026a857b /behaviors | |
parent | 2019fb2895237aa9d86450daaf6d90831189fc13 (diff) | |
parent | 82f99fc4583ca3cc9861a9fe30990a4a9ef162c4 (diff) |
Merge branch 'mobileapp' into biginstall
Conflicts:
behaviors/RestrictLocation.py
behaviors/Square.py
config/6thFloor.xml
inputs/TCPInput.py
layouts/60StripLayout.xml
operationscore/Behavior.py
operationscore/PixelMapper.py
pixelcore/Pixel.py
pixelcore/Screen.py
renderers/60StripSeq.xml
Diffstat (limited to 'behaviors')
-rw-r--r-- | behaviors/DebugBehavior.py | 2 | ||||
-rw-r--r-- | behaviors/DimColor.xml | 8 | ||||
-rw-r--r-- | behaviors/DoorBehavior.py | 4 | ||||
-rw-r--r-- | behaviors/Expand.py | 17 | ||||
-rw-r--r-- | behaviors/MoveBehavior.py | 27 |
5 files changed, 57 insertions, 1 deletions
diff --git a/behaviors/DebugBehavior.py b/behaviors/DebugBehavior.py index 34f4106..17383db 100644 --- a/behaviors/DebugBehavior.py +++ b/behaviors/DebugBehavior.py @@ -4,5 +4,5 @@ import pdb class DebugBehavior(Behavior): def processResponse(self, sensorInputs, recursiveInputs): if sensorInputs != []: - main_log.debug('Sensor Inputs: ' + str(sensorInputs)) + main_log.error('Sensor Inputs: ' + str(sensorInputs)) return ([], []) diff --git a/behaviors/DimColor.xml b/behaviors/DimColor.xml new file mode 100644 index 0000000..b01908e --- /dev/null +++ b/behaviors/DimColor.xml @@ -0,0 +1,8 @@ +<Behavior> + <Class>behaviors.ModifyParam</Class> + <Args> + <ParamType>Sensor</ParamType> + <ParamName>Color</ParamName> + <ParamOp>[chan*.99 for chan in {val}]</ParamOp> + </Args> +</Behavior> diff --git a/behaviors/DoorBehavior.py b/behaviors/DoorBehavior.py new file mode 100644 index 0000000..5058f69 --- /dev/null +++ b/behaviors/DoorBehavior.py @@ -0,0 +1,4 @@ +from operationscore.behavior import * +class DoorBehavior.py(Behavior): + def behaviorInit(self): + pyt 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, []) + diff --git a/behaviors/MoveBehavior.py b/behaviors/MoveBehavior.py new file mode 100644 index 0000000..590f0e4 --- /dev/null +++ b/behaviors/MoveBehavior.py @@ -0,0 +1,27 @@ +from operationscore.Behavior import * +import util.ComponentRegistry as compReg +import util.Geo as Geo +import util.Strings as Strings + +class MoveBehavior(Behavior): + def processResponse(self, sensorInputs, recursiveInputs): + if recursiveInputs: + currRecLocs = recursiveInputs + else: + currRecLocs = [{'Location' : (5, 5), 'Color' : [255, 255, 255]}] + + if sensorInputs: # if input exists, change location + ret = [] + for currRecLoc in currRecLocs: + currDict = dict(currRecLoc) + for sensorInput in sensorInputs: + currDict['Location'] = (currDict['Location'][0] - sensorInput['x'] * self['XStep'], \ + currDict['Location'][1] + sensorInput['y'] * self['YStep']) + currDict['Color'] = [sensorInput['r'], sensorInput['g'], sensorInput['b']] + ret.append(currDict) + #print ret + return (ret, ret) + + else: # if not, return current recursive location. + #print currRecLocs + return (currRecLocs, currRecLocs) |