xtf2orientation
Overview
xtf2orientation extracts asynchronous vessel attitude records (XTF_HEADER_ATTITUDE, packet ID 3) and optional Applanix POS/MV raw navigation/attitude records (XTF_HEADER_POS_RAW_NAVIGATION, packet ID 107) from an XTF file and writes them to binary OMG-HDCS .orientation (and .orientation.POSMV) files. It includes options for scaling or shifting roll and pitch, shifting timestamps, unwrapping midnight millisecond rollovers, and splitting output files across large time gaps.
Usage
xtf2orientation [OPTIONS] -xtf <input.xtf> -omg <omgfile.orientation>
CLI Options
| Flag | Arguments | Default | Description |
|---|---|---|---|
-xtf | <input.xtf> | Required | Path to the input .xtf file (automatically uses <basename>.idx if available). |
-omg | <omgfile.orientation> | Required | Path to the output OMG .orientation file (also writes <omgfile.orientation>.POSMV if packet ID 107 records exist). |
-roll_scale | <factor> | 1.0 | Multiply roll values by <factor> (use -1 to invert roll sign). |
-pitch_scale | <factor> | 1.0 | Multiply pitch values by <factor> (use -1 to invert pitch sign). |
-roll_shift | <degrees> | 0.0 | Add <degrees> offset to roll after scaling: (Roll * roll_scale + roll_shift). |
-pitch_shift | <degrees> | 0.0 | Add <degrees> offset to pitch after scaling: (Pitch * pitch_scale + pitch_shift). |
-time_shift | <seconds> | 0.0 | Apply an additive time shift (in seconds) to baseTime. |
-unwrap_day | None | Off | Apply modulo 86400000 ms (MILLIS_PER_DAY) to xtfAttitude.TimeTag when the millisecond counter fails to reset to zero at UTC midnight. |
-check_time | <ms> | Off | Split output into numbered orientation files (<outname>_1, <outname>_2, âĻ) whenever a time gap between consecutive attitude packets exceeds <ms> milliseconds. |
-force_sync | <method_id> | Auto-detect | Force a specific XTF time synchronization method (get_xtf_synchro). |
-v | None | Off | Print every attitude packet and progress updates. |
-debug | None | Off | Enable debug diagnostics. |
How It Works
- Indexing & Synchronization: Reads
<basename>.idxor builds an XTF index viabuildXTFIndex(), auto-detects the XTF synchronization method (get_xtf_synchro()), and calculatesbaseTime + time_shift. - Standard Attitude (ID 3): Iterates through all
XTF_HEADER_ATTITUDEpackets, skips duplicate timestamps (old_time == new_time), converts roll, pitch, heave, and heading into hundredths of degrees/meters (* 100.0), applies-roll_scale,-roll_shift,-pitch_scale, and-pitch_shift, and writesOMG_HDCS_attituderecords to<outname>. - POS/MV Attitude (ID 107): If
XTF_HEADER_POS_RAW_NAVIGATIONpackets exist, writes a second attitude file<outname>.POSMVusing the same roll/pitch scale and shift parameters.
Practical Examples
1. Standard orientation extraction:
xtf2orientation -xtf line01.xtf -omg line01.orientation
2. Invert roll sign and handle midnight rollover:
xtf2orientation -roll_scale -1.0 -unwrap_day -xtf midnight_line.xtf -omg midnight_line.orientation