From 2019fb2895237aa9d86450daaf6d90831189fc13 Mon Sep 17 00:00:00 2001 From: rcoh Date: Mon, 24 Jan 2011 22:44:16 -0500 Subject: Some new stuff. Fixed a bug where screen responses weren't being synchronized. Now they are. Added XYMove to do a bouncy behavior. --- behaviors/AllPixels.py | 6 ++++++ behaviors/SingleFrame.xml | 7 +++++++ behaviors/XYMove.py | 17 +++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 behaviors/AllPixels.py create mode 100644 behaviors/SingleFrame.xml create mode 100644 behaviors/XYMove.py (limited to 'behaviors') diff --git a/behaviors/AllPixels.py b/behaviors/AllPixels.py new file mode 100644 index 0000000..e155e55 --- /dev/null +++ b/behaviors/AllPixels.py @@ -0,0 +1,6 @@ +from operationscore.Behavior import * +class AllPixels(Behavior): + def processResponse(self, sensorInputs, recursiveInputs): + for sensory in sensorInputs:#TODO: consider replicating the dict + sensory['Location'] = 'True' + return (sensorInputs, recursiveInputs) diff --git a/behaviors/SingleFrame.xml b/behaviors/SingleFrame.xml new file mode 100644 index 0000000..49b5dcf --- /dev/null +++ b/behaviors/SingleFrame.xml @@ -0,0 +1,7 @@ + + behaviors.AddPixelEvent + + pixelevents.SingleFrameEvent + 0 + + diff --git a/behaviors/XYMove.py b/behaviors/XYMove.py new file mode 100644 index 0000000..8acbba8 --- /dev/null +++ b/behaviors/XYMove.py @@ -0,0 +1,17 @@ +from operationscore.Behavior import * +import util.Geo as Geo +class XYMove(Behavior): + def processResponse(self, sensor, recurs): + ret = [] + for loc in sensor: + oploc = dict(loc) + self.insertStepIfMissing(oploc) + oploc['Location'] = Geo.addLocations((oploc['XStep'], oploc['YStep']), oploc['Location']) + ret.append(oploc) + return (ret, []) + def insertStepIfMissing(self, data): + if not 'XStep' in data: + data['XStep'] = self['XStep'] + if not 'YStep' in data: + data['YStep'] = self['YStep'] + -- cgit v1.2.3