def get_low_poms(): # First pom set print "Starting get_low_poms()" m.arm_slow(c.ARM_UP_POS, 3, 1) f.backwards_through_line_lfcliff() f.backwards_through_line_lfcliff() f.align_close_fcliffs() collect_poms()
def get_low_poms_cheeky(): # First pom set print "Starting get_low_poms()" m.arm_slow(c.ARM_UP_POS, 3, 1) f.backwards_through_line_lfcliff() f.backwards_through_line_lfcliff() f.align_close_fcliffs() collect_poms(50, 0) f.forwards_until_black_lfcliff() m.backwards(150)
def get_mid_poms(): # Second pom set print "Starting get_mid_poms()" f.forwards_until_black_lfcliff() f.align_close_fcliffs() m.arm_slow(c.ARM_UP_POS, 2, 1) m.turn_left() m.backwards(2680) m.turn_right() f.forwards_until_black_lfcliff() f.align_close_fcliffs() collect_poms()
def get_high_poms_cheeky(): print "Starting get_high_poms_cheeky()" f.forwards_until_black_lfcliff() f.align_close_fcliffs() m.arm_slow(c.ARM_UP_POS, 2, 1) m.turn_right() m.forwards(2680) m.turn_left() f.forwards_until_black_lfcliff() f.align_close_fcliffs() collect_poms(10000) f.backwards_until_white_lfcliff() m.arm_slow(c.ARM_UP_POS, 2, 1)
def get_farther_mid_poms(): f.forwards_until_line_fcliffs() f.align_close_cliffs() m.arm_slow(c.ARM_UP_POS, 2, 1) f.right_point_turn_until_lfcliff_senses_black() f.right_point_turn_until_lfcliff_senses_white() f.lfollow_lfcliff_smooth(2) f.lfollow_lfcliff_smooth_until_right_depth_senses_object() m.forwards(1000) m.turn_left() f.backwards_through_line_lfcliff() f.align_close_fcliffs() collect_poms()
def get_high_poms(): # Third pom set print "Starting get_high_poms()" f.forwards_until_line_fcliffs() f.align_close_cliffs() f.right_point_turn_until_lfcliff_senses_black() f.right_point_turn_until_lfcliff_senses_white() # m.turn_right() # f.left_point_turn_until_lfcliff_senses_black() # How does it know it is on the right side of the line? f.lfollow_lfcliff_smooth_until_rfcliff_senses_black() m.backwards(1400) m.turn_left() f.backwards_through_line_lfcliff() f.align_close_fcliffs() collect_poms(50, 0)
def get_farther_high_poms(): print "Starting get_farther_high_poms()" f.forwards_until_line_fcliffs() f.align_close_cliffs() m.arm_slow(c.ARM_UP_POS, 2, 1) f.right_point_turn_until_lfcliff_senses_black() f.right_point_turn_until_lfcliff_senses_white() f.lfollow_lfcliff_smooth_until_rfcliff_senses_black() f.forwards_until_white_rfcliff() f.right_point_turn_until_rfcliff_senses_black(2) f.right_point_turn_until_lfcliff_senses_black(2) f.right_point_turn_until_rfcliff_senses_white(2) f.right_point_turn_until_rfcliff_senses_black(2) f.backwards_until_black_lfcliff() # m.turn_right(int(0.5 * c.RIGHT_TURN_TIME), 2 * c.BASE_LM_POWER, -2 * c.BASE_RM_POWER) # m.turn_right(int(0.5 * c.RIGHT_TURN_TIME), 2 * c.BASE_LM_POWER, -2 * c.BASE_RM_POWER) m.backwards(1650) m.turn_right() f.forwards_until_line_fcliffs() f.align_close_fcliffs() collect_poms()
def calibrate(): max_sensor_value_rcliff = 0 min_sensor_value_rcliff = 90000 max_sensor_value_lcliff = 0 min_sensor_value_lcliff = 90000 max_sensor_value_lfcliff = 0 min_sensor_value_lfcliff = 90000 max_sensor_value_rfcliff = 0 min_sensor_value_rfcliff = 90000 sec = seconds() + 9 print "Running calibrate()" m.activate_motors(-1, int(c.BASE_LM_POWER / 2), int(c.BASE_RM_POWER / 2)) print str(int(c.BASE_LM_POWER / 2)) print str(int(c.BASE_RM_POWER / 2)) while seconds() < sec: if get_create_rcliff_amt() > max_sensor_value_rcliff: max_sensor_value_rcliff = get_create_rcliff_amt() if get_create_rcliff_amt() < min_sensor_value_rcliff: min_sensor_value_rcliff = get_create_rcliff_amt() if get_create_lcliff_amt() > max_sensor_value_lcliff: max_sensor_value_lcliff = get_create_lcliff_amt() if get_create_lcliff_amt() < min_sensor_value_lcliff: min_sensor_value_lcliff = get_create_lcliff_amt() if get_create_rfcliff_amt() > max_sensor_value_rfcliff: max_sensor_value_rfcliff = get_create_rfcliff_amt() if get_create_rfcliff_amt() < min_sensor_value_rfcliff: min_sensor_value_rfcliff = get_create_rfcliff_amt() if get_create_lfcliff_amt() > max_sensor_value_lfcliff: max_sensor_value_lfcliff = get_create_lfcliff_amt() if get_create_lfcliff_amt() < min_sensor_value_lfcliff: min_sensor_value_lfcliff = get_create_lfcliff_amt() msleep(1) m.deactivate_motors() c.LCLIFF_BW = ( (max_sensor_value_lcliff + min_sensor_value_lcliff) / 2) + 750 c.RCLIFF_BW = ( (max_sensor_value_rcliff + min_sensor_value_rcliff) / 2) + 750 c.LFCLIFF_BW = ( (max_sensor_value_lfcliff + min_sensor_value_lfcliff) / 2) + 770 c.RFCLIFF_BW = ( (max_sensor_value_rfcliff + min_sensor_value_rfcliff) / 2) + 1000 print "LCLIFF_BW: " + str(c.LCLIFF_BW) print "RCLIFF_BW: " + str(c.RCLIFF_BW) print "LFCLIFF_BW: " + str(c.LFCLIFF_BW) print "RFCLIFF_BW: " + str(c.RFCLIFF_BW) print "max_sensor_value_rcliff: " + str(max_sensor_value_rcliff) print "min_sensor_value_rcliff: " + str(min_sensor_value_rcliff) msleep(500) f.forwards_until_black_lfcliff() f.align_close_fcliffs() msleep(300) f.forwards_until_black_lcliff() f.align_close_cliffs() msleep(300) f.forwards_until_bump() m.backwards(100) #m.activate_motors(1) #msleep(4250) #m.deactivate_motors() msleep(1500) ao() create_disconnect() wait_for_light(c.LIGHT_SENSOR) create_connect() shut_down_in(120) # URGENT: PUT BACK IN BEFORE COMPETITION