Browse Source

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>
sbg
Roman 6 years ago committed by Lorenz Meier
parent
commit
ad88ef14e1
  1. 7
      src/lib/WeatherVane/WeatherVane.hpp
  2. 12
      src/lib/WeatherVane/weathervane_params.c
  3. 7
      src/modules/mc_pos_control/mc_pos_control_main.cpp

7
src/lib/WeatherVane/WeatherVane.hpp

@ -58,9 +58,7 @@ public: @@ -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: @@ -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

12
src/lib/WeatherVane/weathervane_params.c

@ -40,20 +40,12 @@ @@ -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.

7
src/modules/mc_pos_control/mc_pos_control_main.cpp

@ -606,11 +606,10 @@ MulticopterPositionControl::task_main() @@ -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 {

Loading…
Cancel
Save