You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
float Kp, float Ki, float Kd, float POn, uint8_t ControllerDirection)
56
+
float Kp, float Ki, float Kd, float POn, uint8_t ControllerDirection);
57
57
```
58
58
59
59
- `Input`, `Output`, and `Setpoint` are pointers to the variables holding these values.
60
60
- `Kp`, `Ki`, and `Kd` are the PID proportional, integral, and derivative gains.
61
61
- `POn` is the Proportional on Error weighting value (0.0-1.0). This controls the mix of Proportional on Error (PonE) and Proportional on Measurement (PonM) that's used in the compute algorithm. Note that POn controls the PonE amount, where the remainder (1-PonE) is the PonM amount. Also, the default POn is 1
float Kp, float Ki, float Kd, uint8_t ControllerDirection)
69
+
float Kp, float Ki, float Kd, uint8_t ControllerDirection);
70
70
```
71
71
72
72
This allows you to use Proportional on Error without explicitly saying so.
73
73
74
74
#### Compute
75
75
76
76
```c++
77
-
boolQuickPID::Compute()
77
+
boolQuickPID::Compute();
78
78
```
79
79
80
80
This function contains the PID algorithm and it should be called once every loop(). Most of the time it will just return false without doing anything. However, at a frequency specified by `SetSampleTime` it will calculate a new Output and return true.
voidQuickPID::AutoTune(int inputPin, int outputPin, int tuningRule, int Print = 0, uint32_t timeout = 30)
85
+
voidQuickPID::AutoTune(int inputPin, int outputPin, int tuningRule, int Print = 0, uint32_t timeout = 30);
86
86
```
87
87
88
88
The `AutoTune()` function automatically determines and sets `Kp`, `Ki` and `Kd`. It also determines the critical gain `Ku` and critical period `Tu` of the control system.
@@ -98,45 +98,45 @@ Sets the AutoTune timeout where the default is 120 seconds.
98
98
#### SetTunings
99
99
100
100
```c++
101
-
void QuickPID::SetTunings(float Kp, float Ki, float Kd, float POn)
101
+
void QuickPID::SetTunings(float Kp, float Ki, float Kd, float POn);
102
102
```
103
103
104
104
This function allows the controller's dynamic performance to be adjusted. It's called automatically from the constructor, but tunings can also be adjusted on the fly during normal operation. The parameters are as described in the constructor.
105
105
106
106
```c++
107
-
voidQuickPID::SetTunings(float Kp, float Ki, float Kd)
107
+
voidQuickPID::SetTunings(float Kp, float Ki, float Kd);
108
108
```
109
109
110
110
Set Tunings using the last remembered POn setting.
Sets the period, in microseconds, at which the calculation is performed. The default is 100ms.
119
119
120
120
#### SetOutputLimits
121
121
122
122
```c++
123
-
voidQuickPID::SetOutputLimits(int Min, int Max)
123
+
voidQuickPID::SetOutputLimits(int Min, int Max);
124
124
```
125
125
126
126
The PID controller is designed to vary its output within a given range. By default this range is 0-255, the Arduino PWM range.
127
127
128
128
#### SetMode
129
129
130
130
```c++
131
-
void QuickPID::SetMode(uint8_t Mode)
131
+
void QuickPID::SetMode(uint8_t Mode);
132
132
```
133
133
134
134
Allows the controller Mode to be set to `MANUAL` (0) or `AUTOMATIC` (non-zero). when the transition from manual to automatic occurs, the controller is automatically initialized.
135
135
136
136
#### Initialize
137
137
138
138
```c++
139
-
voidQuickPID::Initialize()
139
+
voidQuickPID::Initialize();
140
140
```
141
141
142
142
Does all the things that need to happen to ensure a bump-less transfer from manual to automatic mode.
@@ -152,14 +152,14 @@ The PID will either be connected to a DIRECT acting process (+Output leads to +I
152
152
#### Display_Functions
153
153
154
154
```c++
155
-
float QuickPID::GetKp()
156
-
float QuickPID::GetKi()
157
-
float QuickPID::GetKd()
158
-
float QuickPID::GetKu()
159
-
float QuickPID::GetTu()
160
-
float QuickPID::GetTd()
161
-
uint8_t QuickPID::GetMode()
162
-
uint8_t QuickPID::GetDirection()
155
+
float QuickPID::GetKp();
156
+
float QuickPID::GetKi();
157
+
float QuickPID::GetKd();
158
+
float QuickPID::GetKu();
159
+
float QuickPID::GetTu();
160
+
float QuickPID::GetTd();
161
+
uint8_t QuickPID::GetMode();
162
+
uint8_t QuickPID::GetDirection();
163
163
```
164
164
165
165
These functions query the internal state of the PID. They're here for display purposes.
@@ -174,6 +174,8 @@ A faster configuration of `analogRead()`where a preset of 32 is used. If the ar
174
174
175
175
#### [AnalogWrite (PWM and DAC) for ESP32](https://github.com/Dlloydev/ESP32-ESP32S2-AnalogWrite)
176
176
177
+
Use this link for reference. Note that if you're using QuickPID, there's no need to install the AnalogWrite library as this feature is already included.
0 commit comments