mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 09:43:34 +08:00
flight tasks: move weather vane yaw handler from Altitude to Position task
This commit is contained in:
@@ -147,6 +147,13 @@ void FlightTaskManualPosition::_updateXYlock()
|
||||
void FlightTaskManualPosition::_updateSetpoints()
|
||||
{
|
||||
FlightTaskManualAltitude::_updateSetpoints(); // needed to get yaw and setpoints in z-direction
|
||||
|
||||
// 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()) {
|
||||
_yaw_setpoint = NAN;
|
||||
_yawspeed_setpoint += _weathervane_yaw_handler->get_weathervane_yawrate();
|
||||
}
|
||||
|
||||
_thrust_setpoint.setAll(NAN); // don't require any thrust setpoints
|
||||
_updateXYlock(); // check for position lock
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ public:
|
||||
bool activate() override;
|
||||
bool updateInitialize() override;
|
||||
|
||||
/**
|
||||
* Sets an external yaw handler which can be used to implement a different yaw control strategy.
|
||||
*/
|
||||
void setYawHandler(WeatherVane *yaw_handler) override { _weathervane_yaw_handler = yaw_handler; }
|
||||
|
||||
protected:
|
||||
void _updateXYlock(); /**< applies position lock based on stick and velocity */
|
||||
void _updateSetpoints() override;
|
||||
@@ -65,4 +70,8 @@ protected:
|
||||
private:
|
||||
float _velocity_scale{0.0f}; //scales the stick input to velocity
|
||||
uint8_t _reset_counter{0}; /**< counter for estimator resets in xy-direction */
|
||||
|
||||
WeatherVane *_weathervane_yaw_handler =
|
||||
nullptr; /**< external weathervane library, used to implement a yaw control law that turns the vehicle nose into the wind */
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user