mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 20:23:34 +08:00
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user