LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
asyncVelIntegratedController.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
12#include <memory>
13
14namespace okapi {
20 public:
32 AsyncVelIntegratedController(const std::shared_ptr<AbstractMotor> &imotor,
34 std::int32_t imaxVelocity,
35 const TimeUtil &itimeUtil,
36 const std::shared_ptr<Logger> &ilogger = Logger::getDefaultLogger());
37
41 void setTarget(double itarget) override;
42
48 double getTarget() override;
49
53 double getProcessValue() const override;
54
58 double getError() const override;
59
68 bool isSettled() override;
69
74 void reset() override;
75
80 void flipDisable() override;
81
88 void flipDisable(bool iisDisabled) override;
89
95 bool isDisabled() const override;
96
101 void waitUntilSettled() override;
102
109 void controllerSet(double ivalue) override;
110
111 protected:
112 std::shared_ptr<Logger> logger;
114 std::shared_ptr<AbstractMotor> motor;
116 std::int32_t maxVelocity;
117 double lastTarget = 0;
119 bool hasFirstTarget = false;
120 std::unique_ptr<SettledUtil> settledUtil;
121
122 virtual void resumeMovement();
123};
124} // namespace okapi
Closed-loop controller that uses the V5 motor's onboard control to move.
double getTarget() override
Gets the last set target, or the default target if none was set.
void flipDisable(bool iisDisabled) override
Sets whether the controller is off or on.
void setTarget(double itarget) override
Sets the target for the controller.
double getError() const override
Returns the last error of the controller.
bool isSettled() override
Returns whether the controller has settled at the target.
AsyncVelIntegratedController(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.
double getProcessValue() const override
void waitUntilSettled() override
Blocks the current task until the controller has settled.
void flipDisable() override
Changes whether the controller is off or on.
bool isDisabled() const override
Returns whether the controller is currently disabled.
void controllerSet(double ivalue) override
Writes the value of the controller output.
void reset() override
Resets the controller's internal state so it is similar to when it was first initialized,...
static std::shared_ptr< Logger > getDefaultLogger()
Utility class for holding an AbstractTimer, AbstractRate, and SettledUtil together in one class since...
Definition timeUtil.hpp:18
A simple structure representing the full ratio between motor and wheel.