Exemplo n.º 1
0
def show_bike_1():
    time.sleep(17.0)
    color = Color_Bike  #(0, 0, 255)
    location = ObjectLocation(5, 25)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location', ObjectLocation(90, 3),
                                       8.0)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(8.0)
    get_led_controller().add_animation(spot, 'location',
                                       ObjectLocation(135, 10), 3.0)
    time.sleep(3.0)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(90, 2), 3.333)
    time.sleep(3.333)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(0, 10), 4.0)
    time.sleep(4.0 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 2
0
def show_ped_2():
    time.sleep(35.5)
    color = Color_People  #(237, 183, 21)
    location = ObjectLocation(80, 10)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(30, 5), 2.0)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(2.0)
    get_led_controller().add_animation(spot, 'location', ObjectLocation(90, 2),
                                       1.333)
    time.sleep(1.333)
    get_led_controller().add_animation(spot, 'location',
                                       ObjectLocation(170, 20), 9.666)
    time.sleep(9.666 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 3
0
 def create(self):
     color = (200, 200, 200)
     location = ObjectLocation(START_ANGLE, 1.414213562)
     led_drop = LEDContinuousDrop(color, location, 0.75, period=0.1, decrease=0.02, end_after=1)
     self.symbols.append(led_drop)
     time.sleep(0.1)
     color = (255, 255, 255)
     self.spot = LEDSpot(color, location, 1.0/60 * 20)
     self.symbols.append(self.spot)
Exemplo n.º 4
0
def working_light():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (237, 183, 21)
    location = ObjectLocation(-45, 90)
    led_spot = LEDSpot(color, location, 120)

    pixels = world.draw([led_spot], datetime.now())
    client.put_pixels(pixels)
    client.put_pixels(pixels)
Exemplo n.º 5
0
def show_ped_1():
    color = Color_People  #(237, 183, 21)
    location = ObjectLocation(15, 20)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-45, 10.0), 10.166)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(10.166 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 6
0
def show_ped_2():
    time.sleep(1.5)
    color = Color_People  #(237, 183, 21)
    location = ObjectLocation(-10, 3.0)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 0.75)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location',
                                       ObjectLocation(180, 2.0), 9.0)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(9.0 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 7
0
def show_car_1():
    time.sleep(40.666)
    color = Color_Car  #(255, 255, 255)
    location = ObjectLocation(-45, 3)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location',
                                       ObjectLocation(0, 3.0), 3.333)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(3.333 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 8
0
def show_ped_2():
    time.sleep(8.433)
    color = Color_People  #(237, 183, 21)
    location = ObjectLocation(45, 10)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2.0)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-90, 5.0), 4.5)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(4.5 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 9
0
def toggle_working_light_back_right(activate):
    global working_light_led_back_right
    if activate:
        if working_light_led_back_right is None:
            color = (237, 183, 21)
            location = ObjectLocation(135, 90)
            working_light_led_back_right = LEDSpot(color, location, 120)
            print "show working light br"
            get_led_controller().add_symbol(working_light_led_back_right)
    else:
        if working_light_led_back_right is not None:
            get_led_controller().remove_symbol(working_light_led_back_right)
            working_light_led_back_right = None
Exemplo n.º 10
0
def show_animated_spot():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (237, 183, 21)
    location = ObjectLocation(0, 1.5)
    led_spot = LEDSpot(color, location, 1.0 / 60 * 30, 0.25, 0.3)

    symbols = [led_spot]
    while symbols:
        now = datetime.now()
        pixels = world.draw(symbols, now)
        client.put_pixels(pixels)
        symbols = [s for s in symbols if not s.dead]
        time.sleep(0.02)
Exemplo n.º 11
0
def play_start_sequence():
    color = (255, 226, 64)
    location_1 = ObjectLocation(-179, 15)
    spot_1 = LEDSpot((0, 0, 0,), location_1, 2)
    location_2 = ObjectLocation(179, 15)
    spot_2 = LEDSpot((0, 0, 0,), location_2, 2)
    final_radius = 75
    get_led_controller().add_symbol(spot_1)
    get_led_controller().add_symbol(spot_2)
    get_led_controller().add_animation(spot_1, 'color', color, 0.5)
    get_led_controller().add_animation(spot_2, 'color', color, 0.5)
    get_led_controller().add_animation(spot_1, 'location', ObjectLocation(-45, 15), 2.5)
    get_led_controller().add_animation(spot_2, 'location_r', ObjectLocation(45, 15), 2.5)
    time.sleep(0.5)
    get_led_controller().add_animation(spot_1, 'radius', final_radius, 2.0)
    get_led_controller().add_animation(spot_2, 'radius', final_radius, 2.0)
    time.sleep(2.0)
    get_led_controller().add_animation(spot_1, 'color', (0, 0, 0,), 0.5)
    get_led_controller().add_animation(spot_2, 'color', (0, 0, 0,), 0.5)
    time.sleep(0.5)
    spot_1.dead = True
    spot_2.dead = True
Exemplo n.º 12
0
def show_continuous_drop():
    world = LEDWorldBuilder().add_octa_circle().build()
    location = ObjectLocation(0, 0.5)
    color = (255, 255, 255)  #(52, 141, 151)
    led_drop = LEDContinuousDrop(color, location, 1.0)
    symbols = [led_drop]
    while symbols:
        now = datetime.now()
        pixels = world.draw(symbols, now)
        client.put_pixels(pixels)
        client.put_pixels(pixels)
        symbols = [s for s in symbols if not s.dead]
        time.sleep(0.02)
Exemplo n.º 13
0
def show_ped_1():
    time.sleep(1.0)
    color = Color_People  #(237, 183, 21)
    location = ObjectLocation(-30, 15)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-90, 5), 5.0)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(5.0)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-190, 15), 5.0)
    time.sleep(5.0 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 14
0
def show_bike_1():
    time.sleep(33.0)
    color = Color_Bike  #(255, 0, 0)
    location = ObjectLocation(-30, 15)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-90, 2.0), 4.666)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(4.666)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-160, 10), 1.333 - 0.5)
    time.sleep(1.333 - 0.5 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 15
0
def show_ped_2():
    time.sleep(26.0)
    color = Color_People  #(237, 183, 21)
    location = ObjectLocation(-45, 8.0)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2.25)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location',
                                       ObjectLocation(90, 2.0), 5.5)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(5.5)
    get_led_controller().add_animation(spot, 'location',
                                       ObjectLocation(160, 8), 2.0)
    time.sleep(2.0 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 16
0
def show_car_1():
    time.sleep(15.0)
    color = Color_Car  #(255, 0, 0)
    location = ObjectLocation(-30, 25)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-90, 3), 2.0)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(2.0)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-150, 25), 2.0)
    time.sleep(2.0 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 17
0
def show_ped_1():
    time.sleep(5.0)
    color = Color_People  #(237, 183, 21)
    location = ObjectLocation(355, 25)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2.25)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location',
                                       ObjectLocation(90, 2.0), 11.666)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(11.666)
    get_led_controller().add_animation(spot, 'location',
                                       ObjectLocation(160, 5.0), 2.333)
    time.sleep(2.333 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 18
0
def show_bike_2():
    time.sleep(35.5)
    color = Color_Bike  #(0, 0, 255)
    location = ObjectLocation(45, 10)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-90, 2), 2.333)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(2.333)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-170, 25), 10.666)
    time.sleep(10.666 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 19
0
def show_car_1():
    time.sleep(34.166)
    color = Color_Car  #(255, 0, 0)
    location = ObjectLocation(10, 10)
    spot = LEDSpot((
        0,
        0,
        0,
    ), location, 2.0)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-90, 2.0), 6.166)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(6.166)
    get_led_controller().add_animation(spot, 'location_r',
                                       ObjectLocation(-160, 10.0), 2.333)
    time.sleep(2.333 - 0.5)
    get_led_controller().add_animation(spot, 'color', (
        0,
        0,
        0,
    ), 0.5)
    time.sleep(0.5)
    spot.dead = True
Exemplo n.º 20
0
def show_spot_round():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (255, 255, 255)
    location = ObjectLocation(0, 1.414213562)
    led_spot = LEDSpot(color, location, 1.0 / 60 * 20)

    pixels = world.draw([led_spot], datetime.now())
    client.put_pixels(pixels)
    client.put_pixels(pixels)

    angle_inc = 1
    while True:
        led_spot.location.angle += angle_inc
        if led_spot.location.angle > 360:
            led_spot.location.angle
        pixels = world.draw([led_spot], datetime.now())
        client.put_pixels(pixels)
        time.sleep(0.01)
Exemplo n.º 21
0
def show_spot():
    world = LEDWorldBuilder().add_octa_circle().build()
    color = (255, 0, 0)
    location = ObjectLocation(0, 1.414213562)
    led_spot = LEDSpot(color, location, 1.0 / 60 * 20)

    pixels = world.draw([led_spot], 0)
    client.put_pixels(pixels)
    client.put_pixels(pixels)

    angle_inc = 1
    while True:
        led_spot.location.angle += angle_inc
        if led_spot.location.angle > 45 or led_spot.location.angle < (-45 -
                                                                      45):
            angle_inc *= -1
        pixels = world.draw([led_spot], 0)
        client.put_pixels(pixels)
        time.sleep(0.02)
Exemplo n.º 22
0
 def create(self):
     color = Color_Car  #(128, 255, 128)
     location = ObjectLocation(START_ANGLE, 1.414213562)
     self.spot = LEDSpot(color, location, 1.0/60 * 20 * 2)
     self.symbols.append(self.spot)
Exemplo n.º 23
0
    def run(self):
        NUMBER_OF_VALUES = 99
        NUMBER_OF_MINIMUM_VALUES_PER_AREA = 10

        lidar = lidarModule.Lidar()

        # values = []
        spots = []
        for i in range(NUMBER_OF_VALUES):
            # values.append([])
            spots.append({
                'active':
                False,
                'spot':
                LEDSpot(Color_Bike, ObjectLocation(i * 1.8 - 10.0, 2), 0.3)
            })

        # stepNumber, distance = lidar.getData()
        # while stepNumber <> 0:
        # stepNumber, distance = lidar.getData()

        # print '### Step is at 0 now ###'

        minStepDist = [
            290, 290, 290, 290, 290, 290, 290, 290, 291, 291, 292, 294, 295,
            297, 300, 271, 241, 217, 197, 180, 166, 154, 144, 135, 128, 121,
            115, 109, 104, 100, 96, 92, 89, 86, 83, 81, 79, 77, 75, 73, 71, 70,
            69, 67, 66, 65, 64, 64, 63, 62, 62, 61, 61, 61, 60, 60, 60, 60, 60,
            60, 60, 61, 61, 61, 62, 62, 63, 64, 64, 65, 66, 67, 69, 70, 71, 73,
            75, 77, 79, 81, 83, 86, 89, 92, 96, 100, 104, 109, 115, 121, 128,
            135, 144, 154, 166, 180, 224, 224, 224
        ]
        maxStepDist = [
            450, 450, 470, 500, 600, 600, 610, 620, 610, 610, 600, 590, 590,
            570, 560, 560, 560, 560, 560, 560, 560, 560, 550, 540, 540, 540,
            540, 540, 550, 550, 570, 560, 560, 560, 550, 550, 550, 540, 550,
            540, 550, 560, 540, 530, 530, 530, 520, 500, 490, 500, 510, 500,
            490, 490, 500, 500, 500, 500, 490, 480, 480, 480, 470, 470, 460,
            460, 430, 420, 420, 400, 400, 400, 400, 390, 390, 390, 390, 390,
            390, 400, 410, 420, 430, 450, 440, 440, 440, 450, 460, 470, 510,
            520, 520, 530, 530, 530, 530, 530, 530
        ]

        lidar.resetDataCount()

        # values = pickle.load(open("/home/pi/me310-audi-enlight/lidar/scan6MinimumValues", "rb" ))

        # print '### MIN ###'
        # print map(np.min, values)
        # print '### MAX ###'
        # print map(np.max, values)
        # print '### STD ###'
        # print map(np.std, values)
        # print '###########'

        # stdValues = map(np.std, values)
        # minValues = map(np.min, values)

        while not self.stopped:
            stepNumber, distance = lidar.getData()
            if stepNumber == -1:
                continue

            if distance >= maxStepDist[stepNumber] or distance <= minStepDist[
                    stepNumber]:
                if (spots[stepNumber]['active']):
                    get_led_controller().remove_symbol(
                        spots[stepNumber]['spot'])
                    spots[stepNumber]['active'] = False
            else:

                if maxStepDist[stepNumber] - distance > 50:
                    if (not spots[stepNumber]['active']):
                        get_led_controller().add_symbol(
                            spots[stepNumber]['spot'])
                        spots[stepNumber]['active'] = True
                else:
                    if (spots[stepNumber]['active']):
                        get_led_controller().remove_symbol(
                            spots[stepNumber]['spot'])
                        spots[stepNumber]['active'] = False

        for spot in spots:
            get_led_controller().remove_symbol(spot['spot'])
Exemplo n.º 24
0
 def create(self):
     color = (255, 255, 255)
     location = ObjectLocation(START_ANGLE, 1.414213562)
     self.spot = LEDSpot(color, location, 1.0/60 * 20)
     self.symbols.append(self.spot)