LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
settledUtil.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 <memory>
11
12namespace okapi {
14 public:
24 explicit SettledUtil(std::unique_ptr<AbstractTimer> iatTargetTimer,
25 double iatTargetError = 50,
26 double iatTargetDerivative = 5,
27 QTime iatTargetTime = 250_ms);
28
29 virtual ~SettledUtil();
30
37 virtual bool isSettled(double ierror);
38
42 virtual void reset();
43
44 protected:
45 double atTargetError = 50;
47 QTime atTargetTime = 250_ms;
48 std::unique_ptr<AbstractTimer> atTargetTimer;
49 double lastError = 0;
50};
51} // namespace okapi
virtual ~SettledUtil()
virtual void reset()
Resets the "at target" timer and clears the previous error.
virtual bool isSettled(double ierror)
Returns whether the controller is settled.
SettledUtil(std::unique_ptr< AbstractTimer > iatTargetTimer, double iatTargetError=50, double iatTargetDerivative=5, QTime iatTargetTime=250_ms)
A utility class to determine if a control loop has settled based on error.
std::unique_ptr< AbstractTimer > atTargetTimer