Softivation

Parameters arrive incomplete in a C# ground control station

Why does the parameter list come up incomplete in a C# ground control station? ArduPilot sends the list in one pass and doesn't automatically resend a lost parameter.

Furkan IŞIKAY 6 min read

The ground control station you wrote in C# connects to ArduPilot and telemetry flows, but the parameter list comes up incomplete every time. Sometimes you expect 1200 parameters, about 1150 land on screen, and you don't know which 50 didn't arrive.

The cause is how ArduPilot sends parameters. The list is streamed once, and a parameter lost on the way doesn't come back on its own.

Why it happens

When the ground station connects, it asks for the whole list. ArduPilot then sends every parameter it has, one by one, starting from the first. Each message carries that parameter's index and the total number of parameters in the list.

This stream is throttled to the speed the link can handle. If the connection has no hardware flow control, ArduPilot sends only a few messages per round, because sending faster clogs the link.

The official ArduPilot documentation also says that MAVLink doesn't guarantee delivery, so the ground station must notice missing parameters itself and request them again. What slows the stream and how many messages go per round is found only in the source code.

In what order the messages go

The ground station sends PARAM_REQUEST_LIST. ArduPilot answers with PARAM_VALUE messages starting at index 0. Each message carries the parameter's own index and the total count (param_count).

Without flow control (RTS/CTS), at most 5 PARAM_VALUE go in a round. Look at the red cross in the figure: if index 37 is lost on the way, ArduPilot never sends it again, and the ground station has to find the gap and request it one by one.

The parameter list streams in one pass; a lost one doesn't come back

The ground station sends PARAM_REQUEST_LIST, ArduPilot streams PARAM_VALUE from index 0 to 1368, and without flow control at most 5 messages go per round. Index 37 is lost on the way, when the stream ends the ground station sends PARAM_REQUEST_READ for the missing index, and only 37 comes back
Where to look: the red cross. ArduPilot doesn't send index 37 again. If your code doesn't find the gap and request it one by one at the moment marked in yellow, the list stays at 1368 parameters.

The 5-messages-per-round limit isn't mentioned in the official documentation. It sits in the handle_param_request_list() and queued_param_send() functions in GCS_Param.cpp.

Why the connection type makes a difference

When you connect a Pixhawk to the computer by USB, ArduPilot assumes flow control on that channel (when hal.gpio->usb_connected() returns true). So a parameter list downloaded over USB practically completes in one pass and quickly.

When you connect a Raspberry Pi or another companion computer to a TELEM port with a plain UART (TX, RX, GND only), flow control is treated as absent. At a low baud rate and with a long parameter list, this raises the chance of real packet loss.

If you test over TCP on the computer, you can't see this difference, because TCP guarantees delivery anyway.

Example: You developed the ground station on the bench with the Pixhawk over USB, and the parameter list came complete every time. In the field, the same ground station talks over a TELEM link through a Raspberry Pi, and the parameter you wanted to change before takeoff doesn't appear in the list. The code didn't change, the link did. That's the day the first loss shows up.

The most common mistake: the GCS taking the moment the stream stops to mean the list is complete. A reader that stops listening after a short silence window never notices the parameters that were actually lost.

Solution

Collect the index of every incoming PARAM_VALUE in a set. When the stream stops, work out the indexes between 0 and param_count-1 that aren't in the set, and send PARAM_REQUEST_READ only for those. When a single index is requested, ArduPilot returns only that parameter.

C#
public class ParamListTracker
{
    private readonly HashSet<ushort> _received = new();
    private ushort _paramCount;

    public void OnParamValue(ushort paramIndex, ushort paramCount)
    {
        _paramCount = paramCount;
        _received.Add(paramIndex);
    }

    public IReadOnlyList<ushort> FindMissingIndexes()
    {
        var missing = new List<ushort>();
        for (ushort i = 0; i < _paramCount; i++)
        {
            if (!_received.Contains(i)) missing.Add(i);
        }
        return missing;
    }

    public bool IsComplete() => _paramCount > 0 && _received.Count == _paramCount;
}

What an incomplete list looks like

If indexes 37, 812, 813 and 1200 are lost in a list of 1369 parameters, this class finds the four missing indexes. When you send PARAM_REQUEST_READ for each of them, the list is complete. The output looks like this:

Output
received=1365 / paramCount=1369
complete=False
missingCount=4
missingIndexes=37,812,813,1200
-> sending PARAM_REQUEST_READ: param_index=37
-> sending PARAM_REQUEST_READ: param_index=812
-> sending PARAM_REQUEST_READ: param_index=813
-> sending PARAM_REQUEST_READ: param_index=1200
complete=True once finished

Error Messages

There's no error text on the ArduPilot side for this problem; no warning comes for a lost parameter. Only your own counter shows the gap. In the output of the class above, look at these two lines:

complete=False line: the number of indexes received hasn't reached param_count. If the stream has stopped, the list isn't finished; request the missing indexes.

missingIndexes=37,812,813,1200 line: tells you which parameters were lost. Send a separate PARAM_REQUEST_READ for each of these indexes.

If you want to go deeper on this topic

You'll find the source code's decision order, real parameter defaults, board-specific differences and the quick diagnosis card in the relevant lesson of the C# Course from Beginner to Advanced.

Softivation YKİ library: start with a MAVLink connection, Turkish documentation, and a ready-made test interface when you write your own ground control station in C#.

Was this article helpful?

Free resourceTEKNOFEST UAV software readiness checklistCheck off your UAV software readiness stage by stage on a printable list.

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