Closed-loop controller that uses the V5 motor's onboard control to move.
More...
#include <asyncPosIntegratedController.hpp>
|
| | AsyncPosIntegratedController (const std::shared_ptr< AbstractMotor > &imotor, const AbstractMotor::GearsetRatioPair &ipair, std::int32_t imaxVelocity, const TimeUtil &itimeUtil, const std::shared_ptr< Logger > &ilogger=Logger::getDefaultLogger()) |
| | Closed-loop controller that uses the V5 motor's onboard control to move.
|
| |
| void | setTarget (double itarget) override |
| | Sets the target for the controller.
|
| |
| double | getTarget () override |
| | Gets the last set target, or the default target if none was set.
|
| |
| double | getProcessValue () const override |
| |
| double | getError () const override |
| | Returns the last error of the controller.
|
| |
| bool | isSettled () override |
| | Returns whether the controller has settled at the target.
|
| |
| 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.
|
| |
| void | waitUntilSettled () override |
| | Blocks the current task until the controller has settled.
|
| |
| void | controllerSet (double ivalue) override |
| | Writes the value of the controller output.
|
| |
| void | tarePosition () override |
| | Sets the "absolute" zero position of the controller to its current position.
|
| |
| void | setMaxVelocity (std::int32_t imaxVelocity) override |
| | Sets a new maximum velocity in motor RPM [0-600].
|
| |
| virtual void | stop () |
| | Stops the motor mid-movement.
|
| |
| virtual | ~ClosedLoopController ()=default |
| |
| virtual void | setTarget (Input itarget)=0 |
| | Sets the target for the controller.
|
| |
| virtual void | controllerSet (Input ivalue)=0 |
| | Writes the value of the controller output.
|
| |
|
| virtual void | resumeMovement () |
| | Resumes moving after the controller is reset.
|
| |
Closed-loop controller that uses the V5 motor's onboard control to move.
Input units are whatever units the motor is in.
Definition at line 18 of file asyncPosIntegratedController.hpp.
◆ AsyncPosIntegratedController()
Closed-loop controller that uses the V5 motor's onboard control to move.
Input units are whatever units the motor is in. Throws a std::invalid_argument exception if the gear ratio is zero.
- Parameters
-
| imotor | The motor to control. |
| ipair | The gearset. |
| imaxVelocity | The maximum velocity after gearing. |
| itimeUtil | The TimeUtil. |
| ilogger | The logger this instance will log to. |
◆ controllerSet()
| void okapi::AsyncPosIntegratedController::controllerSet |
( |
double |
ivalue | ) |
|
|
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].
- Parameters
-
| ivalue | the controller's output in the range [-1, 1] |
◆ flipDisable() [1/2]
| void okapi::AsyncPosIntegratedController::flipDisable |
( |
| ) |
|
|
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 >.
◆ flipDisable() [2/2]
| void okapi::AsyncPosIntegratedController::flipDisable |
( |
bool |
iisDisabled | ) |
|
|
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.
- Parameters
-
| iisDisabled | whether the controller is disabled |
Implements okapi::ClosedLoopController< Input, Output >.
◆ getError()
| double okapi::AsyncPosIntegratedController::getError |
( |
| ) |
const |
|
overridevirtual |
◆ getProcessValue()
| double okapi::AsyncPosIntegratedController::getProcessValue |
( |
| ) |
const |
|
overridevirtual |
◆ getTarget()
| double okapi::AsyncPosIntegratedController::getTarget |
( |
| ) |
|
|
overridevirtual |
◆ isDisabled()
| bool okapi::AsyncPosIntegratedController::isDisabled |
( |
| ) |
const |
|
overridevirtual |
◆ isSettled()
| bool okapi::AsyncPosIntegratedController::isSettled |
( |
| ) |
|
|
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.
- Returns
- whether the controller is settled
Implements okapi::ClosedLoopController< Input, Output >.
◆ reset()
| void okapi::AsyncPosIntegratedController::reset |
( |
| ) |
|
|
overridevirtual |
◆ resumeMovement()
| virtual void okapi::AsyncPosIntegratedController::resumeMovement |
( |
| ) |
|
|
protectedvirtual |
Resumes moving after the controller is reset.
Should not cause movement if the controller is turned off, reset, and turned back on.
◆ setMaxVelocity()
| void okapi::AsyncPosIntegratedController::setMaxVelocity |
( |
std::int32_t |
imaxVelocity | ) |
|
|
overridevirtual |
◆ setTarget()
| void okapi::AsyncPosIntegratedController::setTarget |
( |
double |
itarget | ) |
|
|
override |
Sets the target for the controller.
◆ stop()
| virtual void okapi::AsyncPosIntegratedController::stop |
( |
| ) |
|
|
virtual |
Stops the motor mid-movement.
Does not change the last set target.
◆ tarePosition()
| void okapi::AsyncPosIntegratedController::tarePosition |
( |
| ) |
|
|
overridevirtual |
◆ waitUntilSettled()
| void okapi::AsyncPosIntegratedController::waitUntilSettled |
( |
| ) |
|
|
overridevirtual |
◆ controllerIsDisabled
| bool okapi::AsyncPosIntegratedController::controllerIsDisabled {false} |
|
protected |
◆ hasFirstTarget
| bool okapi::AsyncPosIntegratedController::hasFirstTarget {false} |
|
protected |
◆ lastTarget
| double okapi::AsyncPosIntegratedController::lastTarget {0} |
|
protected |
◆ logger
| std::shared_ptr<Logger> okapi::AsyncPosIntegratedController::logger |
|
protected |
◆ maxVelocity
| std::int32_t okapi::AsyncPosIntegratedController::maxVelocity |
|
protected |
◆ motor
| std::shared_ptr<AbstractMotor> okapi::AsyncPosIntegratedController::motor |
|
protected |
◆ offset
| double okapi::AsyncPosIntegratedController::offset {0} |
|
protected |
◆ pair
◆ settledUtil
| std::unique_ptr<SettledUtil> okapi::AsyncPosIntegratedController::settledUtil |
|
protected |
◆ timeUtil
| TimeUtil okapi::AsyncPosIntegratedController::timeUtil |
|
protected |
The documentation for this class was generated from the following file: