publisher가 특정 토픽으로 데이터를 보내면 subscription 이 데이터를 받고 콜백 함수를 호출한다

ef arm_timer_callback(self):
        match self.current_state:
            case "IDLE":
                if(self.flightCheck and self.arm_message):
                    self.current_state = "ARMING"
                    self.get_logger().info("idle case passed")

            case "ARMING":
                if(not(self.flightCheck)):
                    self.current_state = "IDLE"
                    self.get_logger().info("case arming failed: FC failed")
                elif(self.arm_state == VehicleStatus.ARMING_STATE_ARMED and self.myCnt > 10):
                    self.current_state = "TAKEOFF"
                    self.get_logger().info("case arming passed")
                self.arm()

            case "TAKEOFF":
                if(not(self.flightCheck)):
                    self.current_state = "IDLE"
                    self.get_logger().info("case takeoff failed: FC failed")
                elif(self.nav_state == VehicleStatus.NAVIGATION_STATE_AUTO_TAKEOFF):
                    self.current_state = "LOITER"
                    self.get_logger().info("case takeoff passed")
                self.arm()
                self.take_off()

            case "LOITER":
                if(not(self.flightCheck)):
                    self.current_state = "IDLE"
                    self.get_logger().info("case loiter failed: FC failed")
                elif(self.nav_state == VehicleStatus.NAVIGATION_STATE_AUTO_LOITER):
                    self.current_state = "OFFBOARD"
                    self.get_logger().info("case loiter passed")
                self.arm()

            case "OFFBOARD":
                if(not(self.flightCheck) or self.arm_state == VehicleStatus.ARMING_STATE_DISARMED or self.failsafe == True):
                    self.current_state = "IDLE"
                    self.get_logger().info("case offboard failed: FC failed")
                self.state_offboard()
                self.current_state = "DONE"
            
            case "DONE":
                if (self.myCnt > 100):
                    self.destroy_timer(self.arm_timer)
                    self.get_logger().info("timer destroyed")

        if(self.arm_state != VehicleStatus.ARMING_STATE_ARMED):
            self.arm_message = False
        
        if(self.last_state != self.current_state):
            self.last_state = self.current_state
            self.get_logger().info(self.current_state)
        
        self.myCnt += 1
if(self.last_state != self.current_state):
            self.last_state = self.current_state
            self.get_logger().info(self.current_state)

이전 상태를 현재 상태로 업데이트