ArduPilot:master
← Ryanf55:gsof-bitmask-flexible-parser
opened 08:28AM - 04 Dec 24 UTC
# Purpose
Refactor the GSOF parser to instead return a bitmask of which packe…ts were parsed. Compared to before, where we used a counter for packets, which was not robust to duplicate packets, or flexible to different sets of packets. It now mirrors more commonly accepted ways of parsing such as in the inertial labs EAHRS by using a Bitmask to keep track of received packets.
The upcoming EAHRS uses this to keep track of the **time_ms** of each required packet, and only reports `healthy` when all tracked packets have arrived recently.
# Details
* Removed unused debug macro
* Clean up docs
* The GPS driver's expected packets now has to be set at runtime, since you can't initialize an AP bitmask at compile time
# Behavioral changes
The GSOF GPS driver expects packets 1,2,8,9,12 enabled.
Previously, if it received packets [1,1,1,1,1] all in a row, the parser would return success, which is terrible behavior because it's missing important data. Now, it fails. This is the main improvement.
Previously, if received packets [1,2,8,9,12, **18**] (ie, unexpected unparsed data), the parser would fail. It still fails, but now we can easily change the behavior.
Because the driver is in control of configuration, we only expect data that was configured.
# Next Up
The upcoming Trimble External AHRS will re-use this parser, but with different packets.
See https://github.com/ArduPilot/ardupilot/compare/master...Ryanf55:ardupilot:27033-gsof-add-eahrs-driver?expand=1 for a preview.
# Testing Performed
* Autotest covers GSOF quite well, including configuration
* Run the SITL driver per the instructions in AP_GPS_GSOF.cpp and fly around. Ensure the EKF tracks as expected by observing a stable loiter.
Run the unit test, uncommenting the skip line.
```bash
ryan@ryan-thinkpad:~/Dev/ardupilot_ws/src/ardupilot$ ./build/sitl/tests/test_gsof
[==========] Running 2 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 2 tests from AP_GSOF
[ RUN ] AP_GSOF.incomplete_packet
[ OK ] AP_GSOF.incomplete_packet (0 ms)
[ RUN ] AP_GSOF.packet1
[ OK ] AP_GSOF.packet1 (0 ms)
[----------] 2 tests from AP_GSOF (0 ms total)
[----------] Global test environment tear-down
[==========] 2 tests from 1 test suite ran. (0 ms total)
[ PASSED ] 2 tests.
```