mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 22:51:36 +08:00
mc_pos_control: use weathervane library to make vehicle turn into relative wind
Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
@@ -62,6 +62,12 @@ bool FlightTaskAutoMapper::update()
|
||||
_reset();
|
||||
}
|
||||
|
||||
// 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 = _yaw;
|
||||
_yawspeed_setpoint = _ext_yaw_handler->get_weathervane_yawrate();
|
||||
}
|
||||
|
||||
// The only time a thrust set-point is sent out is during
|
||||
// idle. Hence, reset thrust set-point to NAN in case the
|
||||
// vehicle exits idle.
|
||||
|
||||
@@ -50,6 +50,11 @@ public:
|
||||
bool activate() override;
|
||||
bool update() override;
|
||||
|
||||
/**
|
||||
* Sets an external yaw handler which can be used to implement a different yaw control strategy.
|
||||
*/
|
||||
void set_yaw_handler(WeatherVane *ext_yaw_handler) override {_ext_yaw_handler = ext_yaw_handler;}
|
||||
|
||||
protected:
|
||||
|
||||
float _alt_above_ground{0.0f}; /**< If home provided, then it is altitude above home, otherwise it is altitude above local position reference. */
|
||||
@@ -73,6 +78,9 @@ protected:
|
||||
void updateParams() override; /**< See ModuleParam class */
|
||||
|
||||
private:
|
||||
WeatherVane *_ext_yaw_handler =
|
||||
nullptr; /**< external weathervane library, used to implement a yaw control law that turns the vehicle nose into the wind */
|
||||
|
||||
void _reset(); /**< Resets member variables to current vehicle state */
|
||||
WaypointType _type_previous{WaypointType::idle}; /**< Previous type of current target triplet. */
|
||||
bool _highEnoughForLandingGear(); /**< Checks if gears can be lowered. */
|
||||
|
||||
Reference in New Issue
Block a user