def calibrate_compass():
    head_controller.leds_change_color(head_controller.leds_color['yellow'])
    # print("point your bot in the forward position.")
    head_controller.head_move_to_center(0)
    time.sleep(.4)
    compass_positions['forward'] = DalekSensors.compass

    if compass_positions['left'] == -1:
        head_controller.head_move_left_90deg(0)
        time.sleep(1)
        compass_positions['left'] = DalekSensors.compass

    if compass_positions['right'] == -1:
        head_controller.head_move_right_90deg(0)
        time.sleep(1)
        compass_positions['right'] = DalekSensors.compass

    # forward, left and right done
    head_controller.head_move_to_center(0)
    time.sleep(.3)
    head_controller.leds_change_color(head_controller.leds_color['green'])
    print("left mag:{} center mag:{} right mag:{} backwards:{}" .format(
        compass_positions['left'],
        compass_positions['forward'],
        compass_positions['right'],
        compass_positions['backwards']))
示例#2
0
def get_missing_compass_positions():

    head_controller.head_move_to_center(0)
    time.sleep(.4)
    if compass_positions['forward'] == -1:
        compass_positions['forward'] = DalekSensors.compass

    if compass_positions['right'] == -1:

        head_controller.head_move_right_90deg(0)
        time.sleep(.8)
        compass_positions['right'] = DalekSensors.compass

    if compass_positions['left'] == -1:

        head_controller.head_move_left_90deg(0)
        time.sleep(.8)
        compass_positions['left'] = DalekSensors.compass

    time.sleep(.2)
    head_controller.head_move_to_center(0)
示例#3
0
 def button_L1_pressed():
     head_controller.head_move_left_90deg()
     print("l1 Pressed")
示例#4
0
 def button_L1_pressed():
     if current_challenge_thread.running == True:
         current_challenge_thread.button_L1_pressed()
     else:
         head_controller.head_move_left_90deg()
示例#5
0
 def dpad_left_button_pressed():
     # drive.spinLeft(speed)
     head_controller.head_move_left_90deg()