Softivation

Mission Planner screen freezes (telemetry connected)

Mission Planner shows telemetry data late and the screen freezes. The capacity of a 57600 baud link, the byte cost of stream groups, and code that measures your own link.

Furkan IŞIKAY 7 min read

Telemetry is connected, the signal level is good, and the flight screen shows altitude and speed. Then the drone on the map stalls in one place and, a few seconds later, jumps to its new position.

The artificial horizon stutters, and the battery value refreshes late. The connection doesn't drop; the screen is just lagging behind.

In this situation the first suspect is usually the radio: the antenna is swapped, the radio is moved, the baud rate is raised. In most cases none of it changes the result, because the problem isn't the signal quality but the amount of data you're trying to push through the link.

The number of bytes a link can carry is fixed

A 57600 baud serial link carries 57600 bits per second. In the common 8N1 frame, each byte takes 10 bits on the wire: eight data bits, one start bit, one stop bit.

The result of the calculation is a single number: 5760 bytes per second. Anything that wants to pass more than this through the link has to wait.

How the load grows as the stream rate increases

When the ground control station sets all stream groups to the same rate, the load on the link grows along with the rate. The figure shows the per-second total of the raw length of the packets arriving for five different requests on ArduCopter 4.7.0.

Byte load on the link as the requested stream rate increases

96 B/s with no stream request, 1038 at 1 Hz, 2314 at 2 Hz, 4535 at 4 Hz, 11384 B/s at 10 Hz. The limit of a 57600 baud link is 5760 B/s
Where to look: the red line. The 4 Hz column is below the limit but close to it. The 10 Hz column reaches twice what the link can carry.

Look at the red line: at four hertz the link is 79 percent full, and at ten hertz the requested data is twice what the link can carry.

The excess doesn't vanish into the air. The autopilot doesn't discard a message it can't send; it queues it and tries again on the next pass. The delay you see on screen is that queue growing longer.

Raising the stream rate makes things worse

When the screen stutters, most users reflexively raise the stream rate. If the link is already full, this does nothing but add more messages to the queue. New data lines up behind the old, and the value on screen lags even further.

The same thing happens while the parameter list downloads. In the source code, a multiplier is applied directly to the stream interval: while parameters are being sent the interval is multiplied by four, and while mission items are being requested it is multiplied by four again. So while the parameter window is open, the firmware deliberately slows the screen down.

The share set aside for parameter downloads is also calculated from the link's capacity. In libraries/AP_HAL/UARTDriver.h, bw_in_bytes_per_second() returns 5760 by default.

What to check, in order

  1. Is the link connected, is data arriving at all? If HEARTBEAT drops out, the problem is not bandwidth but the physical link.
  2. Who sets the stream rates? The ground control station may be requesting its own rate every time it connects.
  3. Measure the byte load on the link. Add up the message sizes and divide by seconds. Don't guess.
  4. Does the load exceed the link's capacity? A 57600 baud 8N1 link carries 5760 bytes per second.
  5. If it does, decide which stream to cut. Reset the message group you aren't reading on screen.

Don't skip the first step. If the heartbeat message doesn't arrive every second, forget bandwidth. Check the cable, the connector, and whether the two radios' settings match.

Example: At the trackside you have Mission Planner open and you're waiting for the list to download so you can change a value in the parameter window. The map is stuttering at that moment. Your teammate suggests raising the stream rate. Go through the list above in order: if HEARTBEAT arrives every second, the link is healthy, and the screen slowing down while parameters download is expected behavior. If the screen still lags after the list has downloaded, run the code and measure how full the link is, then reset the streams you aren't reading.

Measure the load on your own link

There's no point guessing; measuring takes a few lines. The code below adds up the raw packet length of whatever arrives on the link and compares the result with the capacity derived from the baud rate. How to run it is written in the comment at the top of the code.

Pythonhat_yuku.py
"""Measures the actual byte load on the telemetry link.
Usage: python3 hat_yuku.py /dev/ttyUSB0 57600 20
For SITL: python3 hat_yuku.py tcp:127.0.0.1:5760 57600 20
"""
import sys, time, collections
from pymavlink import mavutil

adres = sys.argv[1] if len(sys.argv) > 1 else "tcp:127.0.0.1:5760"
baud = int(sys.argv[2]) if len(sys.argv) > 2 else 57600
sure = int(sys.argv[3]) if len(sys.argv) > 3 else 20

baglanti = mavutil.mavlink_connection(adres, baud=baud)
if baglanti.wait_heartbeat(timeout=30) is None:
    sys.exit("No HEARTBEAT received, link is not up")

bayt = collections.Counter()
adet = collections.Counter()
basla = time.time()
while time.time() - basla < sure:
    m = baglanti.recv_match(blocking=True, timeout=1)
    if m is None or m.get_type() == "BAD_DATA":
        continue
    ham = m.get_msgbuf()
    bayt[m.get_type()] += len(ham) if ham else 0
    adet[m.get_type()] += 1

gecen = time.time() - basla
toplam = sum(bayt.values()) / gecen
butce = baud / 10.0                      # 8N1: 10 bits per byte
print("measurement time : %.1f s" % gecen)
print("link load : %.0f B/s" % toplam)
print("link capacity : %.0f B/s (%d baud, 8N1)" % (butce, baud))
print("doluluk           : %%%.0f" % (100 * toplam / butce))
print("-" * 52)
for ad, b in sorted(bayt.items(), key=lambda x: -x[1])[:8]:
    print("%-24s %6.1f B/s  %5.1f Hz" % (ad, b / gecen, adet[ad] / gecen))

If you connect to a four-hertz stream and run it, you get output similar to this:

Output
measurement time : 20.2 s
link load : 3874 B/s
link capacity : 5760 B/s (57600 baud, 8N1)
doluluk           : %67
----------------------------------------------------
SIMSTATE                  224.7 B/s    4.0 Hz
ESC_TELEMETRY_1_TO_4      224.7 B/s    4.0 Hz
RC_CHANNELS               216.6 B/s    4.0 Hz
BATTERY_STATUS            212.6 B/s    4.0 Hz
GPS_RAW_INT               208.6 B/s    4.0 Hz
ATTITUDE                  202.1 B/s    5.1 Hz
SYS_STATUS                172.5 B/s    4.0 Hz
RAW_IMU                   164.5 B/s    4.0 Hz

The total here isn't exactly the same as the four-hertz column in the chart. The same request can give 4535 B/s one time and 3874 B/s another, because which message gets queued on which pass changes from pass to pass. Make your decision based on the number you measure on your own link.

Raising the stream rate when the screen stutters is the most common mistake. If the load is already above the link's capacity, increasing the rate only lengthens the queue.

Error Messages and Their Meanings

It appears when the ground control station or a companion computer asks for an interval for a message the autopilot doesn't put in a stream. The command result comes back as MAV_RESULT_DENIED and the requested message never arrives.

In the source, this text is printed only under a build condition, so you may not see the line on your own board. The place to look on the board is the rejected command result.

Getting Params

When connecting, Mission Planner downloads the parameter list and waits on this line. When the link is full, this stage gets longer. Cases lasting minutes, even ones that never finish, have been reported on the forum. Live data keeps flowing during the wait, so the connection looks healthy.

High Latency enabled

There is a separate operating mode for narrow links. When the serial port's protocol is set to 43, the autopilot cuts the normal streams and switches to a single summary message, and prints this line. It's used on very narrow links such as satellite connections. On a normal radio, you lose the screen's liveliness.

More on this topic

Measuring the link is only the beginning. Which message group to turn off, where the autopilot decides to queue, and how to read the signature of this behavior in the tlog are covered step by step in the Drone Communication Technologies 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.

Learn this topic from start to finish

Season plan: all six courses for 9 months, ₺790 a month. ₺390 a month for high school and university students, ₺351 the first month with your member code. You can stop in any month you like. Start the Season plan · I'm a student