From 48782723ab0c38911091764391f412e17ff0574c Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Thu, 4 May 2023 21:01:21 +0200 Subject: [PATCH] FW att controller: ecl_controller: move setter/getter implementation to header Signed-off-by: Silvan Fuhrer --- src/modules/fw_att_control/ecl_controller.cpp | 52 ------------------- src/modules/fw_att_control/ecl_controller.h | 22 ++++---- 2 files changed, 10 insertions(+), 64 deletions(-) diff --git a/src/modules/fw_att_control/ecl_controller.cpp b/src/modules/fw_att_control/ecl_controller.cpp index 50b6ff3340..fd41d36255 100644 --- a/src/modules/fw_att_control/ecl_controller.cpp +++ b/src/modules/fw_att_control/ecl_controller.cpp @@ -65,55 +65,3 @@ ECL_Controller::ECL_Controller() : _body_rate_setpoint(0.0f) { } - -void ECL_Controller::reset_integrator() -{ - _integrator = 0.0f; -} - -void ECL_Controller::set_time_constant(float time_constant) -{ - if (time_constant > 0.1f && time_constant < 3.0f) { - _tc = time_constant; - } -} - -void ECL_Controller::set_k_p(float k_p) -{ - _k_p = k_p; -} - -void ECL_Controller::set_k_i(float k_i) -{ - _k_i = k_i; -} - -void ECL_Controller::set_k_ff(float k_ff) -{ - _k_ff = k_ff; -} - -void ECL_Controller::set_integrator_max(float max) -{ - _integrator_max = max; -} - -void ECL_Controller::set_max_rate(float max_rate) -{ - _max_rate = max_rate; -} - -float ECL_Controller::get_euler_rate_setpoint() -{ - return _euler_rate_setpoint; -} - -float ECL_Controller::get_body_rate_setpoint() -{ - return _body_rate_setpoint; -} - -float ECL_Controller::get_integrator() -{ - return _integrator; -} diff --git a/src/modules/fw_att_control/ecl_controller.h b/src/modules/fw_att_control/ecl_controller.h index 0e58cfec5b..4fc2832d34 100644 --- a/src/modules/fw_att_control/ecl_controller.h +++ b/src/modules/fw_att_control/ecl_controller.h @@ -81,20 +81,18 @@ public: */ virtual float control_attitude(const float dt, const ECL_ControlData &ctl_data) = 0; - /* Setters */ - void set_time_constant(float time_constant); - void set_k_p(float k_p); - void set_k_i(float k_i); - void set_k_ff(float k_ff); - void set_integrator_max(float max); - void set_max_rate(float max_rate); + void set_time_constant(float time_constant) { _tc = time_constant; } + void set_k_p(float k_p) { _k_p = k_p; } + void set_k_i(float k_i) { _k_i = k_i; } + void set_k_ff(float k_ff) { _k_ff = k_ff; } + void set_integrator_max(float max) { _integrator_max = max; } + void set_max_rate(float max_rate) { _max_rate = max_rate; } - /* Getters */ - float get_euler_rate_setpoint(); - float get_body_rate_setpoint(); - float get_integrator(); + float get_euler_rate_setpoint() { return _euler_rate_setpoint; } + float get_body_rate_setpoint() { return _body_rate_setpoint; } + float get_integrator() { return _integrator; } - void reset_integrator(); + void reset_integrator() { _integrator = 0.f; } protected: uint64_t _last_run;