2016-02-17 21:25:08 -04:00
|
|
|
#pragma once
|
2014-05-02 18:12:24 -03:00
|
|
|
|
|
|
|
/// @file AC_HELI_PID.h
|
|
|
|
/// @brief Helicopter Specific Rate PID algorithm, with EEPROM-backed storage of constants.
|
|
|
|
|
2015-08-11 03:28:41 -03:00
|
|
|
#include <AP_Common/AP_Common.h>
|
|
|
|
#include <AP_Param/AP_Param.h>
|
2014-05-02 18:12:24 -03:00
|
|
|
#include <stdlib.h>
|
2016-03-31 18:43:36 -03:00
|
|
|
#include <cmath>
|
2015-08-11 03:28:41 -03:00
|
|
|
#include "AC_PID.h"
|
2014-05-02 18:12:24 -03:00
|
|
|
|
2019-04-04 01:54:18 -03:00
|
|
|
static const float AC_PID_LEAK_MIN = 0.1f; // Default I-term Leak Minimum
|
2015-09-23 20:27:26 -03:00
|
|
|
|
2014-05-02 18:12:24 -03:00
|
|
|
/// @class AC_HELI_PID
|
2015-01-23 06:05:40 -04:00
|
|
|
/// @brief Heli PID control class
|
2014-05-02 18:12:24 -03:00
|
|
|
class AC_HELI_PID : public AC_PID {
|
|
|
|
public:
|
|
|
|
|
2015-01-23 06:05:40 -04:00
|
|
|
/// Constructor for PID
|
2019-06-27 06:33:49 -03:00
|
|
|
AC_HELI_PID(float initial_p, float initial_i, float initial_d, float initial_ff, float initial_imax, float initial_filt_T_hz, float initial_filt_E_hz, float initial_filt_D_hz, float dt);
|
2015-01-23 06:05:40 -04:00
|
|
|
|
2020-09-10 14:21:46 -03:00
|
|
|
/// update_leaky_i - replacement for get_i but output is leaked at leak_rate
|
2019-06-27 06:33:49 -03:00
|
|
|
void update_leaky_i(float leak_rate);
|
2016-02-15 02:24:52 -04:00
|
|
|
|
2014-05-02 18:12:24 -03:00
|
|
|
static const struct AP_Param::GroupInfo var_info[];
|
2016-02-15 02:24:52 -04:00
|
|
|
|
2014-05-02 18:12:24 -03:00
|
|
|
private:
|
2015-09-23 20:27:26 -03:00
|
|
|
AP_Float _leak_min;
|
2015-05-22 21:00:17 -03:00
|
|
|
|
|
|
|
float _last_requested_rate; // Requested rate from last iteration, used to calculate rate change of requested rate
|
2014-05-02 18:12:24 -03:00
|
|
|
};
|