diff --git a/src/modules/vtol_att_control/standard.cpp b/src/modules/vtol_att_control/standard.cpp index b4eafaa044..0247a63d73 100644 --- a/src/modules/vtol_att_control/standard.cpp +++ b/src/modules/vtol_att_control/standard.cpp @@ -75,7 +75,7 @@ Standard::~Standard() { } -int +void Standard::parameters_update() { float v; @@ -122,13 +122,10 @@ Standard::parameters_update() - return OK; } void Standard::update_vtol_state() { - parameters_update(); - /* After flipping the switch the vehicle will start the pusher (or tractor) motor, picking up * forward speed. After the vehicle has picked up enough speed the rotors shutdown. * For the back transition the pusher motor is immediately stopped and rotors reactivated. diff --git a/src/modules/vtol_att_control/standard.h b/src/modules/vtol_att_control/standard.h index 33fbd5d0f9..ca605817b1 100644 --- a/src/modules/vtol_att_control/standard.h +++ b/src/modules/vtol_att_control/standard.h @@ -110,7 +110,6 @@ private: void set_max_mc(unsigned pwm_value); - int parameters_update(); - + virtual void parameters_update(); }; #endif diff --git a/src/modules/vtol_att_control/tailsitter.cpp b/src/modules/vtol_att_control/tailsitter.cpp index ebbf16f509..dea8396fbe 100644 --- a/src/modules/vtol_att_control/tailsitter.cpp +++ b/src/modules/vtol_att_control/tailsitter.cpp @@ -81,7 +81,7 @@ Tailsitter::~Tailsitter() } -int +void Tailsitter::parameters_update() { float v; @@ -117,13 +117,10 @@ Tailsitter::parameters_update() if (_params_tailsitter.airspeed_trans < _params_tailsitter.airspeed_blend_start + 1.0f) { _params_tailsitter.airspeed_trans = _params_tailsitter.airspeed_blend_start + 1.0f; } - - return OK; } void Tailsitter::update_vtol_state() { - parameters_update(); /* simple logic using a two way switch to perform transitions. * after flipping the switch the vehicle will start tilting in MC control mode, picking up diff --git a/src/modules/vtol_att_control/tailsitter.h b/src/modules/vtol_att_control/tailsitter.h index 456efab568..aa0a225b58 100644 --- a/src/modules/vtol_att_control/tailsitter.h +++ b/src/modules/vtol_att_control/tailsitter.h @@ -122,7 +122,7 @@ private: /** * Update parameters. */ - int parameters_update(); + virtual void parameters_update(); }; #endif diff --git a/src/modules/vtol_att_control/tiltrotor.cpp b/src/modules/vtol_att_control/tiltrotor.cpp index a3a4a36339..d6666ab93f 100644 --- a/src/modules/vtol_att_control/tiltrotor.cpp +++ b/src/modules/vtol_att_control/tiltrotor.cpp @@ -75,7 +75,7 @@ Tiltrotor::~Tiltrotor() } -int +void Tiltrotor::parameters_update() { float v; @@ -128,8 +128,6 @@ Tiltrotor::parameters_update() if (_params_tiltrotor.airspeed_trans < _params_tiltrotor.airspeed_blend_start + 1.0f) { _params_tiltrotor.airspeed_trans = _params_tiltrotor.airspeed_blend_start + 1.0f; } - - return OK; } int Tiltrotor::get_motor_off_channels(int channels) @@ -154,7 +152,6 @@ int Tiltrotor::get_motor_off_channels(int channels) void Tiltrotor::update_vtol_state() { - parameters_update(); /* simple logic using a two way switch to perform transitions. * after flipping the switch the vehicle will start tilting rotors, picking up diff --git a/src/modules/vtol_att_control/tiltrotor.h b/src/modules/vtol_att_control/tiltrotor.h index 041cbf536f..91b938eaf3 100644 --- a/src/modules/vtol_att_control/tiltrotor.h +++ b/src/modules/vtol_att_control/tiltrotor.h @@ -133,7 +133,7 @@ private: /** * Update parameters. */ - int parameters_update(); + virtual void parameters_update(); }; #endif diff --git a/src/modules/vtol_att_control/vtol_att_control_main.cpp b/src/modules/vtol_att_control/vtol_att_control_main.cpp index 9ad050645e..f63363ad2f 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -564,6 +564,11 @@ VtolAttitudeControl::parameters_update() _params.fw_min_alt = v; + // update the parameters of the instances of base VtolType + if (_vtol_type != nullptr) { + _vtol_type->parameters_update(); + } + return OK; } diff --git a/src/modules/vtol_att_control/vtol_type.h b/src/modules/vtol_att_control/vtol_type.h index 4adf118b83..effe4af07d 100644 --- a/src/modules/vtol_att_control/vtol_type.h +++ b/src/modules/vtol_att_control/vtol_type.h @@ -139,6 +139,8 @@ public: mode get_mode() {return _vtol_mode;}; + virtual void parameters_update() = 0; + protected: VtolAttitudeControl *_attc; mode _vtol_mode;