2 * This file is part of INAV.
4 * INAV is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * INAV is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with INAV. If not, see <http://www.gnu.org/licenses/>.
20 typedef struct sqrt_controller_s
{
21 float kp
; // proportional gain
22 float error
; // error calced
23 float error_min
; // error limit in negative direction
24 float error_max
; // error limit in positive direction
25 float derivative_max
; // maximum derivative of output
28 float sqrtControllerApply(sqrt_controller_t
*sqrt_controller_pointer
, float target
, float measurement
, float deltaTime
);
29 void sqrtControllerInit(sqrt_controller_t
*sqrt_controller_pointer
, const float kp
, const float output_min
, const float output_max
, const float derivative_out_max
);