mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-05 05:48:53 +08:00
FlightTaskAuto: lock yaw once within acceptance radius
This commit is contained in:
committed by
ChristophTobler
parent
72f1fca55c
commit
1f1c9fde01
@@ -256,13 +256,20 @@ void FlightTaskAuto::_set_heading_from_mode()
|
||||
}
|
||||
|
||||
if (PX4_ISFINITE(v.length())) {
|
||||
// We only adjust yaw if vehicle is outside of acceptance radius.
|
||||
// We only adjust yaw if vehicle is outside of acceptance radius. Once we enter acceptance
|
||||
// radius, lock yaw to current yaw.
|
||||
// This prevents excessive yawing.
|
||||
if (v.length() > NAV_ACC_RAD.get()) {
|
||||
_compute_heading_from_2D_vector(_yaw_setpoint, v);
|
||||
_yaw_lock = false;
|
||||
} else {
|
||||
if (!_yaw_lock) {
|
||||
_yaw_setpoint = _yaw;
|
||||
_yaw_lock = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
_yaw_lock = false;
|
||||
_yaw_setpoint = NAN;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user