AP_AHRS: publish have_velocity_source in the backend estimates

Add have_velocity_source to AP_AHRS_Backend::Estimates: true if the
backend has a ground-velocity source that is independent of airspeed
(e.g. GPS), so the value may be used for synthetic airspeed without
circularity.  DCM publishes have_gps().  It may be true while
velocity_NED_valid is false (e.g. DCM with a 2D GPS fix).
This commit is contained in:
Peter Barker
2026-09-08 13:09:20 +10:00
committed by Peter Barker
parent b7602169e1
commit d7c19195fe
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -111,6 +111,12 @@ public:
// a ground velocity in meters/second, North/East/Down
Vector3f velocity_NED;
bool velocity_NED_valid;
// true if this backend has a ground-velocity source which is
// independent of airspeed (e.g. GPS or an external INS); such
// a velocity may be used for wind estimation or synthetic
// airspeed without circularity. This may be true while
// velocity_NED_valid is false (e.g. DCM with a 2D GPS fix):
bool have_velocity_source;
// return a ground velocity in meters/second, North/East/Down
bool get_velocity_NED(Vector3f &vel) const WARN_IF_UNUSED {
if (!velocity_NED_valid) {
+2
View File
@@ -204,6 +204,8 @@ void AP_AHRS_DCM::get_results(AP_AHRS_Backend::Estimates &results)
results.accel_ef = _accel_ef;
results.velocity_NED_valid = get_velocity_NED(results.velocity_NED);
// DCM's airspeed-independent velocity source is the GPS:
results.have_velocity_source = have_gps();
// ground velocity estimate in meters/second, in North/East order
// note: velocity_NE is significantly different to results.velocity_NED.xy()!