def backwards_until_white(self, should_stop=True, *, time=c.SAFETY_TIME): m.base_backwards() sec = seconds() + time / 1000 while seconds() < sec and self.senses_black(): msleep(1) if should_stop: m.deactivate_motors()
def backwards_until_black_cliffs(): # Goes backwards until both sensors have sensed black. print "Starting backwards_until_black_cliffs()" m.base_backwards() while NotBlackLeft() and NotBlackRight(): pass m.deactivate_motors()
def backwards_until(boolean_function, should_stop=True, *, time=c.SAFETY_TIME): m.base_backwards() sec = seconds() + time / 1000 while seconds() < sec and not(boolean_function()): msleep(1) if should_stop: m.deactivate_motors()
def backwards_until(boolean_function, time=c.SAFETY_TIME, should_stop=True): m.base_backwards() if time == 0: should_stop = False time = c.SAFETY_TIME wait_until(boolean_function, time) if should_stop: m.deactivate_motors()
def backwards_until_black_cliffs(should_stop=True, *, time=c.SAFETY_TIME): # Goes backwards until both sensors have sensed black. m.base_backwards() sec = seconds() + time / 1000 while seconds() < sec and isLeftOnWhite() and isRightOnWhite(): msleep(1) if should_stop: m.deactivate_motors()
def backwards_until_black_fcliffs(): print "Starting backwards_until_black_fcliffs()" m.base_backwards() while NotBlackFrontLeft() and NotBlackFrontRight(): pass if BlackFrontLeft(): while NotBlackFrontRight(): pass else: while NotBlackFrontLeft(): pass m.deactivate_motors()
def backwards_until_black_fcliffs(should_stop=True, *, time=c.SAFETY_TIME): m.base_backwards() sec = seconds() + time / 1000 while seconds() < sec and isLeftFrontOnWhite() and isRightFrontOnWhite(): msleep(1) if isLeftFrontOnBlack(): while isRightFrontOnWhite(): msleep(1) else: while isLeftFrontOnWhite(): msleep(1) if should_stop: m.deactivate_motors()
def backwards_until_not_depth(): m.base_backwards() while DepthSensesObject(): pass m.deactivate_motors()
def backwards_until_white_rfcliff(): print "Start backwards_until_white_rfcliff" m.base_backwards() while BlackFrontRight(): pass m.deactivate_motors()
def backwards_until_black_lfcliff(): print "Start drive_until_black_lfcliff" m.base_backwards() while NotBlackFrontLeft(): pass m.deactivate_motors()
def backwards_until_white_rcliff(): print "Start drive_until_black_rcliff" m.base_backwards() while BlackRight(): pass m.deactivate_motors()
def pick_up_coupler(): m.base_backwards(0.1) m.lift_arm(4,1) m.deactivate_motors()