LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
iterativeMotorVelocityController.hpp
Go to the documentation of this file.
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 */
6#pragma once
7
10#include <array>
11#include <memory>
12
13namespace okapi {
15 public:
20 const std::shared_ptr<AbstractMotor> &imotor,
21 const std::shared_ptr<IterativeVelocityController<double, double>> &icontroller);
22
29 double step(double ireading) override;
30
34 void setTarget(double itarget) override;
35
42 void controllerSet(double ivalue) override;
43
49 double getTarget() override;
50
54 double getProcessValue() const override;
55
59 double getOutput() const override;
60
66 double getMaxOutput() override;
67
73 double getMinOutput() override;
74
78 double getError() const override;
79
86 bool isSettled() override;
87
93 void setSampleTime(QTime isampleTime) override;
94
101 void setOutputLimits(double imax, double imin) override;
102
110 void setControllerSetTargetLimits(double itargetMax, double itargetMin) override;
111
116 void reset() override;
117
122 void flipDisable() override;
123
130 void flipDisable(bool iisDisabled) override;
131
137 bool isDisabled() const override;
138
144 QTime getSampleTime() const override;
145
146 protected:
147 std::shared_ptr<AbstractMotor> motor;
148 std::shared_ptr<IterativeVelocityController<double, double>> controller;
149};
150} // namespace okapi
double getOutput() const override
Returns the last calculated output of the controller.
void setControllerSetTargetLimits(double itargetMax, double itargetMin) override
Sets the (soft) limits for the target range that controllerSet() scales into.
void flipDisable() override
Changes whether the controller is off or on.
double getMinOutput() override
Get the lower output bound.
bool isDisabled() const override
Returns whether the controller is currently disabled.
double getTarget() override
Gets the last set target, or the default target if none was set.
void reset() override
Resets the controller's internal state so it is similar to when it was first initialized,...
double getMaxOutput() override
Get the upper output bound.
double getProcessValue() const override
void controllerSet(double ivalue) override
Writes the value of the controller output.
double step(double ireading) override
Do one iteration of the controller.
IterativeMotorVelocityController(const std::shared_ptr< AbstractMotor > &imotor, const std::shared_ptr< IterativeVelocityController< double, double > > &icontroller)
Velocity controller that automatically writes to the motor.
void setOutputLimits(double imax, double imin) override
Set controller output bounds.
std::shared_ptr< IterativeVelocityController< double, double > > controller
void flipDisable(bool iisDisabled) override
Sets whether the controller is off or on.
void setTarget(double itarget) override
Sets the target for the controller.
void setSampleTime(QTime isampleTime) override
Set time between loops in ms.
bool isSettled() override
Returns whether the controller has settled at the target.
QTime getSampleTime() const override
Get the last set sample time.
double getError() const override
Returns the last error of the controller.