Exemplo n.º 1
0
def take_slide_to_home():
    shared_all.turn_arc(distance = 90 ,angle = 50 , speed_mm_s=100)
    shared_all.turn_arc(distance = 160 ,angle = -90 , speed_mm_s=100)
    shared_all.move_rack_to_floor()

    shared_all.drive_raising_crane(duration_ms=2200, robot_distance_mm=400, robot_turn_angle=15, 
        motor=rack_motor, crane_angle=-15)
Exemplo n.º 2
0
def putcube():
    shared_all.drive_raising_crane(duration_ms=1000,
                                   robot_distance_mm=30,
                                   robot_turn_angle=0,
                                   motor=crane_motor,
                                   crane_angle=-80)
    shared_all.move_straight(distance_mm=60, speed_mm_s=-90)
Exemplo n.º 3
0
def runtrial():
    shared_all.move_straight(distance_mm=70, speed_mm_s=50)
    shared_all.move_straight(distance_mm=70, speed_mm_s=-90)

    shared_all.turn_to_angle(gyro=gyro, target_angle=45)  # turn to face south

    shared_all.move_to_color(color_sensor=color_sensor_center,
                             stop_on_color=Color.RED,
                             speed_mm_s=100)

    shared_all.turn_to_angle(gyro=gyro, target_angle=-45)

    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=800,
                                              speed_mm_s=300,
                                              target_angle=-45)

    shared_all.turn_arc(distance=50, angle=-60,
                        speed_mm_s=100)  # turn in an arc

    shared_all.turn_to_angle(gyro=gyro, target_angle=150)  # turn to face south

    shared_all.move_crane_to_floor(crane_motor)

    shared_all.drive_raising_crane(duration_ms=1000,
                                   robot_distance_mm=400,
                                   robot_turn_angle=0,
                                   motor=crane_motor,
                                   crane_angle=60)

    shared_all.move_crane_to_top(crane_motor)

    shared_all.move_to_obstacle(obstacle_sensor=ultrasound,
                                stop_on_obstacle_at=80,
                                speed_mm_s=-100)
Exemplo n.º 4
0
def push_small_tire(adjust_for_mission=0):
    shared_all.move_rack_to_floor()
    shared_all.drive_raising_crane(duration_ms=1900,
                                   robot_distance_mm=30,
                                   robot_turn_angle=-35,
                                   motor=rack_motor,
                                   crane_angle=-5)
    shared_all.move_crane_to_top(rack_motor)
    shared_all.turn_to_direction(gyro=gyro, target_angle=-70)
    shared_all.turn_arc(distance=90, angle=-20, speed_mm_s=140)
Exemplo n.º 5
0
def level2crane():
    shared_all.move_rack_to_floor()
    shared_all.log_string('Moved racktotop')
    shared_all.move_crane_up(motor=rack_motor, degrees=40)
    shared_all.turn(angle=20)
    shared_all.drive_raising_crane(duration_ms=500,
                                   robot_distance_mm=20,
                                   robot_turn_angle=0,
                                   motor=rack_motor,
                                   crane_angle=190)
    shared_all.move_straight(distance_mm=40, speed_mm_s=-90)
    shared_all.move_crane_down(motor=rack_motor, degrees=90)
    shared_all.log_string('MOtor is ' + str(crane_motor))
Exemplo n.º 6
0
def level1crane():
    shared_all.move_crane_to_floor(motor=crane_motor)
    shared_all.move_crane_up(motor=crane_motor, degrees=35)
    shared_all.move_straight(distance_mm=60, speed_mm_s=90)
    shared_all.move_crane_down(motor=crane_motor, degrees=15)
    shared_all.move_straight(distance_mm=8, speed_mm_s=90)
    shared_all.drive_raising_crane(duration_ms=700,
                                   robot_distance_mm=-10,
                                   robot_turn_angle=0,
                                   motor=crane_motor,
                                   crane_angle=120)
    shared_all.move_crane_down(motor=crane_motor, degrees=30)
    shared_all.move_straight(distance_mm=30, speed_mm_s=-90)
Exemplo n.º 7
0
def rack_push_up():
    shared_all.move_rack_to_floor()
    shared_all.drive_raising_crane(duration_ms=1300,
                                   robot_distance_mm=-40,
                                   robot_turn_angle=8,
                                   motor=rack_motor,
                                   crane_angle=90)
    shared_all.drive_raising_crane(duration_ms=1300,
                                   robot_distance_mm=40,
                                   robot_turn_angle=8,
                                   motor=rack_motor,
                                   crane_angle=70)
    shared_all.move_rack_to_floor()
Exemplo n.º 8
0
def run():
    shared_all.move_crane_to_top(motor=crane_motor)
    while True:
        shared_all.drive_raising_crane(duration_ms=500,
                                       robot_distance_mm=60,
                                       robot_turn_angle=0,
                                       motor=crane_motor,
                                       crane_angle=-45)
        shared_all.drive_raising_crane(duration_ms=500,
                                       robot_distance_mm=-60,
                                       robot_turn_angle=0,
                                       motor=crane_motor,
                                       crane_angle=45)
Exemplo n.º 9
0
def run():
    shared_all.move_rack_to_floor()
    # shared_all.move_crane_up( motor = rack_motor, degrees = 30)
    shared_all.move_straight(distance_mm=55, speed_mm_s=100)

    while shared_all.did_motor_stall(motor =rack_motor , max_degrees =30 , speed = 80):
        shared_all.log_string('Stalled')
        shared_all.move_straight(distance_mm=4, speed_mm_s=-20)

    shared_all.drive_raising_crane(duration_ms=400, robot_distance_mm=30, robot_turn_angle=0, 
        motor=rack_motor, crane_angle=75)

    shared_all.turn_arc(distance = 60 ,angle = -7 , speed_mm_s=100)
Exemplo n.º 10
0
def runold (): 
    shared_all.move_rack_to_floor ()
    shared_all.move_straight(distance_mm=60, speed_mm_s=120)
    
    while shared_all.did_motor_stall(motor =rack_motor , max_degrees =50 , speed = 320):
        # log_string('stalled - step back')
        shared_all.move_reverse(max_distance=6, speed_mm_s=20)

    shared_all.move_crane_to_angle(motor=rack_motor, target_angle=90)
    shared_all.drive_raising_crane (duration_ms=900, robot_distance_mm=80, robot_turn_angle=0, 
                        motor=rack_motor, crane_angle=-20)
    shared_all.move_crane_to_angle(motor=rack_motor, target_angle=120)
    shared_all.move_reverse(max_distance=20, speed_mm_s=100)
Exemplo n.º 11
0
def run(adjust_for_mission=0):
#     shared_all.turn_to_direction( gyro=gyro, target_angle=10)
    shared_all.move_rack_to_floor()
    shake()

    #pull bsck
    shared_all.drive_raising_crane(duration_ms=1900, robot_distance_mm=-120, robot_turn_angle=-10, 
            motor=rack_motor, crane_angle=-40)
    #release
    shared_all.drive_raising_crane(duration_ms=1900, robot_distance_mm=5, robot_turn_angle=0, 
            motor=rack_motor, crane_angle=15)
    shared_all.move_crane_up(rack_motor, 180)
    shared_all.move_rack_to_top()
Exemplo n.º 12
0
def run():
    shared_all.move_crane_down(rack_motor, 70)
    shared_all.move_hook_to_floor()
    shared_all.move_straight(distance_mm=20, speed_mm_s=-50)

    shared_all.drive_raising_crane (duration_ms=800, robot_distance_mm=-20, robot_turn_angle=0, 
                        motor=rack_motor, crane_angle=20)
    shared_all.drive_raising_crane (duration_ms=1900, robot_distance_mm=-70, robot_turn_angle=0, 
                        motor=rack_motor, crane_angle=30)
    shared_all.move_straight(distance_mm=40, speed_mm_s=-130)
    shared_all.move_crane_up(rack_motor, 30)

    #backup
    shared_all.move_straight(distance_mm=600, speed_mm_s=-200)
Exemplo n.º 13
0
def run():
    ##lift 
    shared_all.move_crane_down(crane_motor, 10)
    shared_all.drive_raising_crane(duration_ms=600, robot_distance_mm=0, robot_turn_angle=0, 
        motor=crane_motor, crane_angle=110)
    shared_all.move_crane_down(crane_motor, 80)

    #knock
    shared_all.move_straight(distance_mm=18, speed_mm_s=-90)
    shared_all.move_crane_to_floor(crane_motor)
    shared_all.drive_raising_crane(duration_ms=400, robot_distance_mm=10, robot_turn_angle=-30, 
        motor=crane_motor, crane_angle=-20)

    #backup
    shared_all.start_moving_crane_to_angle(crane_motor, 70)
    shared_all.turn_to_direction(gyro=gyro, target_angle=-85)
    shared_all.move_straight(distance_mm=60, speed_mm_s=-120)
Exemplo n.º 14
0
def runfacing():
    shared_all.move_crane_down(rack_motor, 70)
    shared_all.move_hook_to_floor()
    shared_all.move_straight(distance_mm=20, speed_mm_s=-50)

    shared_all.drive_raising_crane (duration_ms=800, robot_distance_mm=-30, robot_turn_angle=0, 
                        motor=rack_motor, crane_angle=20)
    shared_all.drive_raising_crane (duration_ms=1900, robot_distance_mm=-90, robot_turn_angle=0, 
                        motor=rack_motor, crane_angle=20)
    # shared_all.move_straight(distance_mm=40, speed_mm_s=130)
    shared_all.move_crane_up(rack_motor, 70)
    shared_all.move_straight(distance_mm=500, speed_mm_s=-200)
    shared_all.move_rack_to_top()

   
# shared_all.calibrate_gyro(new_gyro_angle=-45)
# alignfacing()
# runfacing()
Exemplo n.º 15
0
def level1():
    shared_all.move_crane_to_top(motor=crane_motor)
    shared_all.move_rack_to_floor()
    shared_all.turn(angle=-10, speed_deg_s=90)
    shared_all.move_straight(distance_mm=90, speed_mm_s=90)
    shared_all.turn(angle=20, speed_deg_s=90)

    # rack_motor.stop(Stop.BRAKE)

    # cntr=0
    # while cntr < 4 and shared_all.did_motor_stall(motor =rack_motor , max_degrees =80 , speed = 320):
    #    shared_all.log_string('Mtr stalled')
    #    shared_all.move_crane_down(rack_motor, 5)
    #    shared_all.log_string('mved crane down')
    #    shared_all.move_rack_to_floor()
    #    shared_all.move_straight(distance_mm=6, speed_mm_s=20)
    #    cntr +=1

    # shared_all.move_rack_to_floor()
    # shared_all.move_crane_down(rack_motor, 5)
    # rack_motor.run_time(720, 900)

    shared_all.drive_raising_crane(duration_ms=1300,
                                   robot_distance_mm=-40,
                                   robot_turn_angle=0,
                                   motor=rack_motor,
                                   crane_angle=80)
    shared_all.drive_raising_crane(duration_ms=1300,
                                   robot_distance_mm=0,
                                   robot_turn_angle=0,
                                   motor=rack_motor,
                                   crane_angle=50)

    shared_all.drive_raising_crane(duration_ms=900,
                                   robot_distance_mm=20,
                                   robot_turn_angle=0,
                                   motor=rack_motor,
                                   crane_angle=15)

    # back up while lowering slightly
    shared_all.drive_raising_crane(duration_ms=800,
                                   robot_distance_mm=-70,
                                   robot_turn_angle=0,
                                   motor=rack_motor,
                                   crane_angle=-20)

    shared_all.move_rack_to_floor()
    shared_all.move_straight(distance_mm=60, speed_mm_s=-90)
    shared_all.move_rack_to_top()
Exemplo n.º 16
0
def runold(adjust_for_mission=0):
    shared_all.turn_to_direction( gyro=gyro, target_angle=-37+ adjust_for_mission)
    shared_all.move_rack_to_floor()
    shake()
    shared_all.drive_raising_crane(duration_ms=1900, robot_distance_mm=-80, robot_turn_angle=-20, 
            motor=rack_motor, crane_angle=-5)
    shared_all.drive_raising_crane(duration_ms=1900, robot_distance_mm=25, robot_turn_angle=-50, 
            motor=rack_motor, crane_angle=-5)
    shared_all.turn(8)        
    shared_all.drive_raising_crane(duration_ms=1900, robot_distance_mm=-10, robot_turn_angle=0, 
            motor=rack_motor, crane_angle=110)
Exemplo n.º 17
0
def runfacingnorth():
    shared_all.move_rack_to_floor()
    shake()
    shared_all.drive_raising_crane(duration_ms=1900, robot_distance_mm=10, robot_turn_angle=-70, 
            motor=rack_motor, crane_angle=-15)
Exemplo n.º 18
0
def runold2 ():
    shared_all.move_straight(distance_mm=550, speed_mm_s=160)
    shared_all.move_crane_to_floor(motor=rack_motor)
    shared_all.drive_raising_crane(duration_ms=50, robot_distance_mm=-37, robot_turn_angle=0, 
                        motor=rack_motor, crane_angle=80)
    shared_all.move_straight (distance_mm=550, speed_mm_s=-160)