Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
linear_interpolation_predictor_wrapped.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_LINEAR_INTERPOLATION_PREDICTOR_WRAPPED_HPP_
25#define TAPROOT_LINEAR_INTERPOLATION_PREDICTOR_WRAPPED_HPP_
26
27#include <cstdint>
28
29#include "wrapped_float.hpp"
30
31namespace tap::algorithms
32{
38{
39public:
44 LinearInterpolationPredictorWrapped(float lowerBound, float upperBound);
45
56 void update(float newValue, uint32_t currTime);
57
70 float getInterpolatedValue(uint32_t currTime)
71 {
72 return WrappedFloat(
73 slope * static_cast<float>(currTime - lastUpdateCallTime) +
74 previousValue.getWrappedValue(),
75 previousValue.getLowerBound(),
76 previousValue.getUpperBound())
78 }
79
90 void reset(float initialValue, uint32_t initialTime);
91
92private:
93 uint32_t lastUpdateCallTime;
94 WrappedFloat previousValue;
95 float slope;
96}; // class LinearInterpolationPredictorWrapped
97
98} // namespace tap::algorithms
99
100#endif // TAPROOT_LINEAR_INTERPOLATION_PREDICTOR_WRAPPED_HPP_
Definition linear_interpolation_predictor_wrapped.hpp:38
void reset(float initialValue, uint32_t initialTime)
Definition linear_interpolation_predictor_wrapped.cpp:49
float getInterpolatedValue(uint32_t currTime)
Definition linear_interpolation_predictor_wrapped.hpp:70
void update(float newValue, uint32_t currTime)
Definition linear_interpolation_predictor_wrapped.cpp:37
Definition wrapped_float.hpp:51
float getLowerBound() const
Definition wrapped_float.hpp:335
float getWrappedValue() const
Definition wrapped_float.hpp:294
float getUpperBound() const
Definition wrapped_float.hpp:330
Definition ballistics.cpp:29