feat(gps): add support for UBX_MSG_MON_SPAN - #28173
Conversation
194b30a to
7002680
Compare
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 1312 byte (0.07 %)]px4_fmu-v6x [Total VM Diff: 1416 byte (0.07 %)]Updated: 2026-09-10T16:05:50 |
7002680 to
6735917
Compare
6735917 to
ca7f0ff
Compare
a5a121c to
e529a5d
Compare
|
Note Claude review on behalf of @dakejahl Continuing #28173 (comment) at top level, since it touches To be clear about what I'm asking for: I'm not proposing we rename the topics. Someone opening On "we can't create an enum in general": the line you quoted from X20 2.02 — "The band which the RF block represents is subject to product configuration" — is the description of And F9 HPG 1.51 does document the mapping — it's just inside the
"L2 or L5 depending on product configuration" is ZED-F9P (L1/L2) vs ZED-F9P-15B (L1/L5), and the driver already distinguishes those two: ConcretelyMON-SPAN — derive from MON-RF — Band from center frequency (ITU RNSS allocations):
Two smaller things that fall out of this
Unrelated, but while we're in hereX20 2.x adds |
|
Maybe simpler to skip the enum and just use |
|
I pushed the changes for |
|
Claude review on behalf of @dakejahl RAM: the MON-SPAN buffer is unconditional. A MON-SPAN is configured at navigation rate, not 1 Hz.
The comment above Logger: the spectrum topics should be requested conditionally, not made optional. Gate the six spectrum entries on the param instead; int32_t gps_ubx_spectrum = 0;
param_get(param_find("GPS_UBX_SPECTRUM"), &gps_ubx_spectrum);
if (gps_ubx_spectrum > 0) {
add_topic_multi("sensor_gnss_spectrum_block0", 5000, 2);
// ...
}The RF entries can stay unconditional since MON-RF is always enabled. ( Asymmetric receivers drop the secondary's high blocks. If the main reports fewer RF blocks than the secondary (main F9P = 2, secondary X20 = 3), MON-SPAN is only enabled on UART1. Every other message uses Collapse the six publish functions. Bin centre formula is off by half a bin. SensorGnssSpectrum.msg:6 gives |
|
On RAM / Kconfig: I haven't found time yet to implement it. Hopefully I can do it tomorrow 🤞 On the configured frequency: I'm pretty sure that when we checked on the oscilloscope that we only got one message (per block) per second. To check, I put logging at unlimited frequency: Logger: I gated it behind the param, will also gate it behind Kconfig on top. Asymmetric receivers drop the secondary's high blocks.: In that case put the receiver with more blocks as the main ;) I don't see an easy and clean way of handling it, and I can't test it because I'm lacking the hardware. So I'd prefer to tackle it in a follow-up PR, if you think it's worth tackling. It's not a new limitation either, as it already existed on sat_info. MON-SPAN is only enabled on UART1: I personally prefer not to activate it on all ports if they're not used, and it's also what @dagar put in PX4/PX4-GPSDrivers#115. But if there are actually people using the GPS on other ports that would also want to have the spectrum logged, we can change the code to activate it on all.
Collapse the six publish functions : Done. Indeed cleaner now 👍 Bin centre formula is off by half a bin: u-blox says to calculate it the way we do, so I would definitely keep it as is: |
|
@dakejahl I implemented the Kconfig to the best of my knowledge (which means no prior knowledge 😬) One point I didn't know in particular: Is there a way to gate the parameter GPS_UBX_SPECTRUM behind this Kconfig too? Quick tests: When with it defaulting to |
b091823 to
bf95ce9
Compare
|
I rebased, updated the submodule and squashed my commits for a cleaner history. Testing on my setup with Pixhawk 6C and two F9P receivers went well. Attaching the corresponding logs. I tested once with the In particular, I checked that the center frequency of mon-rf (roughly) matches the one reported in mon-span. And that the The other fields' values seem reasonable to me, but they are harder to have a "groundtruth". Happy if we can get this merged soon! |
…roved GNSS debugging capabilities. Introduction of two new uorb messages to log the content of UBX_MSG_MON_SPAN and UBX_MON_RF on a per-band level per receiver. Gated behind Kconfig GPS_UBX_SPAN and new parameter GPS_UBX_SPECTRUM.
Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
c917898 to
0f5919c
Compare
|
I merged the submodule (PX4/PX4-GPSDrivers#222) and updated this PR to point to newest main. Also rebased this MR onto main. Good for me to merge @dakejahl. Thanks for all the inputs! |





Solved Problem
Replaces #20474
UBX_MSG_MON_SPAN has a lot of valuable information for debugging degraded GNSS reception.
Solution
Following the example of @dagar in #20474, but extending it for multi-block logging so that the data is
Changelog Entry
For release notes:
Test coverage
tbc
Context
Not advisable to run on low baudrate. The messages are big.