ardupilot
ardupilot copied to clipboard
DroneCAN GPS: Satellite count (num_sats) zeroed when no fix received
Bug report
Issue details
satellites_visible in GPS2_RAW is always zero for DroneCAN GPS2.
When using a DroneCAN device for GPS2, the satellites_visible field in the GPS2_RAW MAVLink topic consistently reports zero, even when a non-zero satellite count is provided in the simulated gnss.Fix2 message.
Version ArduCopter 4.5.7 (it is also present upstream)
Steps to Reproduce:
- Configure the secondary GPS as a DroneCAN device in SITL.
- Simulate a
gnss.Fix2message with a non-zerosats_usedvalue. - Send the simulated
gnss.Fix2message through a virtual CAN device to the DroneCAN GPS2. - Observe the
satellites_visiblefield of theGPS2_RAWMAVLink topic.
Expected Behavior:
The satellites_visible field in GPS2_RAW should reflect the sats_used value from the received gnss.Fix2 message, even if a full fix is not yet available.
Observed Behavior:
The satellites_visible field in GPS2_RAW remains zero.
Root Cause Analysis:
A preliminary analysis of AP_GPS/AP_GPS_DroneCAN.cpp (line 336) indicates that gnss.Fix2 messages are not processed unless a valid fix is present. This results in the num_sats variable being zeroed out.
Impact: This behavior specifically affects the DroneCAN GPS driver and does not apply to other GPS input methods, which correctly report satellite counts even without a full fix. This can hinder debugging and accurate satellite visibility monitoring when using DroneCAN GPS.
@fsaulo just to be sure here - you are aware that Fix2 is used by all GPSs, not just the second one, right? It's not "fix for second GPS", it's "second generation of DroneCAN message to convey GPS data because we completely screwed up the first generation message".
ie. however this is working for the second GPS should apply just the same for the first GPS.
Hi @peterbarker, thanks for taking a look at this, I really appreciate it.
[...] you are aware that Fix2 is used by all GPSs, not just the second one, right? It's not "fix for second GPS", it's "second generation of DroneCAN message to convey GPS data because we completely screwed up the first generation message".
Yes, I'm aware. I realize now that I mentioned GPS2_RAW so emphatically, but to clarify, I was just referring to this particular experiment (minimal reproducible example).