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:
Roman
2018-09-18 20:24:02 +02:00
committed by Lorenz Meier
parent ee5007e886
commit ad88ef14e1
3 changed files with 7 additions and 19 deletions
@@ -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 {