feat(land_detector): detect movement from the aided velocity

The IMU tests cannot see motion at constant speed, which an aided
velocity estimate does.
This commit is contained in:
bresch authored and Mathieu Bresciani committed 2026-11-18 11:05:45 +01:00
1 parent 745d4c4c8a
commit 5df4249fe4
1 file changed
+14 -1
+14 -1
View File
@@ -136,7 +136,20 @@ void LandDetector::Run()
}
}
_vehicle_local_position_sub.update(&_vehicle_local_position);
if (_vehicle_local_position_sub.update(&_vehicle_local_position)) {
// Catches constant velocity motion where the acceleration and vibration checks would fail.
static constexpr float kAidedVelocityMax = 1.f;
static constexpr float kAidedVelocityStdDevMax = 5.f;
const matrix::Vector2f velocity_xy{_vehicle_local_position.vx, _vehicle_local_position.vy};
const float velocity_threshold = math::max(kAidedVelocityMax, kAidedVelocityStdDevMax * _vehicle_local_position.evh);
if (_vehicle_local_position.v_xy_valid && !_vehicle_local_position.dead_reckoning
&& velocity_xy.longerThan(velocity_threshold)) {
_time_last_move_detect_us = _vehicle_local_position.timestamp_sample;
}
}
_vehicle_status_sub.update(&_vehicle_status);
_update_topics();