Commit 67db04c
committed
feat(drivers/uavcan): use GNSS PVT timestamp for EKF time alignment
Previously the DroneCAN GNSS driver left sensor_gps.timestamp_sample at 0,
which caused VehicleGPSPosition to fall back to timestamp - SENS_GPS_DELAY
(a fixed 110 ms guess). The actual PVT solution timestamp from Fix2.gnss_timestamp
was only consumed for system clock setting and the PPS path.
Map the UTC PVT timestamp to HRT directly using an asymmetric filter on
(UTC_PVT - HRT_recv): snap up to a new max immediately (tracks low-latency
observations and growing UTC-HRT delta), and decay slowly between observations
at 100 us/s (~100 ppm) so the offset can also track a shrinking delta when
HRT runs faster than UTC. Without the decay, long-flight clock drift in the
HRT-faster-than-UTC direction would accumulate unbounded bias.
Clamp the resulting timestamp_sample to strictly less than timestamp so that
VehicleGPSPosition does not mistake a snap-up event for an unset value.
PpsTimeSync still overrides this when PPS hardware is wired.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>1 parent 9ca5cf3 commit 67db04c
2 files changed
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
508 | 548 | | |
509 | 549 | | |
510 | 550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
154 | 162 | | |
155 | 163 | | |
156 | 164 | | |
| |||
0 commit comments