コード例 #1
0
ファイル: alarm.py プロジェクト: rhlff/me310-audi-enlight
def show_alarm_1():
    time.sleep(40.5)
    color = Color_Danger # (255, 0, 0)
    led_puls = LEDAllPulsing(color, 0.1)
    get_led_controller().add_symbol(led_puls)
    time.sleep(2.0-0.25)
    get_led_controller().add_animation(led_puls, 'color', (0, 0, 0,), 0.25)
    time.sleep(0.5)
    led_puls.dead = True
コード例 #2
0
ファイル: emergency.py プロジェクト: rhlff/me310-audi-enlight
def toggle_emergency_light(activate):
    global emergency_light
    if activate:
        if emergency_light is None:
            color = (255, 0, 0)
            emergency_light = LEDAllPulsing(color, 0.1)
            print "show emergency"
            get_led_controller().add_symbol(emergency_light)
    else:
        if emergency_light is not None:
            get_led_controller().remove_symbol(emergency_light)
            emergency_light = None
コード例 #3
0
def show_alarm_1():
    time.sleep(40.5)
    color = Color_Danger  # (255, 0, 0)
    led_puls = LEDAllPulsing(color, 0.1)
    get_led_controller().add_symbol(led_puls)
    time.sleep(2.0 - 0.25)
    get_led_controller().add_animation(led_puls, 'color', (
        0,
        0,
        0,
    ), 0.25)
    time.sleep(0.5)
    led_puls.dead = True
コード例 #4
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
コード例 #5
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
コード例 #6
0
ファイル: parking.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #7
0
ファイル: bike.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #8
0
ファイル: bike.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #9
0
ファイル: bike.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #10
0
ファイル: alarm.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #11
0
ファイル: alarm.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #12
0
ファイル: alarm.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #13
0
ファイル: object.py プロジェクト: rhlff/me310-audi-enlight
    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'])
コード例 #14
0
def show_ped_1():
    color = Color_People #(237, 183, 21)
    location = ObjectLocation(155, 2)
    spot = LEDSpot((0, 0, 0,), location, 0.75)
    get_led_controller().add_symbol(spot)
    get_led_controller().add_animation(spot, 'location_r', ObjectLocation(0, 2.0), 8.0)
    get_led_controller().add_animation(spot, 'color', color, 0.5)
    time.sleep(8.0-0.5)
    get_led_controller().add_animation(spot, 'color', (0, 0, 0,), 0.5)
    time.sleep(0.5)
    spot.dead = True
コード例 #15
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
コード例 #16
0
ファイル: parking.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #17
0
ファイル: alarm.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #18
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
コード例 #19
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
コード例 #20
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
コード例 #21
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
コード例 #22
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
コード例 #23
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
コード例 #24
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
コード例 #25
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
コード例 #26
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
コード例 #27
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
コード例 #28
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
コード例 #29
0
def receive_beat():
    energy = float(request.form['energy'])
    brightness = 0.5
    if beat_detection.activated:
        if energy > 2.0:
            color = map(lambda x: brightness*x, (237, 183, 21))
            distance = 1.5
            size = 1.0/60 * 30
            appear = 0.25
            disappear = 0.25
            angles = [0, 180]
            for angle in angles:
                location = ObjectLocation(angle, distance)
                led_spot = LEDSpot(color, location, size, appear, disappear)
                get_led_controller().add_symbol(led_spot)
        elif energy > 1.0:
            color = map(lambda x: brightness*x, (191, 115, 77))
            distance = 1.0
            size = 1.0/60 * 15
            appear = 0.25
            disappear = 0.25
            angles = [-35, 35, 145, -145]
            for angle in angles:
                location = ObjectLocation(angle, distance)
                led_spot = LEDSpot(color, location, size, appear, disappear)
                get_led_controller().add_symbol(led_spot)
        elif energy > 0.35:
            color = map(lambda x: brightness*x, (214, 149, 49))
            distance = 1.0
            size = 1.0/60 * 7.5
            appear = 0.25
            disappear = 0.25
            angles = [-70, 70, 110, -110]
            for angle in angles:
                location = ObjectLocation(angle, distance)
                led_spot = LEDSpot(color, location, size, appear, disappear)
                get_led_controller().add_symbol(led_spot)
    return ('', 204)
コード例 #30
0
ファイル: bike.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #31
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
コード例 #32
0
ファイル: bike.py プロジェクト: rhlff/me310-audi-enlight
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
コード例 #33
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'])
コード例 #34
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