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
|
|
|
|
2016-05-12 04:34:23 -03:00
|
|
|
#define AC_PID_LEAK_MIN 0.1 // 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
|
2015-05-21 16:51:40 -03:00
|
|
|
AC_HELI_PID(float initial_p, float initial_i, float initial_d, float initial_imax, float initial_filt_hz, float dt, float initial_ff);
|
2015-01-23 06:05:40 -04:00
|
|
|
|
2014-05-02 18:12:24 -03:00
|
|
|
/// get_leaky_i - replacement for get_i but output is leaded at leak_rate
|
2015-01-23 06:05:40 -04:00
|
|
|
float get_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
|
|
|
};
|