def set_rotate_time(self): """Sets the time duration for which the robot should rotate in order to be facing the next point.""" new_heading = self.next_point_angle() delta = equiv_angle(new_heading - self.heading) self.rot_dir = 1 if delta > 0 else -1 self.go_for = self.angle_to_time(rad_to_deg(self.rot_dir * delta)) self.heading = new_heading self.delta_angle = delta
def status(self): """Return the status message that should be displayed at the beginning of the current mode.""" if self.mode == 0: return "impossible" if self.mode == 'halt': return "finished drawing" if self.mode == 'drive': return "drive {:.2f} cm".format(self.delta_pos) if self.mode == 'rotate': return "rotate {:.2f} degrees".format(rad_to_deg(self.delta_angle))