NiVO / BY TECHNOGISGermany · Indonesia
Telemetry matrix tutorial

MAVLink ODOMETRY Covariance: Preserve Unknown Values and Rebuild the Matrix

Read the 21-entry upper triangle in its declared state order, preserve the first-element NaN marker, and separate a reported matrix from validated drone accuracy.

MAVLink ODOMETRY Covariance: Preserve Unknown Values and Rebuild the Matrix

Identify what the logged covariance field represents

An offline drone log can expose an ODOMETRY pose_covariance array with twenty-one values. Treating it as six consecutive variances or reshaping it into an arbitrary rectangle will lose the declared associations. Before plotting or summarizing the values, identify the message definition, the state order, and the marker used when the covariance is unknown. The immediate task is to understand the recorded representation. It is not to turn every populated numeric field into a statement about the aircraft’s actual positioning accuracy or the quality of a delivered survey.

This tutorial reconstructs a symmetric six-by-six layout from constructed decoded field values. It does not connect to a vehicle, parse MAVLink packets, or inspect a NiVO flight. The example is designed for a desk reviewer who needs to explain which array entries belong to which state pairs. It also preserves the defined unknown marker instead of replacing it with zeros. Actual estimator behavior, frame interpretation, calibration, and project acceptance require separate evidence from the identified system and recording. The accompanying catalogue photograph supplies product context only.

Read the upper triangle and the unknown marker together

The current MAVLink common definition describes pose_covariance as the upper-right triangle of a six-by-six matrix, stored row by row. The states are x, y, z, roll, pitch, and yaw. The first row contributes six entries, the next five, and so on until the final row contributes one. The same definition says that unknown covariance is indicated by a NaN in the first array element. That marker has to be considered before ordinary finite-value processing or a matrix display is presented as usable covariance information.

Unknown is different from a reported zero. Replacing the first NaN with zero would erase the message’s explicit unavailable state. Conversely, an all-zero array should not be relabeled unknown merely because a reviewer expects uncertainty to be nonzero; its interpretation needs evidence about the actual producer and decoder. Preserve both the raw field and the classification used by the review. Python’s math.isnan tests for NaN directly, while equality with a NaN is unsuitable for that purpose. Keeping the marker test explicit makes the boundary visible in the code and the report.

NiVO VTOL V5 product image showing the fixed wing and vertical-lift rotors
NiVO VTOL V5 product image showing the fixed wing and vertical-lift rotors.Source: NiVO / TechnoGIS catalogue materials supplied by the site owner · Catalogue photo
Product context only; this photograph does not depict the constructed examples in this article.

Rebuild a constructed matrix without sending any telemetry

The function below accepts a list or tuple of twenty-one decoded numeric entries. It rejects Boolean and nonnumeric values under this teaching profile, returns None when the first entry is NaN, and otherwise requires finite entries before filling the symmetric matrix. Row and column positions follow the declared upper-triangle order. It copies each supplied upper entry into the corresponding lower position, producing a readable layout for inspection. Symmetry is therefore built by the reconstruction method; it is not an independent validation result about a real estimator.

The constructed example places values only on the diagonal positions at indices 0, 6, 11, 15, 18, and 20. The printed diagonal should be 4.0, 9.0, 16.0, 0.01, 0.04, and 0.09. These invented values illustrate index placement, not measured uncertainty. A second copy has its first entry changed to NaN and should return None. The function never modifies the input array. It does not calculate a confidence region, rotate a covariance matrix, assess positive semidefiniteness, or establish whether the values are a valid statistical description of any actual motion estimate.

import math

def pose_matrix(values):
    if not isinstance(values, (list, tuple)) or len(values) != 21:
        raise ValueError("Expected the decoded 21-entry pose covariance")
    if not all(type(value) in (int, float) for value in values):
        raise ValueError("Expected numeric field entries, not Boolean or text")
    if math.isnan(values[0]):
        return None
    if not all(math.isfinite(value) for value in values):
        raise ValueError("Nonfinite entry outside the supported unknown case")
    matrix = [[0.0] * 6 for _ in range(6)]
    entries = iter(values)
    for row in range(6):
        for column in range(row, 6):
            value = float(next(entries))
            matrix[row][column] = matrix[column][row] = value
    return matrix

# Constructed decoded field, not a measured estimator output.
toy = [0.0] * 21
for index, value in zip((0, 6, 11, 15, 18, 20), (4, 9, 16, 0.01, 0.04, 0.09)):
    toy[index] = value
matrix = pose_matrix(toy)
print([matrix[i][i] for i in range(6)])
unknown = toy.copy()
unknown[0] = float("nan")
print(pose_matrix(unknown))

Retain state order and coordinate-frame evidence

A matrix display needs labels as well as numbers. Retain the pose state order and the ODOMETRY frame_id alongside the reconstructed values. The message separately identifies the child frame for velocity data, so do not transfer velocity context to the pose field without checking the definition and the actual recording. Position and angular states also have different meanings; a larger diagonal number in one part of the matrix is not automatically a worse score than a smaller number in another. Keep those associations explicit before considering any derived summary.

Record the decoder version and the message-definition revision used to obtain the twenty-one values. A text export that changes NaN to an empty cell, a string, or zero needs its own interpretation record before this function is used. The example expects decoded numeric values rather than repairing such exports. If a matrix transformation is required for a real analysis, use the correct frame relationship and error convention through an appropriate method. The simple upper-triangle expansion here performs no such transformation and supplies no evidence that different frames can be compared directly.

Separate layout reconstruction from uncertainty validation

A finite symmetric array is not sufficient evidence that a reported covariance is statistically valid or appropriate for a project decision. This function does not test diagonal sign, positive semidefiniteness, estimator consistency, or the relationship between reported uncertainty and independently observed errors. Those are separate questions requiring suitable methods and actual data. Preserve a distinction between reconstructing what the field reports and deciding whether that report is credible. The constructed diagonal example does not demonstrate the performance of any navigation system, payload, positioning service, or flight configuration.

The unknown-marker branch has a similarly narrow meaning. It reports that the supplied field uses the defined unavailable marker; it does not identify why the producer lacks covariance or whether another field provides useful information. Keep the rest of the recorded message and capture context available for investigation. Do not fill the unavailable matrix from a neighboring row, replace it with a convenient default, or treat missing uncertainty as proof of perfect certainty. If a later analysis needs an explicit missing-data policy, document it separately from the faithful reading of the original field.

Deliver a matrix finding with its limits attached

A useful log-review note identifies the unchanged recording, decoder and definition revision, selected message context, raw array, and reconstructed state labels. State whether the field was classified unknown or expanded from finite entries. Attach any independently performed validation as a separate result with its own method. If the input falls outside the function’s shape or type profile, retain that rejection instead of quietly dropping the row. A clear layout finding can help another reviewer reproduce the interpretation without assuming that a matrix-looking table is already an accuracy certificate.

For a NiVO-related telemetry discussion, this approach makes the recorded uncertainty representation easier to audit while keeping operational conclusions tied to actual evidence. Preserve the original field, honor its unavailable state, and label every row and column before deriving another quantity. Continue the project’s separate checks for navigation behavior, data completeness, reference systems, and survey acceptance as needed. The practical outcome is a traceable account of what the log reports, including what it does not report, rather than an invented performance conclusion drawn from a compact array.

Technical references

  1. MAVLink common.xml: ODOMETRY pose covariance and frame fields ↗
  2. Python math: isnan, isfinite and NaN comparison behavior ↗
← All articles

Related articles

All articles ↗
LET’S TAKE FLIGHT

Your next mission
starts with a conversation.

Talk to our team