NiVO / BY TECHNOGISGermany · Indonesia
Attitude units tutorial

MAVLink ATTITUDE Units: Keep Angles and Angular Speeds Separate in a Drone Log Review

Convert constructed decoded ATTITUDE angles and angular speeds from radians to degrees while preserving field names, rate units, and the limits of a unit-only comparison.

MAVLink ATTITUDE Units: Keep Angles and Angular Speeds Separate in a Drone Log Review

Identify the quantity before relabeling a telemetry column

A log export can place roll, pitch, yaw, and their named angular-speed fields next to one another. Similar numbers or repeated labels do not make those columns interchangeable. An angle describes an orientation parameter, while angular speed has an additional time dimension. A report that labels both simply degrees conceals that distinction even if it used the correct numerical conversion factor. Begin a drone-log review by preserving the original message identity, exact field names, and units before comparing a spreadsheet or dashboard.

This tutorial converts two invented triples of already decoded MAVLink ATTITUDE values. It does not communicate with an aircraft, parse a packet, reconstruct an orientation, or establish what a NiVO flight controller records. The catalogue photograph provides separate product context. The local function converts angle units and angular-speed units into explicitly different output dictionaries. Its result is a reproducible unit trace, not a measurement of an actual maneuver, a flight-limit recommendation, a calibration result, or evidence about survey accuracy.

Read angle and rate units from the actual message definition

The MAVLink common definition lists roll, pitch, and yaw in radians and rollspeed, pitchspeed, and yawspeed in radians per second. ATTITUDE also carries a boot-time timestamp and specifies an aeronautical frame and rotation convention. This example preserves the distinction between its six named numeric fields while leaving the timestamp and full frame interpretation to separate review. It does not treat the word attitude as permission to substitute a quaternion array, a generic heading value, or a similarly named field from another message.

For constructed angles of pi divided by two, negative pi divided by four, and pi radians, the converted values are ninety, negative forty-five, and one hundred eighty degrees. For constructed angular speeds of pi divided by six, zero, and negative pi divided by three radians per second, the converted rates are thirty, zero, and negative sixty degrees per second. The same angular conversion factor appears in both calculations, but the rate outputs retain per-second units. No duration or actual change in attitude is inferred.

NiVO VTOL V7 with a white fuselage, lift rotors, and yellow wing tips
NiVO VTOL V7 with a white fuselage, lift rotors, and yellow wing tips.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.

Convert two explicit triples without changing their meaning

Run the following Python function locally with separate three-element lists or tuples. It accepts finite integers or floats, rejects Booleans and other types, restricts the angle inputs to the documented interval from negative pi through positive pi, and applies a generous explicit teaching bound to the rates. That rate bound is a local arithmetic profile, not an aircraft operating limit or a new MAVLink requirement. Unsupported or inconsistent input produces an error rather than a silent unit guess.

The function returns the original numeric triples and dictionaries with explicit degree or degree-per-second suffixes. Python math.degrees performs the angular conversion. The code does not wrap yaw into a zero-to-three-hundred-sixty range, swap axes, reverse signs, rotate a frame, normalize an orientation, or integrate angular speeds. Floating-point values may print with small representation differences, so tests should use an appropriate numerical tolerance. A plausible converted number cannot establish that a source column really contained radians in the first place.

import math

def convert_attitude_units(angles_rad, speeds_rad_s):
    groups = (angles_rad, speeds_rad_s)
    if any(not isinstance(g, (list, tuple)) or len(g) != 3 for g in groups):
        raise ValueError("Expected separate angle and angular-speed triples")
    if any(type(x) not in (int, float) or abs(x) > 1000000 or not math.isfinite(x)
           for g in groups for x in g):
        raise ValueError("Expected finite numeric values within the teaching bound")
    if any(abs(x) > math.pi for x in angles_rad):
        raise ValueError("ATTITUDE angle profile requires -pi through +pi")
    names = ("roll", "pitch", "yaw")
    angle_values = tuple(angles_rad)
    rate_values = tuple(speeds_rad_s)
    return {"raw_angles_rad": angle_values, "raw_speeds_rad_s": rate_values,
            "angles_deg": {name + "_deg": math.degrees(x)
                           for name, x in zip(names, angle_values)},
            "speeds_deg_s": {name + "speed_deg_s": math.degrees(x)
                             for name, x in zip(names, rate_values)}}

# Constructed decoded values; no orientation transformation or rate integration.
print(convert_attitude_units((math.pi / 2, -math.pi / 4, math.pi),
                             (math.pi / 6, 0, -math.pi / 3)))

Test sign, field order, and dimensional labels independently

Test zero, positive and negative angles, both angle endpoints, and a triple with different values in every position. Distinct values expose accidental field swaps that an all-zero fixture would hide. Vary only one rate while holding the angles fixed, then vary only one angle while holding the rates fixed. The unrelated output dictionary should remain unchanged. Preserve raw input tuples and confirm that neither supplied list is edited during conversion. These checks isolate the function behavior without asserting a real attitude or motion state.

Also test nonfinite values, a Boolean, a text number, a missing component, and angles outside the selected message profile. Do not silently interpret a value such as ninety as radians merely because it can be converted mathematically; in this angle profile it is rejected. Conversely, a small number might be either degrees or radians in an undocumented export. Numeric magnitude alone does not identify the unit. Establish the actual exporter and field definition before passing an ambiguous column into this function.

Keep frame conventions and time-dependent reasoning separate

Converting radians to degrees does not rotate the reference frame. A comparison with a model viewer, camera orientation, or another telemetry format still needs the relevant axes, rotation order, intrinsic or extrinsic convention, and transform direction. The message documentation supplies context that a complete integration must preserve. This narrow example deliberately does not implement those transformations. Do not claim two orientation representations agree merely because three converted numbers happen to look similar in a single constructed example.

An angular-speed value is also not an angle increment. A change-over-time calculation needs a time interval and an appropriate model for the quantities being integrated. This function accepts neither, and it does not establish a general relationship between the named angular-speed fields and derivatives of displayed Euler angles. Keep the original message semantics and timing evidence attached to the record rather than multiplying a rate by an assumed sampling period and labeling the result a verified attitude change.

For several records, preserve sender and session boundaries as well as timestamp interpretation. Do not combine an angle triple from one row with rate values from another into an apparently simultaneous state without documenting that association. A unit conversion cannot repair missing timing or prove continuity between observations. If a plotted line crosses an angle display boundary, investigate the chosen display policy separately; the code intentionally preserves the supplied signed angles instead of inventing an unwrapping or interpolation rule.

Deliver the unit trace with its unresolved integration questions

A useful handoff retains the unchanged log identity, record position, sender, selected message definition, exporter and reader versions, original six fields, explicit units, timestamp interpretation, and any separately verified frame transformation. Include an independently checked nonzero example with distinct angles and rates. If another report differs, compare the quantity and unit labels before investigating a physical maneuver. An apparently large discrepancy may originate in a column contract, while a correct conversion still leaves the underlying decoding and synchronization questions unanswered.

In a NiVO-related telemetry discussion, this method explains why ninety degrees and thirty degrees per second belong in different columns even when both came from a radians-based input. It makes no claim about actual aircraft behavior, firmware, flight limits, or customer logs. The useful result is a reproducible, dimensionally labeled conversion that keeps field identity, frame context, and timing questions visible for the independent checks required by the real task.

Technical references

  1. MAVLink ATTITUDE: angle/rate fields and frame convention ↗
  2. MAVLink primary common.xml definitions ↗
  3. Python math.degrees: angular unit conversion ↗
← All articles

Related articles

All articles ↗
LET’S TAKE FLIGHT

Your next mission
starts with a conversation.

Talk to our team