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()
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)
def alignheadon(adjust_for_mission=0): shared_all.turn(180, 210) 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)
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)
def treadmill_to_row_simple(adjust_for_mission=0): shared_all.move_to_color_reverse( color_sensor=color_sensor_center, stop_on_color=Color.WHITE, alternative_color=Color.BLACK, max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center], max_distance_mm=50) shared_all.move_straight(distance_mm=40, speed_mm_s=70)
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)
def runpushdown(): shared_all.move_rack_to_top() shared_all.move_straight(distance_mm=110, speed_mm_s=120) shared_all.turn(35) shared_all.move_crane_down(rack_motor, 210) shared_all.turn(-35) shared_all.move_straight(distance_mm=50, speed_mm_s=-120) shared_all.start_moving_crane_to_top(rack_motor) shared_all.move_to_color_reverse( 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_rack_to_top()
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)
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)
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)
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)
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)
def align(adjust_for_mission=0): shared_all.turn(angle=-30) 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=90) # shared_all.move_straight(distance_mm=10, speed_mm_s=30) 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, max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center], max_distance_mm=180)
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)