Ejemplo n.º 1
0
def align():
    # shared_all.move_straight(distance_mm=940, speed_mm_s=300)
    shared_all.calibrate_gyro(new_gyro_angle=-45)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=1000,
                                              speed_mm_s=300,
                                              target_angle=-45)
Ejemplo n.º 2
0
def align_right_turns(adjust_for_mission=0):

    shared_all.move_to_color(
        color_sensor=color_sensor_center,
        stop_on_color=Color.BLACK,
        alternative_color=Color.BLACK,
        max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
        max_distance_mm=70)

    shared_all.move_straight(distance_mm=100, speed_mm_s=140)
    shared_all.move_crane_to_top(crane_motor)
    shared_all.turn_to_direction(gyro=gyro,
                                 target_angle=180 + adjust_for_mission)
    shared_all.move_straight(distance_mm=390, speed_mm_s=-200)

    shared_all.push_back_reset_gyro(distance_mm=60,
                                    reset_gyro=True,
                                    new_gyro_angle=180)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=15,
                                              speed_mm_s=110,
                                              target_angle=180 +
                                              adjust_for_mission)

    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=30,
                                              speed_mm_s=-110,
                                              target_angle=-90 +
                                              adjust_for_mission)
Ejemplo 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)
Ejemplo n.º 4
0
def alignatangle(adjust_for_mission=0):
    shared_all.move_straight_target_direction(gyro = gyro, 
        distance_mm= 170, 
        speed_mm_s= 130, 
        target_angle= -130+ adjust_for_mission)
    shared_all.turn(angle=110, speed_deg_s=190)
    shared_all.turn_to_direction( gyro=gyro, target_angle=10+ adjust_for_mission)
Ejemplo n.º 5
0
def innov_to_basket(adjust_for_mission=0):

    # shared_all.move_straight(distance_mm=10,  speed_mm_s=-90)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=180,
                                              speed_mm_s=130,
                                              target_angle=-55 +
                                              adjust_for_mission)
    shared_all.move_to_color(
        color_sensor=color_sensor_center,
        stop_on_color=Color.BLACK,
        alternative_color=Color.BLACK,
        max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
        max_distance_mm=80)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=50,
                                              speed_mm_s=130,
                                              target_angle=-55 +
                                              adjust_for_mission)
    shared_all.move_to_color(
        color_sensor=color_sensor_center,
        stop_on_color=Color.BLACK,
        alternative_color=Color.BLACK,
        max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
        max_distance_mm=80)
Ejemplo n.º 6
0
def treadmill_to_row_withalign(adjust_for_mission=0):

    shared_all.move_to_color_reverse(
        color_sensor=color_sensor_center,
        stop_on_color=Color.WHITE,
        alternative_color=Color.BLACK,
        speed_mm_s=30,
        max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
        max_distance_mm=50)
    shared_all.move_straight(distance_mm=120, speed_mm_s=100)
    shared_all.turn(angle=90, speed_deg_s=140)

    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=100,
                                              speed_mm_s=-160,
                                              target_angle=-90)
    shared_all.push_back_reset_gyro(distance_mm=40,
                                    reset_gyro=True,
                                    new_gyro_angle=-90)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=270,
                                              speed_mm_s=180,
                                              target_angle=-90)

    shared_all.turn(angle=90, speed_deg_s=120)
    shared_all.move_reverse(max_distance=40, speed_mm_s=100)
Ejemplo n.º 7
0
def pullup_to_dance():
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=150,
                                              speed_mm_s=180,
                                              target_angle=-90)
    shared_all.turn_arc(distance=150, angle=-60, speed_mm_s=130)
    shared_all.turn_arc(distance=150, angle=60, speed_mm_s=130)
Ejemplo n.º 8
0
def align_nearboccia(adjust_for_mission=0):

    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=40,
                                              speed_mm_s=120,
                                              target_angle=-90 +
                                              adjust_for_mission)

    shared_all.move_to_color(
        color_sensor=color_sensor_right,
        stop_on_color=Color.WHITE,
        alternative_color=Color.BLACK,
        speed_mm_s=30,
        min_intensity=robot_setup.WHITE_MIN_INTENSITY[color_sensor_right])

    shared_all.move_straight(distance_mm=7, speed_mm_s=-90)
    shared_all.turn_to_direction(gyro=gyro,
                                 target_angle=-137 + adjust_for_mission,
                                 speed_deg_s=80)

    if not shared_all.move_to_color_reverse(color_sensor=color_sensor_right,
                                            stop_on_color=Color.GREEN,
                                            alternative_color=Color.GREEN,
                                            speed_mm_s=30,
                                            max_distance_mm=50):
        shared_all.move_to_color(color_sensor=color_sensor_right,
                                 stop_on_color=Color.GREEN,
                                 alternative_color=Color.GREEN,
                                 speed_mm_s=30,
                                 max_distance_mm=55)
    shared_all.move_straight(distance_mm=10, speed_mm_s=-100)
Ejemplo n.º 9
0
def align(adjust_for_mission=0):

    SLIDE_ALIGN_DIRECTION=138
    shared_all.turn(-90, speed_deg_s=140)
    shared_all.move_straight(distance_mm=50, speed_mm_s=100)
    shared_all.move_to_color_reverse(color_sensor=color_sensor_center,
         stop_on_color=Color.BLACK, alternative_color=Color.BLACK, speed_mm_s=60,
         max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
         max_distance_mm=80)
    shared_all.move_straight(distance_mm=70, speed_mm_s=-100)

    shared_all.turn(90, speed_deg_s=140)
    shared_all.move_to_color(color_sensor=color_sensor_center,
        stop_on_color=Color.BLACK, alternative_color=Color.BLACK, speed_mm_s=60,
         max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
         max_distance_mm=60)
    shared_all.move_straight_target_direction(gyro = gyro, 
        distance_mm= 40, 
        speed_mm_s= 130, 
        target_angle= 180+ adjust_for_mission)
    shared_all.turn(SLIDE_ALIGN_DIRECTION - 180, speed_deg_s=100)
    shared_all.move_straight_target_direction(gyro = gyro, 
        distance_mm= 60, 
        speed_mm_s= -110, 
        target_angle= SLIDE_ALIGN_DIRECTION+ adjust_for_mission)
    shared_all.move_rack_to_floor()
Ejemplo n.º 10
0
def alignfacing():
    shared_all.move_straight_target_direction(gyro=gyro,
    distance_mm=480, speed_mm_s=170, target_angle=-45)

    shared_all.move_to_color(color_sensor=color_sensor_center, 
    stop_on_color=Color.GREEN, max_distance_mm=40)

    shared_all.move_straight(distance_mm=40, speed_mm_s=40)
Ejemplo n.º 11
0
def weight_to_phoneold(adjust_for_mission=0):
    shared_all.push_back_reset_gyro(distance_mm=70,
                                    reset_gyro=True,
                                    new_gyro_angle=180)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=310,
                                              speed_mm_s=180,
                                              target_angle=180 +
                                              adjust_for_mission)
Ejemplo n.º 12
0
def loading_to_basket():
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=120,
                                              speed_mm_s=140,
                                              target_angle=0)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=120,
                                              speed_mm_s=140,
                                              target_angle=-90)
Ejemplo n.º 13
0
def run():

    shared_all.move_straight_target_direction(gyro = gyro, 
        distance_mm=190, 
        speed_mm_s=-18, 
        target_angle=DIRECTION)

    # shared_all.move_straight(distance_mm=90, speed_mm_s=-140)
    shared_all.turn_to_direction( gyro = gyro, target_angle = DIRECTION)
Ejemplo n.º 14
0
def row_to_weight_right_angleTurns(adjust_for_mission=0):

    shared_all.turn(angle=-40)
    shared_all.turn_arc(distance=50, angle=-60, speed_mm_s=80)

    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=70,
                                              speed_mm_s=160,
                                              target_angle=-90 +
                                              adjust_for_mission)
Ejemplo n.º 15
0
def weightpushdown_to_phone(adjust_for_mission=0):
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=90,
                                              speed_mm_s=110,
                                              target_angle=-90 +
                                              adjust_for_mission)

    shared_all.turn(-90)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=60,
                                              speed_mm_s=110,
                                              target_angle=180 +
                                              adjust_for_mission)
Ejemplo n.º 16
0
def base_to_innov():
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=210,
                                              speed_mm_s=190,
                                              target_angle=-90)
    shared_all.move_to_color(color_sensor=color_sensor_center,
                             stop_on_color=Color.GREEN,
                             alternative_color=Color.GREEN,
                             max_distance_mm=30)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=10,
                                              speed_mm_s=110,
                                              target_angle=-90)
Ejemplo n.º 17
0
def base_to_treadmill(adjust_for_mission=0):
    # shared_all.move_straight(distance_mm=1370,speed_mm_s=-150)

    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=1340,
                                              speed_mm_s=-290,
                                              target_angle=180)
    shared_all.move_to_color_reverse(
        color_sensor=color_sensor_center,
        stop_on_color=Color.WHITE,
        alternative_color=Color.WHITE,
        min_intensity=robot_setup.WHITE_MIN_INTENSITY[color_sensor_center],
        max_distance_mm=180)
Ejemplo n.º 18
0
def alignold(adjust_for_mission=0):

    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=15,
                                              speed_mm_s=110,
                                              target_angle=180 +
                                              adjust_for_mission)

    shared_all.move_crane_to_top(motor=crane_motor)
    shared_all.turn(90, speed_deg_s=160)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=10,
                                              speed_mm_s=-110,
                                              target_angle=-90 +
                                              adjust_for_mission)
Ejemplo n.º 19
0
def aligntonorth(adjust_for_mission=0):

        shared_all.turn_arc(distance=150, angle=-45, speed_mm_s=170)
        shared_all.turn_arc(distance=150, angle=45, speed_mm_s=170)

        shared_all.move_straight_target_direction(gyro = gyro, 
                distance_mm= 20, 
                speed_mm_s= 110, 
                target_angle= -90+ adjust_for_mission)
        shared_all.turn_to_direction( gyro=gyro, target_angle=0+ adjust_for_mission)
        shared_all.move_to_color_reverse(color_sensor=color_sensor_center,
                stop_on_color=Color.GREEN, alternative_color=Color.GREEN)
        shared_all.move_to_color(color_sensor=color_sensor_center,
                stop_on_color=Color.BLUE, alternative_color=Color.BLUE)
        shared_all.move_straight(distance_mm=10, speed_mm_s=-80)
Ejemplo n.º 20
0
def stepcounter_to_treadmill_reverse(adjust_for_mission=0):

    shared_all.move_straight(distance_mm=160, speed_mm_s=150)
    shared_all.turn(angle=-10)
    shared_all.turn_arc(distance=330, angle=-50, speed_mm_s=-150)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=400,
                                              speed_mm_s=-170,
                                              target_angle=180)
    shared_all.move_to_color_reverse(
        color_sensor=color_sensor_center,
        stop_on_color=Color.WHITE,
        alternative_color=Color.WHITE,
        min_intensity=robot_setup.WHITE_MIN_INTENSITY[color_sensor_center],
        max_distance_mm=180)
Ejemplo n.º 21
0
def align():

    shared_all.calibrate_gyro(-85)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=200,
                                              speed_mm_s=190,
                                              target_angle=-85)

    # shared_all.move_crane_to_floor( motor=crane_motor)
    # shared_all.move_crane_up( motor=crane_motor, degrees=60)
    shared_all.move_to_color(color_sensor=color_sensor_right,
                             stop_on_color=Color.GREEN,
                             alternative_color=Color.GREEN,
                             speed_mm_s=40,
                             max_distance_mm=60)
    shared_all.move_straight(distance_mm=50, speed_mm_s=40)
Ejemplo n.º 22
0
def basket_to_bench():
    shared_all.turn_arc(distance=90, angle=-55, speed_mm_s=-70)
    shared_all.move_crane_to_top(motor=rack_motor)

    shared_all.turn_to_direction(gyro=gyro,
                                 target_angle=180 + adjust_for_mission)
    shared_all.move_to_color_reverse(color_sensor=color_sensor_center,
                                     stop_on_color=Color.WHITE,
                                     alternative_color=Color.WHITE)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=120,
                                              speed_mm_s=140,
                                              target_angle=180 +
                                              adjust_for_mission)
    shared_all.move_crane_to_top(motor=crane_motor)
    shared_all.turn(-60)
Ejemplo n.º 23
0
def row_to_weight_pushdown(adjust_for_mission=0):

    shared_all.turn(angle=-40)
    shared_all.turn_arc(distance=50, angle=-60, speed_mm_s=80)

    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=70,
                                              speed_mm_s=160,
                                              target_angle=-90 +
                                              adjust_for_mission)
    shared_all.move_to_color(
        color_sensor=color_sensor_center,
        stop_on_color=Color.BLACK,
        alternative_color=Color.BLACK,
        max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
        max_distance_mm=120)
Ejemplo n.º 24
0
def align_color_and_rightturns(adjust_for_mission=0):
    shared_all.move_straight(distance_mm=170, speed_mm_s=120)
    shared_all.move_straight_target_direction(gyro = gyro, 
        distance_mm= 80, 
        speed_mm_s= -140, 
        target_angle= -90+ adjust_for_mission)
    shared_all.move_to_color_reverse(color_sensor=color_sensor_center,
        stop_on_color=Color.WHITE, alternative_color=Color.WHITE,
         min_intensity=robot_setup.WHITE_MIN_INTENSITY[color_sensor_center],
         max_distance_mm=110)
    
    shared_all.move_straight_target_direction(gyro = gyro, 
                distance_mm= 220, 
                speed_mm_s= 140, 
                target_angle= -90+ adjust_for_mission)

    shared_all.turn_to_direction( gyro=gyro, target_angle=0+ adjust_for_mission)
Ejemplo n.º 25
0
def phone_to_slide(adjust_for_mission=0):

    shared_all.turn_arc(distance=60, angle=-10, speed_mm_s=-90)
    shared_all.move_straight(distance_mm=40, speed_mm_s=-100)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=250,
                                              speed_mm_s=200,
                                              target_angle=180 +
                                              adjust_for_mission)

    shared_all.move_to_color(
        color_sensor=color_sensor_center,
        stop_on_color=Color.BLACK,
        alternative_color=Color.BLACK,
        speed_mm_s=25,
        max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
        max_distance_mm=140)
Ejemplo n.º 26
0
def tread_to_weight():
    # shared_all.move_straight_target_direction(gyro=gyro, distance_mm=600, speed_mm_s=180,
    #  target_angle= -90)

    shared_all.move_rack_to_top()
    #  shared_all.move_crane_to_floor(motor=crane_motor, release_angle=25)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=460,
                                              speed_mm_s=210,
                                              target_angle=-90)

    shared_all.move_to_color(
        color_sensor=color_sensor_center,
        stop_on_color=Color.WHITE,
        alternative_color=Color.BLACK,
        speed_mm_s=30,
        max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
        max_distance_mm=50)
Ejemplo n.º 27
0
def row_to_weight_curved(adjust_for_mission=0):

    shared_all.turn(angle=-55)
    shared_all.move_straight(distance_mm=280, speed_mm_s=170)
    # shared_all.move_to_color(color_sensor=color_sensor_center,
    #     stop_on_color=Color.BLACK, alternative_color=Color.BLACK,
    #      max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
    #      max_distance_mm=70)

    shared_all.turn(angle=-75, speed_deg_s=180)
    # shared_all.turn_arc(distance=100 , angle=-70, speed_mm_s=150)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=230,
                                              speed_mm_s=-160,
                                              target_angle=-170 +
                                              adjust_for_mission)

    shared_all.push_back_reset_gyro(distance_mm=50,
                                    reset_gyro=True,
                                    new_gyro_angle=180)
Ejemplo n.º 28
0
def alignold(adjust_for_mission=0):

    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=90,
                                              speed_mm_s=100,
                                              target_angle=-90 +
                                              adjust_for_mission)
    # shared_all.turn(-90)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=85,
                                              speed_mm_s=-120,
                                              target_angle=180 +
                                              adjust_for_mission)
    shared_all.move_to_color_reverse(color_sensor=color_sensor_center,
                                     stop_on_color=Color.BLACK,
                                     alternative_color=Color.BLACK)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=75,
                                              speed_mm_s=110,
                                              target_angle=180 +
                                              adjust_for_mission)

    shared_all.turn_to_direction(gyro=gyro,
                                 target_angle=-135 + adjust_for_mission,
                                 speed_mm_s=80)
Ejemplo n.º 29
0
def stepcounter_to_treadmill_forward(adjust_for_mission=0):

    # shared_all.turn( angle=-45)
    shared_all.turn_arc(distance=200, angle=-65,
                        speed_mm_s=150)  # turn in an arc
    shared_all.turn_arc(distance=200, angle=65,
                        speed_mm_s=150)  # turn in an arc

    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=170,
                                              speed_mm_s=150,
                                              target_angle=0)

    # back up and move at an angle to spine black line
    shared_all.turn(angle=40, speed_deg_s=90)
    shared_all.move_reverse(max_distance=50, speed_mm_s=110)
    shared_all.move_to_color(color_sensor=color_sensor_center,
                             stop_on_color=Color.BLACK,
                             alternative_color=Color.BLACK,
                             max_intensity=15)
    shared_all.move_reverse(max_distance=10, speed_mm_s=80)
    shared_all.turn(angle=-40, speed_deg_s=90)
    shared_all.turn_to_direction(gyro=gyro, target_angle=0)
Ejemplo n.º 30
0
def run():
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=195,
                                              speed_mm_s=20,
                                              target_angle=-90)