예제 #1
0
def laser_loop(q):
    import LaserDisplay
    from LaserDisplay.SvgProcessor import SvgProcessor

    LD = LaserDisplay.create()

    LD.set_scan_rate(30000)
    LD.set_blanking_delay(0)

    sp = SvgProcessor(LD)
    svg = None

    while True:
        if not q.empty():
            svg = q.get()
        if not svg is None:
            sp.parseString(svg, 255.0/595.0)
            LD.show_frame()
            time.sleep(1.0/25.0)
예제 #2
0
def laser_loop(q):
    import LaserDisplay
    from LaserDisplay.SvgProcessor import SvgProcessor

    LD = LaserDisplay.create()

    LD.set_scan_rate(30000)
    LD.set_blanking_delay(0)

    sp = SvgProcessor(LD)
    svg = None

    while True:
        if not q.empty():
            svg = q.get()
        if not svg is None:
            sp.parseString(svg, 255.0 / 595.0)
            LD.show_frame()
            time.sleep(1.0 / 25.0)
예제 #3
0
#!/usr/bin/env python

import sys
import LaserDisplay
from LaserDisplay.SvgProcessor import SvgProcessor

if len(sys.argv) < 2:
    print 'Usage: showsvg filename.svg'
    sys.exit(1)

LD = LaserDisplay.create()

LD.set_scan_rate(30000)
LD.set_blanking_delay(0)

sp = SvgProcessor(LD)

while True:
    sp.parseFile(sys.argv[1])
    LD.show_frame()
예제 #4
0
#!/usr/bin/env python
# A clock!
from LaserDisplay import *
import math
import random

WIDTH = 255
HEIGHT = 255

LD = LaserDisplay()

import time

LD.set_scan_rate(30000)
LD.set_blanking_delay(0)

while True:
  t = time.localtime()
  
  hours = t.tm_hour%12
  minutes = t.tm_min
  seconds = t.tm_sec

#  LD.set_color(RED)
#  LD.draw_text("%02i:%02i:%02i"%(hours,minutes,seconds), 220, 220, 20)

  LD.set_color(GREEN)
  angle = 2*PI*seconds/60 + PI/2
  r = 2.0/3 * (WIDTH/2)
  LD.draw_line(WIDTH/2, HEIGHT/2, WIDTH/2 + r*math.cos(angle), HEIGHT/2 + r*math.sin(angle))
예제 #5
0
#!/usr/bin/env python
# display ILDA animations from a given file

from LaserDisplay import *
import ILDA

#LD = LaserDisplay()
LD = LaserDisplay({"server": "localhost", "port": 50000})
LD.set_scan_rate(37000)
LD.set_blanking_delay(0)

WIDTH = 200
HEIGHT = 200
import sys
import random
ilda_file = open(sys.argv[1], 'rb')
ilda_frames = ILDA.readFrames(ilda_file)

frames = []
for f in ilda_frames:
    frame = []
    for p in f.iterPoints():
        frame.append(
            [WIDTH / 2 + (WIDTH / 2) * p.x, HEIGHT / 2 + (HEIGHT / 2) * p.y])
    frames.append(frame)
ilda_file.close()

LD.set_color(YELLOW)

for frame in frames:
    for _ in range(2):
예제 #6
0
    gml = PyGML.GML(gmlFile)
    gmlFile.close()
    return gml

TOTAL_TIME=float(sys.argv[2])
TIME_STRETCH = 1
ZOOM=1.0
DELTA = 1

DEGRADATION = 0.40
#DEGRADATION is the percentage of points that we ignore in order to render
# faster in the laser display. Unfortunately we are not able to render too
# complex content in our display without resulting in a lot of blinking.

gml = readFile()
LD = LaserDisplay({"server":"localhost","port": 50000})
#LD = LaserDisplay()
LD.set_scan_rate(35000)
LD.set_blanking_delay(0)
LD.set_color(RED)

t0=datetime.now()
num_frame=0
while True:
  delta = datetime.now() - t0
  t = delta.seconds + delta.microseconds/1000000.0
  t = float(t)/TIME_STRETCH

  if t > TOTAL_TIME:
    t0=datetime.now()
예제 #7
0
#!/usr/bin/env python
from LaserDisplay import *

LD = LaserDisplay({"server":"localhost","port": 50000})
#LD = LaserDisplay()

import sys
filename = sys.argv[1]

from xml.sax import make_parser
from xml.sax.handler import ContentHandler 

class SVGHandler(ContentHandler):
  def startElement(self, name, attrs):
    if name=="path":
      tokens = attrs.get('d').split(" ")
      i=0
      x,y=0,0
      x0,y0=x,y
      
      while i<len(tokens):
        if tokens[i].lower() in ["m", "c", "l", "h", "v", "z"]:
          cmd = tokens[i]
          i+=1
        
        if cmd=="m":
          delta=tokens[i].split(",")
          x+=float(delta[0])
          y+=float(delta[1])
          x0,y0=x,y
          cmd="l"
예제 #8
0
#!/usr/bin/env python

DEVICE = 'alsa_output.pci-0000_00_1b.0.analog-stereo.monitor'

import pygst
pygst.require("0.10")
import gst
import struct
import numpy.fft
import LaserDisplay

pipeline = gst.parse_launch('pulsesrc device=%s ! audio/x-raw-int ! appsink name=sink' % DEVICE)
sink = pipeline.get_by_name('sink')
pipeline.set_state(gst.STATE_PLAYING)

LD = LaserDisplay.create()

def setcolor(v):
    if v < 60:
        LD.set_color(LD.GREEN)
    elif v < 120:
        LD.set_color(LD.YELLOW)
    else:
        LD.set_color(LD.RED)

while True:
    try:
        buf = sink.emit('pull-buffer')
    except:
        print 'err'
        break
예제 #9
0
#!/usr/bin/env python
from LaserDisplay import *
import math
import random

WIDTH = 100
HEIGHT = 100

#LD = LaserDisplay()
LD = LaserDisplay({"server":"localhost","port": 50000})

ship = [[190, 64], [168, 136], [118, 200], [77, 142], [63, 63], [87, 77], [105, 103], [119, 114], [143, 104], [158, 81], [192, 63]]

cx,cy = WIDTH/2, HEIGHT/2

angle=0
while True:
    angle+=0.01
    LD.save()
    LD.scale(0.2)
    LD.rotate_at(cx,cy,angle)
    LD.set_color(RED)
    LD.draw_bezier(ship, 10)
    LD.translate(10,0)
    LD.set_color(GREEN)
    LD.draw_bezier(ship, 10)
    LD.restore()
    
    
    LD.save()
    LD.scale(0.4)
예제 #10
0
for x in range(100):
    pygame.draw.line(grid, GRIDCOLOR, (x*SIZE[0]/100,SIZE[1]/2-3), (x*SIZE[0]/100,SIZE[1]/2+3))

for y in range(80):
    pygame.draw.line(grid, GRIDCOLOR, (SIZE[0]/2 - 3, y*SIZE[1]/80), (SIZE[0]/2 + 3, y*SIZE[1]/80))

surface = pygame.Surface(screen.get_size())

x_old=0
y_old=0

for _ in range(1000):
   frames = wro.readframes(READ_LENGTH)

display = LaserDisplay({"server":"localhost","port": 50000})
#display = LaserDisplay()
display.set_scan_rate(45000)
display.set_blanking_delay(0)
display.set_color(WHITE)

while True:
  try:
    clock.tick(FPS)
    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()

#    for _ in range(30):
#      frames = wro.readframes(READ_LENGTH)
    
    frames = wro.readframes(READ_LENGTH)
예제 #11
0
#!/usr/bin/env python
# display ILDA animations from a given file

from LaserDisplay import *
import ILDA

#LD = LaserDisplay()
LD = LaserDisplay({"server":"localhost","port": 50000})
LD.set_scan_rate(37000)
LD.set_blanking_delay(0)


WIDTH=200
HEIGHT=200
import sys
import random
ilda_file = open(sys.argv[1], 'rb')
ilda_frames = ILDA.readFrames(ilda_file)

frames = []
for f in ilda_frames:
  frame = []
  for p in f.iterPoints():
    frame.append([WIDTH/2 + (WIDTH/2)*p.x, HEIGHT/2 + (HEIGHT/2)*p.y])
  frames.append(frame)
ilda_file.close()

LD.set_color(YELLOW)

for frame in frames:
  for _ in range(2):