mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 00:30:50 +08:00
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:
1 parent
745d4c4c8a
commit
5df4249fe4
1 file changed
+14
-1
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user