1#ifndef Math_PIDFEEDBACKLOOP_H
2#define Math_PIDFEEDBACKLOOP_H
26 void SetGoal(
double wantedValue);
80 isAngularValue(false),
83 maxAllowableDeltaTime(0.03)
106 this->
goal = wantedValue;
182 if (frameTime != 0.0f)
191 difference = (double)n_angulardistance((
float)
value, (
float)
goal);
197 double error = difference * frameTime;
201 double dP =
pConst * error;
217 double thisDelta = dP + dI + dD;
222 double timeRatio(1.0);
228 double difference = (thisDelta -
lastDelta);
231 if (difference < -accl)
233 else if (difference > accl)
245 this->lastTime = time;
A PID feedback loop (proportional integral derivative feedback loop)
Definition pidfeedbackloop.h:19
double goal
Definition pidfeedbackloop.h:46
double iConst
Definition pidfeedbackloop.h:49
double lastDelta
Definition pidfeedbackloop.h:54
const double & GetGoal() const
get the goal
Definition pidfeedbackloop.h:148
bool validError
Definition pidfeedbackloop.h:56
void SetGoal(double wantedValue)
set the goal
Definition pidfeedbackloop.h:104
Timing::Time maxAllowableDeltaTime
Definition pidfeedbackloop.h:62
double value
Definition pidfeedbackloop.h:45
double GetLastDelta() const
last delta of error
Definition pidfeedbackloop.h:158
double dConst
Definition pidfeedbackloop.h:50
Timing::Time lastTime
Definition pidfeedbackloop.h:59
const double & GetState() const
get current value
Definition pidfeedbackloop.h:127
double runningError
Definition pidfeedbackloop.h:55
bool isAngularValue
Definition pidfeedbackloop.h:57
double maxAcceleration
Definition pidfeedbackloop.h:51
double pConst
Definition pidfeedbackloop.h:48
void SetState(double value)
set value of loop
Definition pidfeedbackloop.h:92
void ResetError()
reset running error
Definition pidfeedbackloop.h:253
Timing::Time lastDeltaTime
Definition pidfeedbackloop.h:60
void Update(Timing::Time time)
update current value
Definition pidfeedbackloop.h:178
void SetIsAngularValue(bool val)
set IsAngularValue
Definition pidfeedbackloop.h:168
double GetLastError() const
get last computed error
Definition pidfeedbackloop.h:138
void SetConstants(double pConst, double iConst, double dConst, double acceleration=0.0)
set the propotional, integral and derivative constants, and maximum acceleration (how fast the value ...
Definition pidfeedbackloop.h:114
double lastError
Definition pidfeedbackloop.h:53
PIDFeedbackLoop()
constructor
Definition pidfeedbackloop.h:69
Different curves.
Definition angularpfeedbackloop.h:17
double Time
the time datatype
Definition time.h:18
Typedefs for the Timing subsystem.