From 3319a58ecc391f9aac092ade45f9f50dc2af5aa6 Mon Sep 17 00:00:00 2001 From: rcoh Date: Fri, 28 Jan 2011 09:50:38 -0500 Subject: Finishing up for the demo --- behaviors/Accelerate.xml | 2 +- behaviors/DimColor.xml | 2 +- behaviors/Expand.py | 3 ++- behaviors/MITDoors.py | 7 +++++++ behaviors/ResponseMover.py | 8 +------- behaviors/XYMove.py | 1 - 6 files changed, 12 insertions(+), 11 deletions(-) (limited to 'behaviors') diff --git a/behaviors/Accelerate.xml b/behaviors/Accelerate.xml index f9de077..c78195b 100644 --- a/behaviors/Accelerate.xml +++ b/behaviors/Accelerate.xml @@ -3,6 +3,6 @@ Sensor StepSize - {val}*1.1 + {val}*1.01 diff --git a/behaviors/DimColor.xml b/behaviors/DimColor.xml index 58b0673..ef98fee 100644 --- a/behaviors/DimColor.xml +++ b/behaviors/DimColor.xml @@ -3,6 +3,6 @@ Sensor Color - [chan*.95 for chan in {val}] + [chan*.98 for chan in {val}] diff --git a/behaviors/Expand.py b/behaviors/Expand.py index 323e71f..f017c16 100644 --- a/behaviors/Expand.py +++ b/behaviors/Expand.py @@ -15,7 +15,8 @@ class Expand(Behavior): data = dict(data) data['Left'] -= data['ExpandRate'] data['Right'] += data['ExpandRate'] - data['Location'] = "{x}>" + str(data['Left']) + ", {x}<" + str(data['Right']) + data['Location'] = "{x}>" + str(data['Left']) + ", {x}<" +\ + str(data['Right'])+", {y}<50" ret.append(data) return (ret, []) diff --git a/behaviors/MITDoors.py b/behaviors/MITDoors.py index d602a55..03bef6d 100644 --- a/behaviors/MITDoors.py +++ b/behaviors/MITDoors.py @@ -1,4 +1,6 @@ from operationscore.Behavior import * +import math +import util.ComponentRegistry as compReg class MITDoors(Behavior): """MITDoors is a case-specific behavior to map keypresses to specific locations. Written for Kuan 1/26/11 by RCOH""" @@ -6,6 +8,11 @@ class MITDoors(Behavior): def behaviorInit(self): self.keymapping = {'q':[2,19], 'w':[22,36], 'e':[37,49], 'r':[52,69], 't':[76,91], 'y':[94,105], 'u':[106,117], 'i':[123,154], 'o':[158,161], 'p':[164,167], '[':[172,184]} + screenWidth = compReg.getComponent('Screen').getSize()[2] #(minx, miny,maxx, maxy) + maxKey = max([max(self.keymapping[v]) for v in self.keymapping]) + mult = screenWidth / float(maxKey) + for k in self.keymapping: + self.keymapping[k] = [int(val*mult) for val in self.keymapping[k]] def processResponse(self, sensorInputs, recursiveInputs): ret = [] for data in sensorInputs: diff --git a/behaviors/ResponseMover.py b/behaviors/ResponseMover.py index 59e353a..3d559df 100644 --- a/behaviors/ResponseMover.py +++ b/behaviors/ResponseMover.py @@ -7,11 +7,5 @@ class ResponseMover(Behavior): modulates the location.""" def processResponse(self, sensorInputs, recursiveInputs): - newResponses = sensorInputs - ret = [] - for recurInput in recursiveInputs: - outDict = dict(recurInput) - ret.append(outDict) - ret += newResponses - return (ret, ret) + return (recursiveInputs, recursiveInputs+sensorInputs) diff --git a/behaviors/XYMove.py b/behaviors/XYMove.py index 0ba3baf..11cee96 100644 --- a/behaviors/XYMove.py +++ b/behaviors/XYMove.py @@ -13,7 +13,6 @@ class XYMove(Behavior): for loc in sensor: oploc = dict(loc) self.insertStepIfMissing(oploc) - print oploc['YStep'] oploc['Location'] = Geo.addLocations((oploc['XStep'], oploc['YStep']), oploc['Location']) ret.append(oploc) return (ret, []) -- cgit v1.2.3