Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
ramp.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_RAMP_HPP_
25#define TAPROOT_RAMP_HPP_
26
27#include <cstdint>
28
29namespace tap
30{
31namespace algorithms
32{
42class Ramp
43{
44public:
50 explicit Ramp(float initialValue = 0.0f);
51
53 void reset(float val);
54
56 void setTarget(float target);
57
59 void setValue(float value);
60
69 void update(float increment);
70
72 float getValue() const;
73
75 bool isTargetReached() const;
76
78 float getTarget() const;
79
80private:
81 static constexpr float RAMP_EPSILON = 0.00000000001f;
82 float target;
83 float value;
84 bool targetReached;
85}; // class Ramp
86
87} // namespace algorithms
88
89} // namespace tap
90
91#endif // TAPROOT_RAMP_HPP_
Definition ramp.hpp:43
void setTarget(float target)
Sets a new target ramp value.
Definition ramp.cpp:43
void reset(float val)
Sets the target and value to the passed in val.
Definition ramp.cpp:36
float getValue() const
Returns the current value being generated by the ramp.
Definition ramp.cpp:62
void setValue(float value)
Sets the value to value.
Definition ramp.cpp:52
float getTarget() const
Returns the target value (where the ramp generator will head torwards).
Definition ramp.cpp:66
bool isTargetReached() const
Returns true if the value == target.
Definition ramp.cpp:64
void update(float increment)
Definition ramp.cpp:54
Definition ballistics.cpp:29