Exemplo n.º 1
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)
Exemplo n.º 2
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)
Exemplo n.º 3
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)
Exemplo n.º 4
0
def alignold(adjust_for_mission=0):
    shared_all.move_to_color(color_sensor=color_sensor_center,
                             stop_on_color=Color.BLACK,
                             alternative_color=Color.BLACK)

    shared_all.move_straight(distance_mm=10, speed_mm_s=70)

    shared_all.turn(-90)
    shared_all.move_straight(distance_mm=170, speed_mm_s=-170)
    shared_all.push_back_reset_gyro(distance_mm=60,
                                    reset_gyro=False,
                                    new_gyro_angle=0)
    shared_all.move_straight(distance_mm=160, speed_mm_s=150)

    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.BLACK,
                                     alternative_color=Color.BLACK)
Exemplo n.º 5
0
def run(adjust_for_mission=0):
    # shared_all.move_straight(distance_mm=190, speed_mm_s=-210)

    # left_motor.run_angle( -210,  3*360, Stop.BRAKE, True)
    shared_all.turn(5)
    #
    shared_all.move_straight(distance_mm=190, speed_mm_s=-210)
    right_motor.run_angle(-90, 50, Stop.BRAKE, True)

    left_motor.run_angle(-270, 3 * 360, Stop.BRAKE, True)

    shared_all.move_straight(distance_mm=230, speed_mm_s=180)
    # shared_all.move_straight(distance_mm=20, speed_mm_s=90)
    shared_all.turn_to_direction(gyro=gyro,
                                 target_angle=180 + adjust_for_mission)

    shared_all.turn(90)
    shared_all.push_back_reset_gyro(distance_mm=150,
                                    reset_gyro=True,
                                    new_gyro_angle=-90)
Exemplo n.º 6
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)
Exemplo n.º 7
0
def treadmill_to_row_nearrow(adjust_for_mission=0):

    shared_all.turn_arc(distance=110, angle=55,
                        speed_mm_s=100)  # turn in an arc
    shared_all.turn(angle=-55, speed_deg_s=120)

    shared_all.turn_to_direction(gyro=gyro,
                                 target_angle=180 + adjust_for_mission)

    # shared_all.turn_to_direction( gyro=gyro, target_angle=-90+ adjust_for_mission)
    shared_all.move_straight(180, -180)

    shared_all.push_back_reset_gyro(distance_mm=60,
                                    reset_gyro=True,
                                    new_gyro_angle=180)
    shared_all.move_straight(distance_mm=70, speed_mm_s=100)
    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=40)
Exemplo n.º 8
0
import basket
shared_all.calibrate_gyro()

INITIAL_ANGLE=0
ADJUST_FOR_MISSION=0 - INITIAL_ANGLE


bus_service_1.base_to_stepcounter()
stepcounter.step()
bus_service_1.stepcounter_to_treadmill()
bus_service_1.align_for_treadmill()
treadmill.treadon(ADJUST_FOR_MISSION)


bus_service_1.treadmill_to_row()
shared_all.push_back_reset_gyro(distance_mm = 80, reset_gyro = True, new_gyro_angle =0 )
adjust_for_mission=90
bus_service_1.align_to_row(adjust_for_mission)
row.row()
bus_service_1.push_tires()

bus_service_1.row_to_weight()
bus_service_1.align_to_weight()
weight.raise_weight()
shared_all.push_back_reset_gyro(distance_mm = 60, reset_gyro = True, new_gyro_angle =0 )
adjust_for_mission=180

bus_service_1.weight_to_phone()
bus_service_1.align_to_phone()
flip.shift_phone(ADJUST_FOR_MISSION)
flip.flip_small()