Skip to content

feat: add XDR (Transducer Measurements) sentence parser#164

Open
amoutiers wants to merge 1 commit intoAeroRust:mainfrom
amoutiers:feat/xdr-sentence
Open

feat: add XDR (Transducer Measurements) sentence parser#164
amoutiers wants to merge 1 commit intoAeroRust:mainfrom
amoutiers:feat/xdr-sentence

Conversation

@amoutiers
Copy link
Copy Markdown

Summary

Adds support for XDR sentences (Transducer Measurements), resolving part of #54.

XDR is a generic container sentence widely used in marine instrumentation. It carries variable-length groups of transducer readings — barometric pressure, air temperature, rudder angle, humidity, battery voltage, engine data, and more — from a single sentence.

Format

$--XDR,a,x.x,a,c--c[,a,x.x,a,c--c]*hh<CR><LF>

Each measurement is a group of 4 fields (type, value, units, name), repeatable.

Implementation

  • XdrData struct containing a heapless::Vec<XdrMeasurement, 8>
  • XdrMeasurement struct with transducer_type (char), value (f64), units (char), name (ArrayString<16>)
  • Full nom-based parser handling variable-length measurement groups
  • Feature-gated behind XDR (included in the other category alongside HDT, MDA, MWV, TXT, ZDA)

Real-world edge cases handled

Tested against real NMEA logs from B&G, NKE, Airmar, Calypso, and SignalK sources:

  • Empty name fields — e.g., $WIXDR,C,022.0,C,,*52 (Calypso anemometer)
  • Empty unit fields — e.g., $IIXDR,G,200,,ENGHRS*3E (engine hours)
  • Incomplete trailing quadruplets — parser stops gracefully instead of erroring
  • Multiple measurements per sentence — up to 8 groups (B&G H5000 sends 5)
  • Negative values — e.g., rudder angle A,-2.3,D,RUDDER
  • Various talker IDs — II, WI, YX, SD, HC, ER all observed in the wild

Transducer types observed in practice

Type Meaning Common use
A Angular displacement Pitch, roll, heel, rudder
C Temperature Air temp, engine coolant
D Depth Hi/lo frequency sounder
E Fluid level Fuel, freshwater (v4.11)
G Generic Magnetic field, engine hours
H Humidity Relative humidity
I Current Battery amperes
P Pressure Barometric, oil pressure
T Tachometer Engine RPM
U Voltage Battery, alternator

Motivation

I'm building a sailing navigation app and needed XDR parsing for on-board weather stations and autopilot transducers. Figured I'd contribute it upstream rather than maintain a custom parser. Happy to follow up with other marine sentences (MWD, RSA, ROT, HDG, etc.) if there's interest.

Partially addresses #54.

XDR is a generic container sentence widely used in marine instrumentation.
It carries variable-length groups of transducer readings — barometric
pressure, air temperature, rudder angle, humidity, battery voltage,
engine data, and more.

Each measurement is a group of 4 fields (type, value, units, name),
repeatable up to 8 times in a single sentence.

Handles real-world edge cases:
- Empty name fields (Calypso anemometer)
- Empty unit fields (engine hours)
- Incomplete trailing quadruplets (graceful stop)
- Multiple measurements per sentence (B&G H5000, Airmar 200WX)

Feature-gated behind XDR, included in the 'other' category.

Partially addresses AeroRust#54.
@amoutiers amoutiers force-pushed the feat/xdr-sentence branch from d621280 to a31220e Compare April 3, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant