def blink(self, color, iterations, period): with self.error_animation_lock: command = LedUserRequest() command.animation_mode.animation = LedRingAnimation.FLASHING command.colors = [color] command.iterations = iterations command.period = period self.start_led_ring_thread(command) try: if self.led_ring_animation_thread.is_alive(): self.led_ring_animation_thread.join() except RuntimeError: pass
def shutdown(self): if not self.__is_shutdown: self.robot_status_subscriber.unregister() self.stop_led_ring_thread() self.user_animation_lock.acquire() command = LedUserRequest() command.colors = [WHITE] command.iterations = 1 command.period = 2 self.breath_animation(command) self.blink(WHITE, 8, 0.5) self.error_animation_lock.acquire() self.none_animation(None) self.__is_shutdown = True