diff options
Diffstat (limited to 'behaviors/ExpandingColorZones.py')
-rw-r--r-- | behaviors/ExpandingColorZones.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/behaviors/ExpandingColorZones.py b/behaviors/ExpandingColorZones.py new file mode 100644 index 0000000..75be761 --- /dev/null +++ b/behaviors/ExpandingColorZones.py @@ -0,0 +1,21 @@ +from operationscore.Behavior import * +from logger import main_log +class ExpandingColorZones(Behavior): + def behaviorInit(self): + self.mapping = {'s001':[(132,0),(255,0,0)], 's002':[(400,0), (0,255,0)], + 's003':[(668,0), + (0,0,255)]} + self.mappingkey = 'data' + def processResponse(self, sensorInputs, recursiveInputs): + ret = [] + for data in sensorInputs: + print data + data = dict(data) + if self.mappingkey in data: + try: + data['Location'], data['Color'] =\ + self.mapping[data[self.mappingkey]] + ret.append(data) + except: + main_log.warn('Bad mapping key. Expanding Color Zones.') + return (ret,[]) |