Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
setpoint_continuous_jam_checker.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef TAPROOT_SETPOINT_CONTINUOUS_JAM_CHECKER_HPP_
25#define TAPROOT_SETPOINT_CONTINUOUS_JAM_CHECKER_HPP_
26
30
31namespace tap
32{
33namespace control
34{
35namespace setpoint
36{
46{
47public:
57 SetpointSubsystem* setpointSubsystem,
58 float distanceTolerance,
59 uint32_t temporalTolerance)
60 : setpointSubsystem(setpointSubsystem),
61 jamTimeout(temporalTolerance),
62 distanceTolerance(distanceTolerance)
63 {
64 }
65
69 void restart() { jamTimeout.restart(); }
70
81 inline bool check()
82 {
83 bool withinTolerance = tap::algorithms::compareFloatClose(
84 setpointSubsystem->getCurrentValue(),
85 setpointSubsystem->getSetpoint(),
86 distanceTolerance);
87 return jamTimeout.execute(!withinTolerance);
88 }
89
93 inline float getJamSetpointTolerance() const { return distanceTolerance; }
94
95private:
96 SetpointSubsystem* setpointSubsystem;
98 float distanceTolerance;
99}; // SetpointContinuousJamChecker
100
101} // namespace setpoint
102
103} // namespace control
104
105} // namespace tap
106
107#endif // TAPROOT_SETPOINT_CONTINUOUS_JAM_CHECKER_HPP_
Definition conditional_timer.hpp:44
void restart()
Definition conditional_timer.hpp:55
bool execute(bool condition)
Definition conditional_timer.hpp:82
Definition setpoint_continuous_jam_checker.hpp:46
bool check()
Definition setpoint_continuous_jam_checker.hpp:81
void restart()
Definition setpoint_continuous_jam_checker.hpp:69
float getJamSetpointTolerance() const
Definition setpoint_continuous_jam_checker.hpp:93
SetpointContinuousJamChecker(SetpointSubsystem *setpointSubsystem, float distanceTolerance, uint32_t temporalTolerance)
Definition setpoint_continuous_jam_checker.hpp:56
Definition setpoint_subsystem.hpp:48
virtual float getCurrentValue() const =0
virtual float getSetpoint() const =0
bool compareFloatClose(float val1, float val2, float epsilon)
Definition math_user_utils.hpp:57
Definition ballistics.cpp:29