manual_yaw: compensate for yaw estimate convergence

When the yaw estimate is converging, the controller makes the drone yaw
in order to follow the current setpoint. This is unintuitive for the
pilot and it is preferable if the drone continues to fly towards the
same physical direction.
This commit is contained in:
bresch
2023-08-30 09:56:19 +02:00
committed by Mathieu Bresciani
parent 0aa4afdbce
commit 23b31cc5fd
12 changed files with 96 additions and 18 deletions
@@ -112,6 +112,7 @@ void FlightTask::_evaluateVehicleLocalPosition()
// yaw
_yaw = _sub_vehicle_local_position.get().heading;
_unaided_yaw = _sub_vehicle_local_position.get().unaided_heading;
_is_yaw_good_for_control = _sub_vehicle_local_position.get().heading_good_for_control;
// position
@@ -218,6 +218,7 @@ protected:
matrix::Vector3f _velocity; /**< current vehicle velocity */
float _yaw{}; /**< current vehicle yaw heading */
float _unaided_yaw{};
bool _is_yaw_good_for_control{}; /**< true if the yaw estimate can be used for yaw control */
float _dist_to_bottom{}; /**< current height above ground level if dist_bottom is valid */
float _dist_to_ground{}; /**< equals _dist_to_bottom if available, height above home otherwise */