FlightTask: Weather vane cleanup

Remove the entire external yaw handler, dynamic memory allocation,
pointer passing logic. Directly instanciate the weather vane instance
in the flight tasks that support it.
This commit is contained in:
Matthias Grob
2022-06-22 14:19:28 +02:00
parent ab4e10dc26
commit 54145cedc7
15 changed files with 84 additions and 131 deletions
@@ -41,11 +41,6 @@
using namespace matrix;
FlightTaskManualPosition::FlightTaskManualPosition() : _collision_prevention(this)
{
}
bool FlightTaskManualPosition::updateInitialize()
{
bool ret = FlightTaskManualAltitude::updateInitialize();
@@ -141,14 +136,15 @@ void FlightTaskManualPosition::_updateSetpoints()
_updateXYlock(); // check for position lock
// check if an external yaw handler is active and if yes, let it update the yaw setpoints
if (_weathervane_yaw_handler != nullptr && _weathervane_yaw_handler->is_active()) {
_weathervane.update();
if (_weathervane.isActive()) {
_yaw_setpoint = NAN;
// only enable the weathervane to change the yawrate when position lock is active (and thus the pos. sp. are NAN)
if (PX4_ISFINITE(_position_setpoint(0)) && PX4_ISFINITE(_position_setpoint(1))) {
// vehicle is steady
_yawspeed_setpoint += _weathervane_yaw_handler->get_weathervane_yawrate();
_yawspeed_setpoint += _weathervane.getWeathervaneYawrate();
}
}
}