#include <MHV_PID.h>
List of all members.
Public Member Functions |
| | MHV_PID (float setpoint, float kP, float kI, float kD, uint16_t period, bool reverse, uint16_t min, uint16_t max) |
| void | setDirection (bool reverse) |
| void | enable (bool enable) |
| float | compute (float input) |
| void | setTuning (float kP, float kI, float kD, uint16_t period) |
| void | setOutputLimits (float, float) |
Protected Member Functions |
| void | clampIntegral () |
Protected Attributes |
| float | _kP |
| float | _kI |
| float | _kD |
| bool | _reverse |
| bool | _enabled |
| float | _setpoint |
| float | _integral |
| float | _lastInput |
| float | _lastOutput |
| float | outMin |
| float | outMax |
Detailed Description
Definition at line 38 of file MHV_PID.h.
Constructor & Destructor Documentation
| MHV_PID::MHV_PID |
( |
float |
setpoint, |
|
|
float |
kP, |
|
|
float |
kI, |
|
|
float |
kD, |
|
|
uint16_t |
period, |
|
|
bool |
reverse, |
|
|
uint16_t |
min, |
|
|
uint16_t |
max |
|
) |
| |
Create a new PID
- Parameters:
-
| setpoint | the target value |
| kP | the proportional constant |
| kI | the integral constant |
| kD | the derivative constant |
| period | the period that compute() is called, in ms |
| reverse | true if there is an inverse relationship between the output and the input (eg. running a cooler to reduce temperature) |
| min | the minimum value for output |
| max | the maximum value four output |
Definition at line 46 of file MHV_PID.cpp.
Member Function Documentation
| void MHV_PID::clampIntegral |
( |
| ) |
[inline, protected] |
| float MHV_PID::compute |
( |
float |
input | ) |
|
Calculate the next output
- Parameters:
-
Definition at line 69 of file MHV_PID.cpp.
| void MHV_PID::enable |
( |
bool |
enable | ) |
|
Enable/Disable the PID
- Parameters:
-
| enable | true to enable the pid |
Definition at line 129 of file MHV_PID.cpp.
| void MHV_PID::setDirection |
( |
bool |
reverse | ) |
|
Set the direction for the PID.
Setting reverse means that increasing output reduces the input (eg. increasing power to a cooler, with the input being temperature)
Definition at line 145 of file MHV_PID.cpp.
| void MHV_PID::setOutputLimits |
( |
float |
min, |
|
|
float |
max |
|
) |
| |
Alter the minimum & maximum values for the output
- Parameters:
-
| min | the new minimum output value |
| max | the new maximum output value |
Definition at line 117 of file MHV_PID.cpp.
| void MHV_PID::setTuning |
( |
float |
kP, |
|
|
float |
kI, |
|
|
float |
kD, |
|
|
uint16_t |
period |
|
) |
| |
Adjust PID parameters
- Parameters:
-
| kP | the proportional constant |
| kI | the integral constant |
| kD | the derivative constant |
| period | the period that compute() is called, in ms |
Definition at line 97 of file MHV_PID.cpp.
Member Data Documentation
The documentation for this class was generated from the following files: