Skip to main content

Module rtx

Module rtx 

Source
Expand description

Missile Works’ RTx/GPS tracker: the .rtx file its base station’s software saves when it downloads the tracker’s fixes, and the CSV and text files the same software exports from it.

The RTx, built around a u-blox 7 receiver, keeps its fixes at 1 Hz, “~68 minutes per flight”, and sends them to a base station “at 1-Hz intervals” (RTx/GPS User Manual, firmware 1.31, Missile Works, 2016-11-26, pp2, 14); Missile Works’ mDACS software saves a download “with the .rtx file extension” and exports it “to Google Earth KML, Excel CSV, or a simple text format” (mDACS User Manual, revision 1.71, May 2024, p16), the KML read by crate::kml. Neither manual describes the files; what follows was learned from the 5 .rtx files among the project’s sample logs and the 13 exports beside them, with no other program’s source read.

The .rtx file is a .NET BinaryFormatter stream, the layout Microsoft publishes as MS-NRBF ([MS-NRBF]: .NET Remoting: Binary Format Data Structure, revision 13.0, 2024-11-19), of one List<Int32>: a serialization header (§2.6.1), the list’s class record, SystemClassWithMembersAndTypes (§2.3.2.3) with its three members _items, _size and _version, a MemberReference (§2.5.3) to the items, the two counts, an ArraySinglePrimitive (§2.4.3.3) of 32-bit integers, and MessageEnd (§2.6.3). Every sample file holds the same 186 bytes up to _size, a list of 65,536 slots, and nothing after the end record. The reader takes that shape and no other: a stream that differs is refused at the first byte that does.

The words. Each slot holds a 16-bit value, but not as written: the value times 387,420,489 (3¹⁸), modulo 10⁹. The reader multiplies by 513,180,409, that multiplier’s inverse modulo 10⁹, to read it back. Three things in the files show it: the slot that holds the time of day steps by exactly 387,420,489, modulo 10⁹, from one record to the next a second later; every one of the 264,336 slots in use in the 5 files lies from 0 to 10⁹ − 1 and reads back as a value below 65,536, which a slot drawn at random from that range would do about once in 15,000; and the values read back equal the exports’ figures, field by field, on every row (cargo xtask logs compares them). A slot outside 0 to 10⁹ − 1, or one that reads back past 65,535, is refused.

The records. _size counts the slots in use, 16 a record, oldest first; the slots after them are 0. The list’s 65,536 slots hold 4,096 records, 68.3 minutes at 1 Hz, the manual’s flight. Each record is one fix, its 16 words, numbered from 0:

WordsFieldAs read
0, 1UTC Time, HHMMSSword 1 × 65,536 + word 0
2Latitude’s degrees and whole minutes, DDMM
3, 4its minutes’ five decimals, after a leading 1word 4 × 65,536 + word 3 − 100,000
5Longitude’s degrees and whole minutes, DDDMM
6, 7its minutes’ five decimals, after a leading 1word 7 × 65,536 + word 6 − 100,000
8Altitude, m
9Velocitykept as written
10VDOPkept as written
11the hemispheres: N or S in its low byte, E or W in its high
12NavStatus in its low byte, Sats in its high
13SOGkept as written
14COG, degrees
15a word the exports leave outkept as written

The leading 1 keeps a minute’s decimals’ leading zeros, as 193418 holds .93418.

Units and the second checks. The altitude is in whole meters: the RTx’s manual says its GPS altitude “is always expressed as Mean Sea Level” (p13), the KML export beside each sample file writes the word itself, as meters, on every point, and the CSV and text exports write the word × 3.280 84 ft rounded down on every row. A word can’t fall below 0: in 4 of the 5 sample files, from pads near sea level, it reads 0 for most of the fixes, as a receiver’s altitude clamped at 0 would, and a note counts those 0s. The survey (cargo xtask logs) holds the exports’ feet and meters to the words, and reports, without checking, the climb from the pad to the highest fix against the barometric altimeter flown beside the tracker: 0.98 to 1.15 times it in 4 flights. COG is a course in degrees, as a GPS receiver’s course over ground is: it lies from 0 to 359 in the sample files, and in each the median difference either way from the bearing between the fixes a second either side of it, while the tracker moves, is 1.7° to 6.9°. Velocity and SOG are kept as written: SOG runs 3.5 to 4.0 times the speed between fixes in meters a second, the median in each file, as kilometers an hour would, one of the two speed units the RTx’s display offers (p12), but no document says which unit the file holds, and feet a second would give 3.3; Velocity reads, while the rocket climbs, far more than the climb rate in meters a second, and while it falls, about the fall rate itself, a pattern no document explains. VDOP, NavStatus and Sats are numbers, and word 15, which runs from 814 to 2,272 in the sample files, is kept as written.

The clock is the GPS’s time of day, UTC, in whole seconds; the file states no date. The log’s zero is the first record’s time; each time takes the day that puts it nearest the one before it, so a time more than 12 hours before the one before is read as the next day’s, and one more than 12 hours after it, as a repeated pair written across midnight would be, as the day before’s; a log that truly skips more than 12 hours would be read a day off. Records keep the file’s order, so a time may go back: in 3 of the 5 sample files a pair of records repeats the pair before it a second back, as t, t + 1, t, t + 1. A note counts how often times go back. A time that isn’t a time of day, such as the record in one sample file whose word 1 reads 65,282 where every other reads 2, as a garbled radio packet’s might, is a gap, counted in a note.

Positions. A latitude’s or longitude’s minutes past 59, decimals that don’t start with the leading 1, a hemisphere byte other than its two letters, or a latitude past 90° or longitude past 180° make that coordinate a gap, counted in a note; so do both, where both read exactly 0, as a receiver writes before it has a fix. No sample file has either.

The exports. The CSV opens UTC Time,Latitude,Longitude,Altitude,Velocity,VDOP,NavStatus, Sats,SOG,COG; the text file, tab-separated, UTC, Lat, an empty name, Lon, an empty name, Alt, Vel, VDOP, Nav, Sats, SOG, COG, its rows ten cells, as the CSV’s. Both write the time as HHMMSS, a position either as DDMM.mmmmm and its hemisphere’s letter, such as 3259.01234N, or, in 5 of the 9 sample exports, in signed degrees cut toward zero at the sixth decimal and a degree sign, such as -106.975720°, and the altitude in whole feet, read as 0.3048 m each. Each export holds every record of its .rtx but the last, in the same order (cargo xtask logs). A row of other than ten cells, or a cell that isn’t its field’s number, is refused, naming the line; a time or a position out of range is a gap, as in the .rtx.

The record. No barometer: the primary track is empty, with a note, and every field is a channel on the clock above, as crate::fwgps reads a GPS tracker’s. The logger is Missile Works RTx; the files state no serial number, firmware, flight number or date.

Refused, the .rtx naming the byte: a stream that isn’t the list’s shape above; a _size that isn’t a whole number of records or that passes the list’s slots; a slot in use that isn’t a word, as above; a slot past _size that isn’t 0; and a file with no record whose time is a time of day.

Constants§

ALTITUDE_STEP_M
The .rtx’s altitude step, m.
EXPORT_ALTITUDE_STEP_M
The exports’ altitude step, m.

Functions§

export_format
Which RTx export a file’s text is, if either: its first line that isn’t blank is the CSV’s or the text file’s header, the names as written.
read_export
Reads an RTx CSV or text export.
read_raw
Reads an RTx .rtx file.
recognizes_raw
Whether the bytes open as an .rtx file: MS-NRBF’s serialization header, then the class record of a List<Int32> as the RTx’s software writes it.