|
LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
|
#include <iterativePosPidController.hpp>
Classes | |
| struct | Gains |
Public Member Functions | |
| IterativePosPIDController (double ikP, double ikI, double ikD, double ikBias, const TimeUtil &itimeUtil, std::unique_ptr< Filter > iderivativeFilter=std::make_unique< PassthroughFilter >(), std::shared_ptr< Logger > ilogger=Logger::getDefaultLogger()) | |
| Position PID controller. | |
| IterativePosPIDController (const Gains &igains, const TimeUtil &itimeUtil, std::unique_ptr< Filter > iderivativeFilter=std::make_unique< PassthroughFilter >(), std::shared_ptr< Logger > ilogger=Logger::getDefaultLogger()) | |
| Position PID controller. | |
| double | step (double inewReading) override |
| Do one iteration of the controller. | |
| void | setTarget (double itarget) override |
| Sets the target for the controller. | |
| void | controllerSet (double ivalue) override |
| Writes the value of the controller output. | |
| double | getTarget () override |
| Gets the last set target, or the default target if none was set. | |
| double | getTarget () const |
| Gets the last set target, or the default target if none was set. | |
| double | getProcessValue () const override |
| double | getOutput () const override |
| Returns the last calculated output of the controller. | |
| double | getMaxOutput () override |
| Get the upper output bound. | |
| double | getMinOutput () override |
| Get the lower output bound. | |
| double | getError () const override |
| Returns the last error of the controller. | |
| bool | isSettled () override |
| Returns whether the controller has settled at the target. | |
| void | setSampleTime (QTime isampleTime) override |
| Set time between loops in ms. | |
| void | setOutputLimits (double imax, double imin) override |
| Set controller output bounds. | |
| void | setControllerSetTargetLimits (double itargetMax, double itargetMin) override |
| Sets the (soft) limits for the target range that controllerSet() scales into. | |
| void | reset () override |
| Resets the controller's internal state so it is similar to when it was first initialized, while keeping any user-configured information. | |
| void | flipDisable () override |
| Changes whether the controller is off or on. | |
| void | flipDisable (bool iisDisabled) override |
| Sets whether the controller is off or on. | |
| bool | isDisabled () const override |
| Returns whether the controller is currently disabled. | |
| QTime | getSampleTime () const override |
| Get the last set sample time. | |
| virtual void | setIntegralLimits (double imax, double imin) |
| Set integrator bounds. | |
| virtual void | setErrorSumLimits (double imax, double imin) |
| Set the error sum bounds. | |
| virtual void | setIntegratorReset (bool iresetOnZero) |
| Set whether the integrator should be reset when error is 0 or changes sign. | |
| virtual void | setGains (const Gains &igains) |
| Set controller gains. | |
| Gains | getGains () const |
| Gets the current gains. | |
Public Member Functions inherited from okapi::IterativeController< Input, Output > | |
| virtual Output | step (Input ireading)=0 |
| Do one iteration of the controller. | |
| virtual void | setOutputLimits (Output imax, Output imin)=0 |
| Set controller output bounds. | |
| virtual void | setControllerSetTargetLimits (Output itargetMax, Output itargetMin)=0 |
| Sets the (soft) limits for the target range that controllerSet() scales into. | |
Public Member Functions inherited from okapi::ClosedLoopController< Input, Output > | |
| virtual | ~ClosedLoopController ()=default |
| virtual void | setTarget (Input itarget)=0 |
| Sets the target for the controller. | |
Public Member Functions inherited from okapi::ControllerOutput< Input > | |
| virtual void | controllerSet (Input ivalue)=0 |
| Writes the value of the controller output. | |
Protected Attributes | |
| std::shared_ptr< Logger > | logger |
| double | kP |
| double | kI |
| double | kD |
| double | kBias |
| QTime | sampleTime {10_ms} |
| double | target {0} |
| double | lastReading {0} |
| double | error {0} |
| double | lastError {0} |
| std::unique_ptr< Filter > | derivativeFilter |
| double | integral {0} |
| double | integralMax {1} |
| double | integralMin {-1} |
| double | errorSumMin {0} |
| double | errorSumMax {std::numeric_limits<double>::max()} |
| double | derivative {0} |
| double | output {0} |
| double | outputMax {1} |
| double | outputMin {-1} |
| double | controllerSetTargetMax {1} |
| double | controllerSetTargetMin {-1} |
| bool | shouldResetOnCross {true} |
| bool | controllerIsDisabled {false} |
| std::unique_ptr< AbstractTimer > | loopDtTimer |
| std::unique_ptr< SettledUtil > | settledUtil |
Definition at line 20 of file iterativePosPidController.hpp.
| okapi::IterativePosPIDController::IterativePosPIDController | ( | double | ikP, |
| double | ikI, | ||
| double | ikD, | ||
| double | ikBias, | ||
| const TimeUtil & | itimeUtil, | ||
| std::unique_ptr< Filter > | iderivativeFilter = std::make_unique< PassthroughFilter >(), |
||
| std::shared_ptr< Logger > | ilogger = Logger::getDefaultLogger() |
||
| ) |
Position PID controller.
| ikP | the proportional gain |
| ikI | the integration gain |
| ikD | the derivative gain |
| ikBias | the controller bias |
| itimeUtil | see TimeUtil docs |
| iderivativeFilter | a filter for filtering the derivative term |
| ilogger | The logger this instance will log to. |
| okapi::IterativePosPIDController::IterativePosPIDController | ( | const Gains & | igains, |
| const TimeUtil & | itimeUtil, | ||
| std::unique_ptr< Filter > | iderivativeFilter = std::make_unique< PassthroughFilter >(), |
||
| std::shared_ptr< Logger > | ilogger = Logger::getDefaultLogger() |
||
| ) |
Position PID controller.
| igains | the controller gains |
| itimeUtil | see TimeUtil docs |
| iderivativeFilter | a filter for filtering the derivative term |
|
override |
Writes the value of the controller output.
This method might be automatically called in another thread by the controller. The range of input values is expected to be [-1, 1].
| ivalue | the controller's output in the range [-1, 1] |
|
overridevirtual |
Changes whether the controller is off or on.
Turning the controller on after it was off will cause the controller to move to its last set target, unless it was reset in that time.
Implements okapi::ClosedLoopController< Input, Output >.
|
overridevirtual |
Sets whether the controller is off or on.
Turning the controller on after it was off will cause the controller to move to its last set target, unless it was reset in that time.
| iisDisabled | whether the controller is disabled |
Implements okapi::ClosedLoopController< Input, Output >.
|
overridevirtual |
Returns the last error of the controller.
Does not update when disabled.
Implements okapi::ClosedLoopController< Input, Output >.
| Gains okapi::IterativePosPIDController::getGains | ( | ) | const |
Gets the current gains.
|
overridevirtual |
Get the upper output bound.
Implements okapi::IterativeController< Input, Output >.
|
overridevirtual |
Get the lower output bound.
Implements okapi::IterativeController< Input, Output >.
|
overridevirtual |
Returns the last calculated output of the controller.
Output is in the range [-1, 1] unless the bounds have been changed with setOutputLimits().
Implements okapi::IterativeController< Input, Output >.
|
overridevirtual |
Implements okapi::ClosedLoopController< Input, Output >.
|
overridevirtual |
Get the last set sample time.
Implements okapi::IterativeController< Input, Output >.
| double okapi::IterativePosPIDController::getTarget | ( | ) | const |
Gets the last set target, or the default target if none was set.
|
overridevirtual |
Gets the last set target, or the default target if none was set.
Implements okapi::ClosedLoopController< Input, Output >.
|
overridevirtual |
Returns whether the controller is currently disabled.
Implements okapi::ClosedLoopController< Input, Output >.
|
overridevirtual |
Returns whether the controller has settled at the target.
Determining what settling means is implementation-dependent.
If the controller is disabled, this method must return true.
Implements okapi::ClosedLoopController< Input, Output >.
|
overridevirtual |
Resets the controller's internal state so it is similar to when it was first initialized, while keeping any user-configured information.
Implements okapi::ClosedLoopController< Input, Output >.
|
override |
Sets the (soft) limits for the target range that controllerSet() scales into.
The target computed by controllerSet() is scaled into the range [-itargetMin, itargetMax].
| itargetMax | The new max target for controllerSet(). |
| itargetMin | The new min target for controllerSet(). |
|
virtual |
Set the error sum bounds.
Default bounds are [0, std::numeric_limits<double>::max()]. Error will only be added to the integral term when its absolute value is between these bounds of either side of the target.
| imax | max error value that will be summed |
| imin | min error value that will be summed |
|
virtual |
Set controller gains.
| igains | The new gains. |
|
virtual |
Set integrator bounds.
Default bounds are [-1, 1].
| imax | max integrator value |
| imin | min integrator value |
|
virtual |
Set whether the integrator should be reset when error is 0 or changes sign.
| iresetOnZero | true to reset |
|
override |
Set controller output bounds.
Default bounds are [-1, 1].
| imax | max output |
| imin | min output |
|
overridevirtual |
Set time between loops in ms.
| isampleTime | time between loops |
Implements okapi::IterativeController< Input, Output >.
|
override |
Sets the target for the controller.
| itarget | new target position |
|
override |
Do one iteration of the controller.
Returns the reading in the range [-1, 1] unless the bounds have been changed with setOutputLimits().
| inewReading | new measurement |
|
protected |
Definition at line 271 of file iterativePosPidController.hpp.
|
protected |
Definition at line 265 of file iterativePosPidController.hpp.
|
protected |
Definition at line 266 of file iterativePosPidController.hpp.
|
protected |
Definition at line 259 of file iterativePosPidController.hpp.
|
protected |
Definition at line 248 of file iterativePosPidController.hpp.
|
protected |
Definition at line 246 of file iterativePosPidController.hpp.
|
protected |
Definition at line 257 of file iterativePosPidController.hpp.
|
protected |
Definition at line 256 of file iterativePosPidController.hpp.
|
protected |
Definition at line 251 of file iterativePosPidController.hpp.
|
protected |
Definition at line 252 of file iterativePosPidController.hpp.
|
protected |
Definition at line 253 of file iterativePosPidController.hpp.
|
protected |
Definition at line 242 of file iterativePosPidController.hpp.
|
protected |
Definition at line 242 of file iterativePosPidController.hpp.
|
protected |
Definition at line 242 of file iterativePosPidController.hpp.
|
protected |
Definition at line 242 of file iterativePosPidController.hpp.
|
protected |
Definition at line 247 of file iterativePosPidController.hpp.
|
protected |
Definition at line 245 of file iterativePosPidController.hpp.
|
protected |
Definition at line 241 of file iterativePosPidController.hpp.
|
protected |
Definition at line 273 of file iterativePosPidController.hpp.
|
protected |
Definition at line 262 of file iterativePosPidController.hpp.
|
protected |
Definition at line 263 of file iterativePosPidController.hpp.
|
protected |
Definition at line 264 of file iterativePosPidController.hpp.
|
protected |
Definition at line 243 of file iterativePosPidController.hpp.
|
protected |
Definition at line 274 of file iterativePosPidController.hpp.
|
protected |
Definition at line 269 of file iterativePosPidController.hpp.
|
protected |
Definition at line 244 of file iterativePosPidController.hpp.