mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-08 03:20:35 +08:00
flight tasks: move weather vane yaw handler from Altitude to Position task
This commit is contained in:
@@ -284,12 +284,6 @@ void FlightTaskManualAltitude::_updateHeadingSetpoints()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if an external yaw handler is active and if yes, let it compute the yaw setpoints
|
||||
if (_ext_yaw_handler != nullptr && _ext_yaw_handler->is_active()) {
|
||||
_yaw_setpoint = NAN;
|
||||
_yawspeed_setpoint += _ext_yaw_handler->get_weathervane_yawrate();
|
||||
}
|
||||
}
|
||||
|
||||
void FlightTaskManualAltitude::_updateSetpoints()
|
||||
|
||||
@@ -50,11 +50,6 @@ public:
|
||||
bool updateInitialize() override;
|
||||
bool update() override;
|
||||
|
||||
/**
|
||||
* Sets an external yaw handler which can be used to implement a different yaw control strategy.
|
||||
*/
|
||||
void setYawHandler(WeatherVane *ext_yaw_handler) override { _ext_yaw_handler = ext_yaw_handler; }
|
||||
|
||||
protected:
|
||||
void _updateHeadingSetpoints(); /**< sets yaw or yaw speed */
|
||||
virtual void _updateSetpoints(); /**< updates all setpoints */
|
||||
@@ -101,9 +96,6 @@ private:
|
||||
void _respectMaxAltitude();
|
||||
|
||||
|
||||
WeatherVane *_ext_yaw_handler =
|
||||
nullptr; /**< external weathervane library, used to implement a yaw control law that turns the vehicle nose into the wind */
|
||||
|
||||
uint8_t _reset_counter = 0; /**< counter for estimator resets in z-direction */
|
||||
float _max_speed_up = 10.0f;
|
||||
float _min_speed_down = 1.0f;
|
||||
|
||||
@@ -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