aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LightInstallation.py8
-rw-r--r--behaviors/DecayBehavior.py3
-rw-r--r--config/.LightInstallationConfig.xml.swpbin20480 -> 20480 bytes
-rw-r--r--config/LayoutEngine.params6
-rw-r--r--config/LightInstallationConfig.xml6
-rw-r--r--layouts/LineLayout.py4
-rw-r--r--layouts/ZigzagLayout.py4
-rw-r--r--operationscore/PixelAssembler.py (renamed from operationscore/LayoutEngine.py)4
8 files changed, 15 insertions, 20 deletions
diff --git a/LightInstallation.py b/LightInstallation.py
index 2891e08..4efa17b 100644
--- a/LightInstallation.py
+++ b/LightInstallation.py
@@ -21,11 +21,11 @@ class LightInstallation:
config = Util.loadConfigFile(configFileName)
#read configs from xml
rendererConfig = config.find('RendererConfiguration')
- layoutConfig = config.find('LayoutConfiguration')
+ pixelConfig = config.find('PixelConfiguration')
inputConfig = config.find('InputConfiguration')
behaviorConfig = config.find('BehaviorConfiguration')
#inits
- self.initializeScreen(layoutConfig)
+ self.initializeScreen(pixelConfig)
self.initializeRenderers(rendererConfig)
self.initializeInputs(inputConfig)
self.initializeBehaviors(behaviorConfig)
@@ -36,8 +36,8 @@ class LightInstallation:
#Done initializing. Lets start this thing!
self.mainLoop()
def initializeScreen(self, layoutConfig):
- layoutEngines = self.initializeComponent(layoutConfig)
- [self.addPixelStrip(l) for l in layoutEngines]
+ pixelAssemblers = self.initializeComponent(layoutConfig)
+ [self.addPixelStrip(l) for l in pixelAssemblers]
def addPixelStrip(self, layoutEngine):
pixelStrip = PixelStrip(layoutEngine)
self.screen.addStrip(pixelStrip)
diff --git a/behaviors/DecayBehavior.py b/behaviors/DecayBehavior.py
index f9efa3b..7956cbc 100644
--- a/behaviors/DecayBehavior.py
+++ b/behaviors/DecayBehavior.py
@@ -5,11 +5,10 @@ import pdb
class DecayBehavior(Behavior):
def processResponse(self, sensorInputs, recursiveInputs):
ret = []
- #TODO: move into params
for sensory in sensorInputs:
outDict = {}
outDict[Util.location] = sensory[Util.location]
outDict['PixelEvent'] = \
- DecayEvent.generate('Proportional',100, sensory['Color'])
+ DecayEvent.generate(self['DecayType'],self['Coefficient'], sensory['Color'])
ret.append(outDict)
return ret
diff --git a/config/.LightInstallationConfig.xml.swp b/config/.LightInstallationConfig.xml.swp
index e3dbfd3..05e30ce 100644
--- a/config/.LightInstallationConfig.xml.swp
+++ b/config/.LightInstallationConfig.xml.swp
Binary files differ
diff --git a/config/LayoutEngine.params b/config/LayoutEngine.params
deleted file mode 100644
index 1b1dee5..0000000
--- a/config/LayoutEngine.params
+++ /dev/null
@@ -1,6 +0,0 @@
-{'pixelToPixelSpacing':'pixelToPixel spacing not defined in argDict. This is the
-length of wire between 2 adjacent LEDs. Common values are 4 or 12.
-Specified in config XML.', 'numPixels': 'numPixels not defined in
-argDict. Common value: 50.', 'originLocation':'originLocation not
-defined in argDict. Values should be a string in the form (x,y). This
-should be specified in the config XML.'}
diff --git a/config/LightInstallationConfig.xml b/config/LightInstallationConfig.xml
index a4722db..3f73e0c 100644
--- a/config/LightInstallationConfig.xml
+++ b/config/LightInstallationConfig.xml
@@ -1,6 +1,6 @@
<!---All configuration items contain a "Class" tag specifying the python class they represent, and an "Args" tag specifying the args to be passed in.-->
<LightInstallation>
- <LayoutConfiguration>
+ <PixelConfiguration>
<PixelStrip>
<Class>layouts.ZigzagLayout</Class><!--Name of Layout Class,
@@ -34,7 +34,7 @@
<originLocation>(10,30)</originLocation>
</Args>
</PixelStrip>
- </LayoutConfiguration>
+ </PixelConfiguration>
<RendererConfiguration>
<Renderer>
<Class>renderers.PygameRenderer</Class>
@@ -102,6 +102,8 @@
<Class>behaviors.DecayBehavior</Class>
<Args>
<Id>decay</Id>
+ <DecayType>Exponential</DecayType>
+ <Coefficient>.01</Coefficient>
<z-index>0</z-index>
<RenderToScreen>False</RenderToScreen>
<Inputs>
diff --git a/layouts/LineLayout.py b/layouts/LineLayout.py
index 3a8b747..34f5e36 100644
--- a/layouts/LineLayout.py
+++ b/layouts/LineLayout.py
@@ -1,5 +1,5 @@
-from operationscore.LayoutEngine import *
+from operationscore.PixelAssembler import *
#Simple layout class that simply makes a line of LEDs
-class LineLayout(LayoutEngine):
+class LineLayout(PixelAssembler):
def layoutFunc(self, lastLocation):
return (lastLocation[0]+self.argDict['spacing'], lastLocation[1])
diff --git a/layouts/ZigzagLayout.py b/layouts/ZigzagLayout.py
index 26b27d8..221571c 100644
--- a/layouts/ZigzagLayout.py
+++ b/layouts/ZigzagLayout.py
@@ -1,4 +1,4 @@
-from operationscore.LayoutEngine import *
+from operationscore.PixelAssembler import *
import pdb
#Slightly more complex layout class that makes a zig-Zag Led Pattern
#Inheriting classes must specify zigLength, the length in lights of a of a zig
@@ -9,7 +9,7 @@ import pdb
# X-X-X-X
# |
# X-X-X-X etc.
-class ZigzagLayout(LayoutEngine):
+class ZigzagLayout(PixelAssembler):
def initLayout(self):
if not 'zigLength' in self.argDict:
raise Exception('zigLength must be defined in argDict')
diff --git a/operationscore/LayoutEngine.py b/operationscore/PixelAssembler.py
index 700b554..b6e35ac 100644
--- a/operationscore/LayoutEngine.py
+++ b/operationscore/PixelAssembler.py
@@ -1,9 +1,9 @@
from operationscore.SmootCoreObject import *
import Util
import pdb
-class LayoutEngine(SmootCoreObject):
+class PixelAssembler(SmootCoreObject):
def init(self):
- self.validateArgs('LayoutEngine.params')
+ self.validateArgs('PixelAssembler.params')
self.initLayout()
def layoutFunc(self, lastLocation): #Must be defined by inheriting class.
#Returns tuple pair (x,y)