示例#1
0
def push_red_blocks_and_return():
    """
    Completes M-12 Design & Build, and M-13 Sustainability Upgrades.
    """

    # Establishes the compass point the root is facing

    Robot.gyro.compass_point = 75

    # Drops off the blocks

    My_block.gyro_straight(50, 3.9)
    # Robot.tank_pair.on_for_rotations(50, 50, 3.9)

    My_block.gyro_straight(50, -1)
    #Robot.tank_pair.on_for_rotations(50, 50, -1)

    My_block.spin_turn(0)

    My_block.gyro_straight(50, 0.7)
    #Robot.tank_pair.on_for_rotations(50, 50, .7)

    My_block.spin_turn(58)

    My_block.gyro_straight(20, 1.29)
    #Robot.tank_pair.on_for_rotations(20, 20, 1.295)

    # Returns home
    My_block.gyro_straight(25, -1.5)
    #Robot.tank_pair.on_for_rotations(25, 25, -1.5)
    My_block.spin_turn(80)

    My_block.wall_square(90)
示例#2
0
def drone_plus():
    """
    Completes M-03 Inspection Drone, plus the Innovative Architecture and Bat missions
    """

    # Establishes the compass point the robot is facing
    Robot.gyro.compass_point = 0

    # Moves the robot forward, turns, and pushes architecture to circle
    My_block.gyro_straight(35, 1)
    My_block.spin_turn(44)
    My_block.gyro_straight(35, 1.7)

    # backs up
    My_block.gyro_straight(35, -1.7)

    #turns to drone
    My_block.spin_turn(0)

    # Moves the robot forward and turns it to allign with the line

    My_block.gyro_straight(35, 1.38)

    My_block.spin_turn(44)

    My_block.gyro_straight(35, 2.2)

    # Picks up the drone

    My_block.gyro_straight(20, 0.58)

    Robot.right_attachment.on_for_rotations(-100, 4.9)

    # Drops off the drone on the post

    My_block.gyro_straight(10, 0.38)

    My_block.spin_turn(33)

    Robot.right_attachment.on_for_rotations(100, 2.3)

    # Returns home

    My_block.gyro_straight(-10, 0.8)

    My_block.wall_square(-100)

    Robot.right_attachment.on_for_seconds(40, 5)
示例#3
0
def crane_and_blocks():
    """
    Completes M-02 Crane, and M-12 Design and Build.
    """

    # Establishes the compass point the robot is facing

    Robot.gyro.compass_point = 0

    # Drops off the blocks in the circle

    My_block.gyro_straight(30, 2.2)

    My_block.gyro_straight(-70, 0.9)

    # Alligns with the crane

    My_block.spin_turn(90)

    My_block.gyro_straight(25, 0.9)

    My_block.spin_turn(0)

    # Completes the crane mission

    My_block.gyro_straight(25, 2.05)

    Robot.sleep(0.3)

    My_block.gyro_straight(-10, 0.3)

    # Returns home

    My_block.wall_square(-100)

    My_block.gyro_straight(25, 0.2)

    My_block.spin_turn(-40)

    Robot.steer_pair.on_for_rotations(0, 100, 4.25)
示例#4
0
def drone():
    """
    Completes M-03 Inspection Drone.
    """

    # Establishes the compass point the robot is facing

    Robot.gyro.compass_point = 0

    # Moves the robot forward and turns it to allign with the line

    My_block.gyro_straight(35, 2.48)

    My_block.spin_turn(44)

    My_block.gyro_straight(35, 2.2)

    # Picks up the drone

    My_block.gyro_straight(20, 0.58)

    Robot.right_attachment.on_for_rotations(-100, 4.9)

    # Drops off the drone on the post

    My_block.gyro_straight(10, 0.38)

    My_block.spin_turn(33)

    Robot.right_attachment.on_for_rotations(100, 2.3)

    # Returns home

    My_block.gyro_straight(-10, 0.8)

    My_block.wall_square(-100)

    Robot.right_attachment.on_for_seconds(40, 5)
示例#5
0
def swingset_mission():
    """
    Completes M-07 Swing, and M-08 Elevator.
    """

    Robot.right_attachment.on_for_seconds(50, 0.5)

    # Establishes the compass point the robot is facing

    Robot.gyro.compass_point = 90

    # Complete Swing and back away

    My_block.gyro_straight(40, 7.36)

    My_block.gyro_straight(30, -1)

    # Smush against wall

    My_block.spin_turn(0)
    My_block.wall_square(100)

    # Drive to elevator

    My_block.gyro_straight(35, 1.62)
    My_block.spin_turn(56)
    My_block.gyro_straight(35, 2.15)

    # qwhack elevator

    Robot.left_attachment.on_for_rotations(35, 1)
    sleep(0.5)
    Robot.tank_pair.on_for_rotations(55, 55, -1.05)
    Robot.left_attachment.on_for_rotations(-35, 0.95)

    # Do House Mission
    Robot.debug_print(Robot.gyro.compass_point)

    My_block.spin_turn(89)

    Robot.debug_print(Robot.gyro.compass_point)

    Robot.right_attachment.on_for_seconds(-50, 1.4)

    Robot.debug_print(Robot.gyro.compass_point)

    My_block.gyro_straight(30, 0.81)

    Robot.debug_print(Robot.gyro.compass_point)

    My_block.spin_turn(99)

    Robot.debug_print(Robot.gyro.compass_point)

    Robot.steer_pair.on_for_rotations(0, -20, 0.3)

    My_block.spin_turn(93)

    Robot.debug_print(Robot.gyro.compass_point)

    Robot.steer_pair.on_for_rotations(0, -20, 0.3)

    My_block.proportional_turn(86)

    # Go Home.

    My_block.gyro_straight(100, -6)
    My_block.wall_square(100)
    Robot.right_attachment.on_for_rotations(100, 2.2)
    sleep(0.4)
    My_block.proportional_turn(0)