template<typename Input, typename Output>
okapi::IterativeController class

Closed-loop controller that steps iteratively using the step method below.

ControllerOutput::controllerSet() should set the controller's target to the input scaled by the output bounds.

Base classes

template<typename Input, typename Output>
class ClosedLoopController
An abstract closed-loop controller.

Derived classes

template<typename Input, typename Output>
class IterativePositionController
template<typename Input, typename Output>
class IterativeVelocityController

Public functions

auto step(Input ireading) -> Output pure virtual
Do one iteration of the controller.
auto getOutput() const -> Output pure virtual
Returns the last calculated output of the controller.
void setOutputLimits(Output imax, Output imin) pure virtual
Set controller output bounds.
void setControllerSetTargetLimits(Output itargetMax, Output itargetMin) pure virtual
Sets the (soft) limits for the target range that controllerSet() scales into.
auto getMaxOutput() -> Output pure virtual
Get the upper output bound.
auto getMinOutput() -> Output pure virtual
Get the lower output bound.
void setSampleTime(QTime isampleTime) pure virtual
Set time between loops.
auto getSampleTime() const -> QTime pure virtual
Get the last set sample time.

Function documentation

template<typename Input, typename Output>
Output okapi::IterativeController<Input, Output>::step(Input ireading) pure virtual

Do one iteration of the controller.

Parameters
ireading A new measurement.
Returns The controller output.

template<typename Input, typename Output>
void okapi::IterativeController<Input, Output>::setOutputLimits(Output imax, Output imin) pure virtual

Set controller output bounds.

Parameters
imax max output
imin min output

template<typename Input, typename Output>
void okapi::IterativeController<Input, Output>::setControllerSetTargetLimits(Output itargetMax, Output itargetMin) pure virtual

Sets the (soft) limits for the target range that controllerSet() scales into.

Parameters
itargetMax The new max target for controllerSet().
itargetMin The new min target for controllerSet().

The target computed by controllerSet() is scaled into the range [-itargetMin, itargetMax].

template<typename Input, typename Output>
Output okapi::IterativeController<Input, Output>::getMaxOutput() pure virtual

Get the upper output bound.

Returns the upper output bound

template<typename Input, typename Output>
Output okapi::IterativeController<Input, Output>::getMinOutput() pure virtual

Get the lower output bound.

Returns the lower output bound

template<typename Input, typename Output>
void okapi::IterativeController<Input, Output>::setSampleTime(QTime isampleTime) pure virtual

Set time between loops.

Parameters
isampleTime time between loops

template<typename Input, typename Output>
QTime okapi::IterativeController<Input, Output>::getSampleTime() const pure virtual

Get the last set sample time.

Returns sample time