Beispiel #1
0
def swap_left_and_middle():
    robot.drive_right()
    robot.lift_up()
    robot.gripper_to_open()
    robot.lift_down()
    robot.gripper_to_closed()
    robot.lift_up()
    robot.drive_right()
    robot.drive_right()
    robot.gripper_to_open()
    robot.lift_down()
    robot.gripper_to_closed()
    robot.drive_left()
    robot.drive_left()
    robot.gripper_to_open()
    robot.lift_up()
    robot.gripper_to_closed()
    robot.drive_right()
    robot.drive_right()
    robot.lift_down()
    robot.gripper_to_open()
    robot.lift_up()
    robot.gripper_to_folded()
    robot.drive_left()
    robot.drive_left()
    robot.drive_left()
    robot.lift_down()
Beispiel #2
0
def swap_middle_and_left():
    robot.lift_up()
    robot.drive_left()
    robot.drive_left()
    robot.drive_left()
    robot.drive_left()
    robot.lift_down()
    robot.gripper_to_closed()
    #green box is in the gripper!
    robot.lift_up()
    robot.drive_right()
    robot.drive_right()
    robot.gripper_to_open()
    robot.lift_down()
    robot.gripper_to_closed()
    #blue box is in the gripper!
    robot.drive_left()
    robot.drive_left()
    robot.gripper_to_open()
    robot.lift_up()
    robot.gripper_to_closed()
    robot.drive_right()
    robot.drive_right()
    robot.lift_down()
    robot.gripper_to_open()
    robot.lift_up()
    robot.gripper_to_folded()
Beispiel #3
0
def put_down_blocks():
    # Move the lift down, and release the blocks.
    robot.lift_down()
    robot.gripper_to_open()
    # Because there is now a block to the right (the one that we
    # unstacked from), we must do the up-fold-down manoeuvre.
    robot.lift_up()
    robot.gripper_to_folded()
    robot.lift_down()
Beispiel #4
0
def unstack_tower_of_two():
    # Move to the middle
    right_two_spaces()
    # and do the unstacking manoeuvre
    unstack_to_the_left()
    # -------------Here to do the up-fold-down to initialize the gripper!
    robot.lift_up()
    robot.gripper_to_folded()
    robot.lift_down()
Beispiel #5
0
def unstack_tower_of_three():
    # Move to the right-most stack
    right_two_spaces()
    right_two_spaces()
    # and do the unstacking manoeuvre twice
    unstack_to_the_left()
    unstack_to_the_left()
    robot.lift_up()
    robot.gripper_to_folded()
    robot.lift_down()
Beispiel #6
0
def make_tower(n):
    robot.init(width=2 * n - 1, boxes="flat")
    robot.drive_right()
    robot.lift_up()
    while n > 1:
        pickup_next()
        move_to_next_stack()
        n = n - 1
    robot.gripper_to_folded()
    robot.lift_down()
Beispiel #7
0
def make_tower(n):
    robot.init(width=2 * n - 1, boxes="flat")
    robot.drive_right()
    robot.lift_up()
    i = 0
    while i < n - 1:
        pickup_next()
        move_to_next_stack()
        i = i + 1
    robot.gripper_to_folded()
    robot.lift_down()
    return "Tower complete!"
Beispiel #8
0
    robot.gripper_to_closed()
    robot.lift_up()

# main program

robot.init(width = 9, boxes = "flat")

# position above first box
robot.drive_right()
robot.lift_up()

# pick up, move right
pickup_next()
move_to_next_stack()

# ...again
pickup_next()
move_to_next_stack()

# ...again
pickup_next()
move_to_next_stack()

# ...again
pickup_next()
move_to_next_stack()

# tower is done, park the robot
robot.gripper_to_folded()
robot.lift_down()