CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AC_PID/AC_PI.h
Views: 1798
1
#pragma once
2
3
/*
4
Generic PI for systems like heater control, no filtering
5
*/
6
7
#include <AP_Common/AP_Common.h>
8
#include <AP_Param/AP_Param.h>
9
10
class AC_PI {
11
public:
12
// Constructor
13
AC_PI(float initial_p, float initial_i, float initial_imax);
14
15
CLASS_NO_COPY(AC_PI);
16
17
// update controller
18
float update(float measurement, float target, float dt);
19
20
// parameter var table
21
static const struct AP_Param::GroupInfo var_info[];
22
23
float get_P() const {
24
return output_P;
25
}
26
float get_I() const {
27
return integrator;
28
}
29
30
protected:
31
AP_Float kP;
32
AP_Float kI;
33
AP_Float imax;
34
float integrator;
35
float output_P;
36
37
private:
38
const float default_kp;
39
const float default_ki;
40
const float default_imax;
41
42
};
43
44