Softivation

Mission Planner always shows the same flight mode

You flip the switch, but the flight mode doesn't change. We explain which PWM window the mode channel falls into, the unread zone at both ends, and the 200 ms settling time.

Furkan IŞIKAY 7 min read

You flip the switch. The transmitter beeps to confirm, and the bar on the radio calibration screen moves. But the mode text on the screen stays where it is.

No warning line appears and there's no error sound, because in most cases the autopilot never read the switch at all.

The autopilot sees a number, not the switch

The three-position switch on the transmitter has no equivalent on the autopilot side. In the frame coming from the receiver, there's only one microsecond value per channel.

A setting decides which channel is the mode channel; the default is channel 5. The autopilot takes that channel's raw value and checks which of six windows it falls into.

The windows aren't equal in width. The four in the middle are narrow 130-microsecond slices, while the ones at the ends are much wider. Look at the narrow slices in the figure below: that's why it's easy for two positions to fall into the same slice.

Which position the mode channel value falls into

Six position windows by the mode channel's raw value: 801-1230 pos 1, 1231-1360 pos 2, 1361-1490 pos 3, 1491-1620 pos 4, 1621-1749 pos 5, 1750-2199 pos 6. 800 and below and 2200 and above are not read
Where to look: the four slices in the middle are narrow, so two transmitter positions easily fall into the same slice. At the hatched ends the position is never calculated and the mode stays at its last value.

There's a zone at both ends that is never read

Outside the windows there's a behavior the documentation doesn't describe. When the channel goes to 800 or below, or 2200 or above, the position isn't calculated. The hatched ends in the figure are this zone.

800 and 2200 are the limits themselves and count as outside. 801 is read as position 1, 2199 as position 6. At 800 and 2200 the mode freezes where it is.

This isn't a mode rejection. The read ends with an error condition, the decision chain stops there, and the mode stays at its last value. Nothing appears on screen and no line is written to the log.

Misconfigured transmitter mixers or channels with extended endpoints exceed 2200 more often than you'd think.

A position takes 200 milliseconds to settle

A new position isn't accepted right away. The value has to stay in the same window for 200 milliseconds; only then is a mode request generated.

With a clean switch you won't notice this delay. With an oxidized contact or on a noisy line, the value jumps between two windows and the timer never fills. Compare the timer in the two cases in the figure below.

The new position must stay in the same window for 200 ms

When the switch moves from pos 3 to pos 4, a mode request is generated if the value stays in the same window for 200 ms. With a value jumping between two windows, the timer restarts every time
Where to look: the yellow timer ramps. Each time the value enters the new window the timer starts from zero, and it stops when the value goes back to the old window. In the bottom strip no ramp reaches the red 200 ms line.

The most common mistake is to start changing parameters without listening to the mode channel. Every fix made without seeing the raw value also hides which change actually worked.

Read your own channel

Looking at the raw value instead of guessing is the shortest path. The Python code below reads the mode channel number from the FLTMODE_CH parameter, listens to the channel through the ground station, and prints one line every time the window changes.

Python
from pymavlink import mavutil

BAGLANTI = "udp:127.0.0.1:14550"
SINIRLAR = ((1231, 1), (1361, 2), (1491, 3), (1621, 4), (1750, 5))


def pencere(pwm):
    if pwm <= 800 or pwm >= 2200:
        return None
    for esik, poz in SINIRLAR:
        if pwm < esik:
            return poz
    return 6


arac = mavutil.mavlink_connection(BAGLANTI)
arac.wait_heartbeat()
arac.mav.param_request_read_send(arac.target_system, arac.target_component,
                                 b"FLTMODE_CH", -1)
kanal = int(arac.recv_match(type="PARAM_VALUE", blocking=True, timeout=5).param_value)
arac.mav.request_data_stream_send(arac.target_system, arac.target_component,
                                  mavutil.mavlink.MAV_DATA_STREAM_RC_CHANNELS, 5, 1)

son = -1
while True:
    msg = arac.recv_match(type="RC_CHANNELS", blocking=True)
    pwm = getattr(msg, "chan%d_raw" % kanal)
    poz = pencere(pwm)
    if poz != son:
        son = poz
        print("channel %d pwm %4d -> %s"
              % (kanal, pwm, "position %d" % poz if poz else "UNREADABLE"))

If you sweep the channel from end to end, you get lines like these:

Output
channel 5 pwm 700 -> UNREADABLE
channel 5 pwm 1150 -> position 1
channel 5 pwm 1300 -> position 2
channel 5 pwm 1450 -> position 3
channel 5 pwm 1550 -> position 4
channel 5 pwm 1700 -> position 5
channel 5 pwm 1900 -> position 6
channel 5 pwm 2250 -> UNREADABLE

Hold the switch in each position for a few seconds. If you don't see six different position numbers for six positions, the problem isn't in the parameters but in the range the transmitter produces.

Example: you assigned the transmitter's three-position switch to AUTO. When you move the switch to the top position, the screen still says LOITER, and there's no warning. When you run the code and sweep the switch through its three positions, you see that the top two positions print the same position number: the two positions fall into the same narrow slice in the figure. Before touching the parameters, change the endpoint of that position on the transmitter and wait for the line to change.

Error Messages and Their Meanings

If you do see a message, you're in better shape. It means the decision chain got all the way to the end, the mode was read and rejected. The second half of the message gives the reason for the rejection.

Mode change to LOITER failed: requires position

The mode needs a position estimate, and the autopilot doesn't have a healthy position. The satellite count alone isn't enough; the horizontal position estimate has to be accepted.

Mode change to ALT_HOLD failed: need alt estimate

The altitude estimate isn't valid. This check only runs when switching from a mode where you control the throttle directly to a mode with automatic throttle.

Mode change to STABILIZE failed: throttle too high

While the vehicle was on the ground, you tried to switch to a direct-throttle mode with your throttle stick up. The same switch won't be accepted again until you pull the throttle stick all the way down.

Mode change to AUTO failed: GCS entry disabled (FLTMODE_GCSBLOCK)

This mode is blocked for ground station commands. The FLTMODE_GCSBLOCK bitmask only filters requests coming from the ground station. The same mode can be selected from the switch on the transmitter without any problem.

One step further

Flight modes, transmitter calibration, and the prearm chain are covered from start to finish in the Drone Basics: From Sensors to Flight course. The lesson that continues this article has also been added to the troubleshooting section of the same course.

Was this article helpful?

Free resourcePixhawk and ArduPilot error message glossaryThe 4 messages in this article and similar ones are in the glossary: what they mean, why they appear, what to check first.