Exemplo n.º 1
0
def grab():
    global is_grabbed

    motors.setDirection("CLAMP",clockwise=False)
    motors.setSpeed("CLAMP",25)

    time.sleep(claw_clamp_time)

    motors.setSpeed("CLAMP",claw_clamp_off_power)
    is_grabbed = True
Exemplo n.º 2
0
def turnUpsideDown():
    global is_right_way_up

    motors.setDirection("ROTATE",clockwise=True)
    motors.setSpeed("ROTATE",25)

    while not buttons.buttonPressed("UPSIDE_DOWN"):
        time.sleep(0.05)

    motors.setSpeed("ROTATE",0)
    is_right_way_up = False
Exemplo n.º 3
0
def turnRightWayUp():
    global is_right_way_up

    motors.setDirection("ROTATE",clockwise=False)
    motors.setSpeed("ROTATE",25)

    while not buttons.buttonPressed("RIGHT_WAY_UP"):
        time.sleep(0.05)

    motors.setSpeed("ROTATE",0)
    is_right_way_up = True
Exemplo n.º 4
0
def release():
    global is_grabbed

    motors.setDirection("CLAMP",clockwise=True)
    motors.setSpeed("CLAMP",25)

    while not buttons.buttonPressed("CLAW_OPEN"):
        time.sleep(0.05)

    motors.setSpeed("CLAMP",0)
    is_grabbed = False
Exemplo n.º 5
0
def lift():
    global is_up

    if is_up:
        return
    
    motors.setDirection("LIFT",clockwise=True)
    motors.setSpeed("LIFT",25)

    while not buttons.buttonPressed("LIFT_UP"):
        time.sleep(0.05)
    
    motors.setSpeed("LIFT",0)
    is_up = True
Exemplo n.º 6
0
def goDown():
    global is_up

    if not is_up:
        return
    
    motors.setDirection("LIFT",clockwise=False)
    motors.setSpeed("LIFT",25)

    while not buttons.buttonPressed("LIFT_DOWN"):
        time.sleep(0.05)
    
    motors.setSpeed("LIFT",0)
    is_up = False
Exemplo n.º 7
0
def updateMotors():
    motors.setSpeed("LEFT", speed_val[0])
    motors.setSpeed("RIGHT", speed_val[1])
Exemplo n.º 8
0
debug_mode = "motors"
update_vars = False

if debug_mode == "motors":
    import bus
    import motors

    robot_buttons = [
        ["Enable A", lambda: motors.enableMotor("A")],
        ["Enable B", lambda: motors.enableMotor("B")],
        ["Disable A", lambda: motors.disableMotor("A")],
        ["Disable B", lambda: motors.disableMotor("B")],
    ]

    robot_sliders = [
        ["Set A", lambda x: motors.setSpeed("A", x), -100, 100],
        ["Set B", lambda x: motors.setSpeed("B", x), -100, 100],
    ]

    variable_functions = {
        "MB": lambda: vars(motors.boards[0]),
        "R0": lambda: bin(bus.bus.read_byte_data(0x43, 0)),
        "R1": lambda: bus.bus.read_byte_data(0x43, 1),
        "t": lambda: time.time(),
    }

elif debug_mode == "revolver":
    import bus
    import motors

    robot_buttons = [