mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-22 17:57:35 +08:00
weathervane: use a single parameter to enable
- in auto mode we always run weather vane - in manual model we just use it in position control mode Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
@@ -58,9 +58,7 @@ public:
|
||||
|
||||
bool is_active() {return _is_active;}
|
||||
|
||||
bool manual_enabled() { return _wv_manual_enabled.get(); }
|
||||
|
||||
bool auto_enabled() { return _wv_auto_enabled.get(); }
|
||||
bool weathervane_enabled() { return _wv_enabled.get(); }
|
||||
|
||||
void update(const matrix::Quatf &q_sp_prev, float yaw);
|
||||
|
||||
@@ -75,8 +73,7 @@ private:
|
||||
bool _is_active = true;
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamBool<px4::params::WV_MAN_EN>) _wv_manual_enabled,
|
||||
(ParamBool<px4::params::WV_AUTO_EN>) _wv_auto_enabled,
|
||||
(ParamBool<px4::params::WV_EN>) _wv_enabled,
|
||||
(ParamFloat<px4::params::WV_ROLL_MIN>) _wv_min_roll,
|
||||
(ParamFloat<px4::params::WV_GAIN>) _wv_gain,
|
||||
(ParamFloat<px4::params::WV_YRATE_MAX>) _wv_max_yaw_rate
|
||||
|
||||
@@ -40,20 +40,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enable weathervane for manual position control mode.
|
||||
* Enable weathervane.
|
||||
*
|
||||
* @boolean
|
||||
* @group Multicopter Position Control
|
||||
*/
|
||||
PARAM_DEFINE_INT32(WV_MAN_EN, 0);
|
||||
|
||||
/**
|
||||
* Enable weathervane for auto.
|
||||
*
|
||||
* @boolean
|
||||
* @group Multicopter Position Control
|
||||
*/
|
||||
PARAM_DEFINE_INT32(WV_AUTO_EN, 0);
|
||||
PARAM_DEFINE_INT32(WV_EN, 0);
|
||||
|
||||
/**
|
||||
* Weather-vane roll angle to yawrate.
|
||||
|
||||
@@ -606,11 +606,10 @@ MulticopterPositionControl::task_main()
|
||||
// activate the weathervane controller if required. If activated a flighttask can use it to implement a yaw-rate control strategy
|
||||
// that turns the nose of the vehicle into the wind
|
||||
if (_wv_controller != nullptr) {
|
||||
if (_control_mode.flag_control_manual_enabled && _control_mode.flag_control_attitude_enabled
|
||||
&& _wv_controller->manual_enabled()) {
|
||||
_wv_controller->activate();
|
||||
|
||||
} else if (_control_mode.flag_control_auto_enabled && _wv_controller->auto_enabled()) {
|
||||
// in manual mode we just want to use weathervane if position is controlled as well
|
||||
if (_wv_controller->weathervane_enabled() && !(_control_mode.flag_control_manual_enabled
|
||||
&& !_control_mode.flag_control_position_enabled)) {
|
||||
_wv_controller->activate();
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user