2014-05-02 18:12:24 -03:00
|
|
|
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
|
|
|
|
|
|
/// @file AC_HELI_PID.h
|
|
|
|
/// @brief Helicopter Specific Rate PID algorithm, with EEPROM-backed storage of constants.
|
|
|
|
|
|
|
|
#ifndef __AC_HELI_PID_H__
|
|
|
|
#define __AC_HELI_PID_H__
|
|
|
|
|
|
|
|
#include <AP_Common.h>
|
|
|
|
#include <AP_Param.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <AC_PID.h>
|
|
|
|
|
|
|
|
/// @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
|
|
|
|
2015-05-22 21:00:17 -03:00
|
|
|
/// get_vff - return Velocity FeedForward Term
|
|
|
|
float get_vff(float requested_rate);
|
|
|
|
|
|
|
|
/// get_avff - return Acceleration FeedForward Term
|
|
|
|
float get_aff(float requested_rate);
|
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);
|
2014-05-10 09:18:20 -03:00
|
|
|
|
|
|
|
// accessors
|
2015-05-22 21:00:17 -03:00
|
|
|
float ff() const { return _vff.get(); }
|
|
|
|
void ff(const float v) { _vff.set(v); }
|
2014-05-02 18:12:24 -03:00
|
|
|
|
|
|
|
static const struct AP_Param::GroupInfo var_info[];
|
|
|
|
|
|
|
|
private:
|
2015-05-22 21:00:17 -03:00
|
|
|
AP_Float _vff;
|
|
|
|
AP_Float _aff;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __AC_HELI_PID_H__
|