aboutsummaryrefslogtreecommitdiff
path: root/behaviors
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2011-01-28 17:09:46 -0500
committerGravatar rcoh <rcoh@mit.edu>2011-01-28 17:09:46 -0500
commitd43f5ef8a771fbfd3a3f38f0eb018d3f84589bf7 (patch)
tree76180b0610cd732b00d58c67e77818b7f89d893b /behaviors
parentb67a37ad06fa4c97dcdb32cecc71c7f492b12840 (diff)
Finishing touches to OSC stuff.
Diffstat (limited to 'behaviors')
-rw-r--r--behaviors/AddPixelEvent.py2
-rw-r--r--behaviors/ControllerOSC.py13
-rw-r--r--behaviors/TouchOSC.py2
3 files changed, 5 insertions, 12 deletions
diff --git a/behaviors/AddPixelEvent.py b/behaviors/AddPixelEvent.py
index 821f432..da3f7c2 100644
--- a/behaviors/AddPixelEvent.py
+++ b/behaviors/AddPixelEvent.py
@@ -21,8 +21,6 @@ class AddPixelEvent(Behavior):
ret = []
for sensory in sensors:
outDict = {}
- if not 'Location' in sensory:
- pdb.set_trace()
outDict[Strings.LOCATION] = sensory[Strings.LOCATION]
settingsDict = dict(self.argDict)
settingsDict['Color'] = sensory['Color']
diff --git a/behaviors/ControllerOSC.py b/behaviors/ControllerOSC.py
index ce2cf26..05d2e7d 100644
--- a/behaviors/ControllerOSC.py
+++ b/behaviors/ControllerOSC.py
@@ -7,7 +7,7 @@ import pdb
import util.ComponentRegistry as compReg
speedfactor = 15
-vel_decay = .00
+vel_decay = .9
def constrainLocation(v,c):
if v[0] > c[0]:
@@ -40,12 +40,11 @@ class ControllerOSC(Behavior):
#try:
x = data['Value'][0]
y = data['Value'][1]
- main_log.error(str(x))
if y < 0:
self.start_hsv[1] = 1.0+y #s
else:
self.start_hsv[2] = 1.0-y
- self.start_hsv[0] = (x+1) * 180.0
+ self.start_hsv[0] = (x+1)/2.
elif data['Path'] == '/sixaxis/lrud':
val=data['Value']
vy = val[3]-val[2]
@@ -57,11 +56,7 @@ class ControllerOSC(Behavior):
main_log.error('Sensor Inputs: ' + str(sensorInputs))
self.xy = self.xy + self.v_xy
constrainLocation(self.xy,self.ssize)
- self.v_xy -= self.v_decay
- if self.v_xy[0] < 0:
- self.v_xy[0] = 0
- if self.v_xy[1] < 0:
- self.v_xy[1] = 0
- ret.append({'Color':[i*255 for i in colorsys.hsv_to_rgb(*self.start_hsv)],'Location':(int(self.xy[0]), int(self.xy[1]))})
+ self.v_xy *= self.v_decay
+ ret.append({'Color':[i*255. for i in colorsys.hsv_to_rgb(*self.start_hsv)],'Location':(int(self.xy[0]), int(self.xy[1]))})
return (ret, [])
diff --git a/behaviors/TouchOSC.py b/behaviors/TouchOSC.py
index 1c41b5e..e7893e3 100644
--- a/behaviors/TouchOSC.py
+++ b/behaviors/TouchOSC.py
@@ -15,7 +15,7 @@ class TouchOSC(Behavior):
for data in sensorInputs:
if data['Path'] == '/1/fader1':
try:
- self.h = data['Value'][0]*360.0
+ self.h = data['Value'][0]
except:
pdb.set_trace()
elif data['Path'] == '/1/fader2':