Example #1
0
def swap_left_mid():
    robot.drive_right()
    robot.lift_up()
    robot.gripper_to_open()
    robot.lift_down()
    robot.gripper_to_closed()
    move()
Example #2
0
def make_tower():
    count = 0
    while robot.sense_color() != "":
        count = count + 1
        robot.drive_right()
        robot.drive_right()
    boxes = count

    while boxes > 0:
        robot.drive_left()
        robot.drive_left()
        boxes = boxes - 1

    robot.lift_up()
    robot.gripper_to_open()
    robot.drive_right()
    robot.lift_down()
    robot.gripper_to_closed()

    while boxes < (count - 1):
        boxes = boxes + 1
        robot.lift_up()
        robot.drive_right()
        robot.drive_right()
        robot.gripper_to_open()
        robot.lift_down()
        if boxes != count - 1:
            robot.gripper_to_closed()
Example #3
0
def pickup_next():
    '''Release the box in gripper (if any) and pick up the one below.
    Assumption: robot is in front of a box/stack; lift is at level 1.'''
    robot.gripper_to_open()
    robot.lift_down()
    robot.gripper_to_closed()
    robot.lift_up()
Example #4
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()
Example #5
0
def unstack_tower_of_three():
    # Move to the right-most stack
    right_two_spaces()
    right_two_spaces()
    # and do the unstacking manouvre twice
    unstack_to_the_left()
    robot.lift_up()
    robot.gripper_to_open()
    robot.lift_down()
    unstack_to_the_left()
Example #6
0
def swap_middle_and_right():
    robot.lift_up()
    move_2steps_right()
    open_down_and_close_up()
    move_2steps_left()
    robot.lift_down()
    robot.gripper_to_open()
    robot.lift_up()
    robot.gripper_to_closed()
    move_2steps_right()
    robot.lift_down()
Example #7
0
def pickup_and_replace():
    robot.lift_up()
    open_down_and_close_up()
    move_2steps_right()
    open_down_and_close_up()
    move_2steps_left()
    robot.lift_down()
    robot.gripper_to_open()
    robot.lift_up()
    robot.gripper_to_closed()
    move_2steps_right()
    robot.lift_down()
Example #8
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()
Example #9
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()
Example #10
0
def swap_left_and_middle():
    robot.drive_right()
    robot.lift_up()
    robot.gripper_to_open()
    robot.lift_down()
    robot.gripper_to_closed()
    # red box is in gripper!
    robot.lift_up()
    robot.drive_right()
    robot.drive_right()
    robot.gripper_to_open()
    # red box is on the top of green box!
    robot.lift_down()
    robot.gripper_to_closed()
    #green box is in gripper!
    robot.drive_left()
    robot.drive_left()
    #greem box is on the right!
    robot.gripper_to_open()
    robot.lift_up()
    robot.gripper_to_closed()
    robot.drive_right()
    robot.drive_right()
Example #11
0
def grasp_blocks_above():
    #the order was wrong
    #it should lift up first and then open the gripper
    robot.lift_up()
    robot.gripper_to_open()
    robot.gripper_to_closed()
Example #12
0
def put_down_blocks():
    # Move the lift down, and release the blocks.
    robot.lift_down()
    robot.gripper_to_open()
Example #13
0
def grasp_blocks_above():
    robot.gripper_to_open()
    robot.lift_up()
    robot.gripper_to_closed()
Example #14
0
import robot

robot.init()
robot.drive_right()
robot.lift_up()
robot.gripper_to_open()
robot.lift_down()

help(robot)
Example #15
0
def grasp_blocks_above():
    # i deleted the following line since i read through the error message.
    #gripper_to_open is the reason why the collision happened
    robot.gripper_to_open()
    robot.lift_up()
    robot.gripper_to_closed()
Example #16
0
def open_down_and_close_up():
    robot.gripper_to_open()
    robot.lift_down()
    robot.gripper_to_closed()
    robot.lift_up()