Skip to content
See packages

Engineering

Reference frames in sensor data: relative to what?

What to record beside every reading so two runs can still be compared a year later.

Computing America Hardware. Custom hardware for physical automation and monitoring.

Send the exports
5 min readComputing America
A surveying instrument on a tripod on an empty vehicle test track, a compass on its head.

In short

  • Position relative to wherever the device powered on is consistent within a run and can't be compared across runs.
  • Left implicit, each of the four frames is decided by whichever component was written first, and none of the failures raises an error.
  • A reference frame and calibration traceability are different requirements. A measurement needs a stated frame and a calibration chain with stated uncertainty.
  • Timestamp at the sensor. A timestamp applied at the collector silently encodes queue depth as measurement error, and it stays monotonic while it does, so nothing looks wrong.
  • When the defect is in somebody else's firmware, a local workaround is faster, but it becomes part of your frame and the next owner won't know it's there.

A sensor measurement means something only relative to a frame, which has four parts: spatial (an origin and axes), temporal (a clock), scale (units) and identity (which device). Record all four with every reading, because a frame that wasn't written down at capture can't be recovered later.

On an autonomous vehicle test range, the vehicle reported position and rotation continuously, relative to wherever it sat when it powered on. Every run was smooth and internally consistent, and two runs of the same maneuver had nothing in common. We expressed position and rotation against magnetic north, a shared heading reference, so the axes of every run point the same way. Magnetic north is shared but not fixed: declination changes with location and time (opens in a new tab), and hard-iron and soft-iron biases from nearby metal degrade a magnetometer's heading (opens in a new tab) until they are compensated.

Fig. 1
  1. Run A

    Own power-on origin and axes

    • To Magnetic north
  2. Run B

    Own power-on origin and axes

    • To Magnetic north
  3. Magnetic north

    A shared heading reference

    • To Axes agree across runs
  4. Axes agree across runs

    Once declination by place and date, and hard-iron and soft-iron bias, are corrected

Two runs with their own origins share axes only once both are turned to magnetic north and corrected for declination and magnetometer bias.

SourceComputing America case study: comparable position data for an autonomous vehicle test range.

A system without its frames looks correct on the day and fails when someone compares two of its outputs, possibly months later. For a robot or any moving platform, that comparison is the point of the data.

Four frames, and what an implicit one costs

Unstated, each frame is decided by whichever component was written first, and the rest of the system inherits the choice. The table gives the cost of each. None of the four failures produces an error, an alarm or a gap.

FrameThe question it answersWhat an implicit answer costs
SpatialRelative to what origin, along which axes, in which handednessRuns that can't be compared to each other, to a map, or to the physical thing they happened on. The reference existed only at capture time.
TemporalWhich clock, at what resolution, stamped whereTwo sensors that disagree by an amount nobody can characterize, because one is stamped at the device and one on arrival.
ScaleRaw counts or engineering units, and where the conversion happensA calibration constant applied twice or not at all, found when a value is off by exactly the gain. Worse, a conversion that lives only in a script, so history can't be re-derived when the constant is corrected.
IdentityWhich physical device produced this, and does its id survive replacementA sensor swapped under warranty, the id reused, and months of data attributed to a device that is no longer installed.
The four frames every measurement carries

Stamp time at the sensor

The common architecture stamps a reading when it reaches the collector. It's easy and needs no clock on the device. It also records when the collector got round to the reading, so queue depth is silently encoded as measurement error.

And the result stays monotonic, so nothing looks corrupted. The error grows with load: smallest when nothing is happening and largest during the events the sensing was installed to capture. Measure the microsecond relationship between two signals through a shared queue under load and you can produce a confident, repeatable, wrong answer about which came first.

Clock discipline belongs to the instrument. A clock set once at commissioning drifts, and nothing downstream can tell. Pick the sync protocol for the precision the analysis needs. NTP can usually hold time to within tens of milliseconds over the public Internet and better than one millisecond on a local network under ideal conditions (opens in a new tab), which orders events a second apart but not a microsecond relationship between two signals. For that, use IEEE 1588 Precision Time Protocol, whose accuracy can be sub-microsecond (opens in a new tab) on a local network when the devices and switches timestamp packets in hardware. That requirement lands on the hardware design, and it's cheaper to notice while the enclosure is still on the bench.

A frame is not a calibration chain

Metrology has the vocabulary for part of what to write down. NIST defines metrological traceability (opens in a new tab) as a property of a measurement result, not of an instrument: the result can be related to a reference through a documented unbroken chain of calibrations, each contributing to the measurement uncertainty. That is a different requirement from a reference frame. A measurement needs both a stated frame (relative to what origin, axes and clock) and a calibration chain with stated uncertainty. A recorded frame doesn't make a number traceable, and a calibrated sensor doesn't say which frame its numbers are in.

When the defect is in somebody else's firmware

Sensing work is work against a device somebody else built, and eventually the device is wrong. On that vehicle platform it was pulse-width modulation faults that surfaced only under real test conditions, not on a bench or in the vendor's lab.

Compensating locally is fast: you know the shape of the defect and correct for it in your own layer. But you've folded the vendor's bug into your frame, and it's documented nowhere the vendor can see. The day the vendor ships a fix, your correction is applied to data that no longer needs it and every reading is wrong in a new direction. We diagnosed the faults and contributed the fix upstream. That was slower than a local correction, and the system can now be explained by reading the two things it's made of.

The test to run before anything is built

Take two measurements: one from today, one from a year out, after the device has been replaced under warranty and the firmware updated twice. Can they be plotted on the same axes, and could anybody defend the plot? If not, name the missing frame. Then:

  1. 1.Write each frame in the record, beside the value it applies to. Someone knowing it doesn't count.
  2. 2.Say what physical thing the origin is attached to and what happens if it moves. An origin defined by a device's power-on state changes with every power cycle.
  3. 3.Put the unit conversion in the record beside the value, so a corrected constant can be applied to history.
  4. 4.Decide now what happens when a device is replaced, and give the new unit a new id. Reusing one can corrupt a year of trend analysis.
  5. 5.Record the firmware version and the id of any correction you apply beside the value, so a workaround can be found and removed when the vendor ships the fix.

Sources

  1. 1.Metrological Traceability: Frequently Asked Questions and NIST Policy (opens in a new tab), NIST

Next step

Send us two runs.

Two exports of the same thing measured on different days, or one export and the schema behind it. We will tell you which of the four frames is missing and whether it can still be recovered.

Reply
A person replies, not a sequence: within one business day, from someone who would be on the engagement.

Packages

Start with a package

Four packages, each with its price on the page. Pick one and buy it online.

Billing