def go_up_ramp(): display("\nFunction: go_up_ramp\n") u.move_bin(c.ARM_SWING) x.drive_speed(12, 100) start_time = seconds() x.drive_speed(5, 100) while gyro_y() < 100 or seconds() < start_time + 2: if u.on_black_front(): x.drive_forever(50, 100) else: x.drive_forever(100, 50) msleep(10) x.drive_speed(8, 100) u.move_servo(c.SERVO_JOINT, c.JOINT_GROUND) # u.wait_for_button() print("1") x.pivot_left_condition(30, u.on_black_front, False) # u.wait_for_button() print("2") # if u.on_black_back(): x.pivot_right_condition(30, u.on_black_back) # x.pivot_right(35, 30) # u.wait_for_button() print("3") x.pivot_right_condition(30, u.on_black_back, False) # u.wait_for_button() print("4") x.pivot_left_condition(30, u.on_black_front, False) # u.wait_for_button() print("5") u.move_bin(c.ARM_ALL_UP) msleep(500)
def self_test(): display("\nFunction: self_test\n") display("Click left button to use botguy hitter else hit right") while not right_button() and not left_button(): pass if right_button(): c.HIT_BOTGUY = False display("wont hit botguy") elif left_button(): c.HIT_BOTGUY = True display("will hit botguy") display("DONE SETTING") if u.on_black_front() or u.on_black_back(): display("Something is wrong with the tophats!") display("LTOPHAT: {}\tRTOPHAT: {}".format(u.on_black_front(), u.on_black_back())) exit(1) while not u.found_bump(): pass display("Good gyro") u.wait_for_button() enable_servos() x.drive_forever(80, 80) x.drive_condition(80, 80, u.on_black_front, False) msleep(500) x.drive_condition(80, 80, u.on_black_back, False) x.freeze_motors() u.move_servo(c.SERVO_JOINT, c.JOINT_MID) u.move_servo(c.SERVO_BIN_ARM, c.ARM_SPINNER_TEST) x.wait_for_someone_to_rotate() u.wait_for_button() x.rotate_until_stalled(20) msleep(500) x.rotate_spinner(.06, -30) msleep(500) x.set_spinner_safe() u.move_servo(c.SERVO_JOINT, c.JOINT_TUCKED) u.move_servo(c.SERVO_BIN_ARM, c.ARM_TUCKED) u.move_servo(c.SERVO_BOT_GUY_HITTER, c.HITTER_OUT) u.move_servo(c.SERVO_BOT_GUY_HITTER, c.HITTER_IN) msleep(500) x.rotate(15, 60) msleep(1000) x.rotate(-15, 60) display("DONE")
def test_ramp(): x.drive_speed(100, 100) u.DEBUG() enable_servos() u.move_servo(c.DEPLOYABLE_WHEELS, c.WHEELS_DEPLOYED) u.move_bin(c.ARM_SWING) x.drive_speed(12, 100) start_time = seconds() x.drive_speed(5, 100) while gyro_y() < 100 or seconds() < start_time + 2: if u.on_black_front(): x.drive_forever(70, 100) else: x.drive_forever(100, 70) msleep(10) x.drive_speed(4, 100) x.pivot_left_condition(30, u.on_black_front, False)
def go_up_ramp2(): display("\nFunction: go_up_ramp\n") u.move_bin(c.ARM_SWING) x.drive_speed(12, 100) start_time = seconds() x.drive_speed(5, 100) while gyro_y() < 100 or seconds() < start_time + 2: if u.on_black_front(): x.drive_forever(70, 100) else: x.drive_forever(100, 70) msleep(10) x.freeze_motors() u.move_servo(c.SERVO_JOINT, c.JOINT_GROUND) if c.IS_CLONE: x.drive_speed(5, 100) u.move_servo(c.SERVO_BOT_GUY_HITTER, c.HITTER_ET) x.pivot_right_condition(-30, u.lost_ramp, False) x.pivot_left_condition(-30, u.on_black_back, False) x.linefollow_distance(9) if not c.IS_CLONE: x.drive_speed(8, 100) # u.wait_for_button() print("1") x.pivot_left_condition(30, u.on_black_front, False) # u.wait_for_button() print("2") # if u.on_black_back(): x.pivot_right_condition(30, u.on_black_back) # x.pivot_right(35, 30) # u.wait_for_button() print("3") x.pivot_right_condition(30, u.on_black_back, False) # u.wait_for_button() print("4") x.pivot_left_condition(30, u.on_black_front, False) # u.wait_for_button() print("5") u.move_bin(c.ARM_ALL_UP) msleep(500)
def go_to_ramp(): display("\nFunction: go_to_ramp\n") u.move_servo(c.SERVO_JOINT, c.JOINT_RAMP_ON) u.move_servo(c.SERVO_JOINT, c.JOINT_ARM_TILT) if c.IS_CLONE: x.rotate(-5, 50) else: x.rotate(-5, 50) x.drive_forever(-50, -50) u.move_bin(c.ARM_TILT, 5) x.drive_speed(-10, 100) x.rotate(5, 65) u.move_servo(c.SERVO_JOINT, c.JOINT_HOLD, 5) u.move_bin(c.ARM_TUCKED, 5) msleep(100) x.drive_speed(-7, 100) x.drive_speed(-6, 75) x.drive_speed(2, 75) x.pivot_right(-90, 60) u.move_servo(c.SERVO_JOINT, c.JOINT_MID)