okapi::SettledUtil class

Constructors, destructors, conversion operators

SettledUtil(std::unique_ptr<AbstractTimer> iatTargetTimer, double iatTargetError = 50, double iatTargetDerivative = 5, QTime iatTargetTime = 250_ms) explicit
A utility class to determine if a control loop has settled based on error.
~SettledUtil() virtual

Public functions

auto isSettled(double ierror) -> bool virtual
Returns whether the controller is settled.
void reset() virtual
Resets the "at target" timer and clears the previous error.

Protected variables

double atTargetError
double atTargetDerivative
QTime atTargetTime
std::unique_ptr<AbstractTimer> atTargetTimer
double lastError

Function documentation

okapi::SettledUtil::SettledUtil(std::unique_ptr<AbstractTimer> iatTargetTimer, double iatTargetError = 50, double iatTargetDerivative = 5, QTime iatTargetTime = 250_ms) explicit

A utility class to determine if a control loop has settled based on error.

Parameters
iatTargetTimer A timer used to track iatTargetTime.
iatTargetError The minimum error to be considered settled.
iatTargetDerivative The minimum error derivative to be considered settled.
iatTargetTime The minimum time within atTargetError to be considered settled.

A control loop is settled if the error is within iatTargetError and iatTargetDerivative for iatTargetTime.

bool okapi::SettledUtil::isSettled(double ierror) virtual

Returns whether the controller is settled.

Parameters
ierror The current error.
Returns Whether the controller is settled.