Speeduino
Loading...
Searching...
No Matches
integerPID.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4#include "PidCore.h"
5
7{
8public:
9
11 integerPID(void);
12
15
18
20 void setSetPoint(int32_t setpoint) { _setpoint = setpoint; }
21
30
33
35
38
48
50 void reset(int32_t input);
51
53 void resetIntegeral(void);
54
55private:
56
57 // TODO: shrink these to int16_t if possible
58 int32_t _setpoint = 0;
59 int32_t _feedForwardTerm = 0;
60
61 uint32_t _lastTime = 0;
62 // TODO: shrink these to int16_t if possible
63 int32_t _lastInput = 0;
64
65 uint16_t _sampleTime = 0;
66 bool _isActive = false;
67
68 PidCore _pidCore;
69};
A base class for PID implementations.
Definition PidCore.h:9
Definition integerPID.h:7
void activate(int32_t input)
Activates the controller. Must be called before compute() will have any effect.
Definition integerPID.cpp:47
integerPID(void)
Default construction.
Definition integerPID.cpp:6
void setSetPoint(int32_t setpoint)
Set the controller set point.
Definition integerPID.h:20
void setTunings(const PidTuningParameters &pidParams, uint32_t nowMs, uint16_t minComputeInterval)
Set the PID tuning parameters.
Definition integerPID.cpp:35
void setFeedForwardTerm(int32_t feedForwardTerm)
(Optional) Set the feed forward term (predictive bias)
Definition integerPID.cpp:67
bool compute(uint32_t nowMs, int32_t input, int32_t *pOutput)
Compute the new output.
Definition integerPID.cpp:11
void resetIntegeral(void)
(Optional) Reset the integral term
Definition integerPID.cpp:62
void reset(int32_t input)
(Optional) Reset the controller
Definition integerPID.cpp:56
void setOutputLimits(int32_t min, int32_t max)
Set the output limits.
Definition integerPID.cpp:42
static TIntegral readSerialIntegralTimeout(void)
Reads an integral type, timing out if necessary.
Definition comms.cpp:175
Structure to hold PID tuning parameters.
Definition PidTuningParameters.h:7