1#ifndef FANG_ROBOTICS_MCB_TRAP_WRAPPED_FLOAT_HPP
2#define FANG_ROBOTICS_MCB_TRAP_WRAPPED_FLOAT_HPP
12 template<
typename Unit>
18 : m_wrappedFloat{static_cast<float>(value),static_cast<float>(lowerBound), static_cast<float>(upperBound)}
29 return m_wrappedFloat == other.m_wrappedFloat;
34 m_wrappedFloat += other.m_wrappedFloat;
39 m_wrappedFloat -= other.m_wrappedFloat;
44 return WrappedFloat {m_wrappedFloat + other.m_wrappedFloat};
49 return WrappedFloat {m_wrappedFloat - other.m_wrappedFloat};
59 return Unit{m_wrappedFloat.
minDifference(
static_cast<float>(unwrappedValue))};
64 m_wrappedFloat.
shiftBounds(
static_cast<float>(shiftMagnitude));
71 static_cast<float>(min),
72 static_cast<float>(max),
74 return Unit{floatValue};
83 return Unit{floatValue};
88 return m_wrappedFloat.
withinRange(lowerBound.m_wrappedFloat, upperBound.m_wrappedFloat);
94 const float floatResult{
TappedFloat::rangeOverlap(lowerA.m_wrappedFloat, upperA.m_wrappedFloat, lowerB.m_wrappedFloat, upperB.m_wrappedFloat)};
95 return Unit{floatResult};
138 operator double()
const
143 operator Unit()
const
Definition wrapped_float.hpp:51
WrappedFloat getNormalized() const
Definition wrapped_float.hpp:315
float getLowerBound() const
Definition wrapped_float.hpp:335
float getWrappedValue() const
Definition wrapped_float.hpp:294
void setUnwrappedValue(float newUnwrappedValue)
Definition wrapped_float.hpp:308
static float limitValue(const WrappedFloat &valueToLimit, const WrappedFloat &min, const WrappedFloat &max, int *status)
Definition wrapped_float.cpp:153
float minDifference(const WrappedFloat &other) const
Definition wrapped_float.cpp:97
bool withinRange(const WrappedFloat &lowerBound, const WrappedFloat &upperBound) const
Definition wrapped_float.cpp:190
void shiftBounds(float shiftMagnitude)
Definition wrapped_float.cpp:121
float getUpperBound() const
Definition wrapped_float.hpp:330
static float rangeOverlap(const WrappedFloat &lowerA, const WrappedFloat &upperA, const WrappedFloat &lowerB, const WrappedFloat &upperB)
Definition wrapped_float.cpp:200
void setWrappedValue(float newWrappedValue)
Definition wrapped_float.hpp:299
int getRevolutions() const
Definition wrapped_float.hpp:325
float getUnwrappedValue() const
Definition wrapped_float.hpp:286
Definition wrapped_float.hpp:14
Unit getWrappedValue() const
Definition wrapped_float.hpp:103
Unit minDifference(const WrappedFloat &other) const
Definition wrapped_float.hpp:52
bool operator==(const WrappedFloat &other) const
Definition wrapped_float.hpp:27
bool withinRange(const WrappedFloat &lowerBound, const WrappedFloat upperBound) const
Definition wrapped_float.hpp:86
static Unit limitValue(const WrappedFloat &valueToLimit, const WrappedFloat &min, const WrappedFloat &max, int *status)
Definition wrapped_float.hpp:77
void operator+=(const WrappedFloat &other)
Definition wrapped_float.hpp:32
void operator-=(const WrappedFloat &other)
Definition wrapped_float.hpp:37
WrappedFloat(Unit value, Unit lowerBound, Unit upperBound)
Definition wrapped_float.hpp:17
int getRevolutions() const
Definition wrapped_float.hpp:123
Unit getUpperBound() const
Definition wrapped_float.hpp:128
Unit minDifference(const Unit &unwrappedValue) const
Definition wrapped_float.hpp:57
WrappedFloat operator+(const WrappedFloat &other) const
Definition wrapped_float.hpp:42
Unit getLowerBound() const
Definition wrapped_float.hpp:133
void setWrappedValue(const Unit &newValue)
Definition wrapped_float.hpp:108
WrappedFloat(const tap::algorithms::WrappedFloat &wrappedFloat)
Definition wrapped_float.hpp:22
WrappedFloat getNormalized() const
Definition wrapped_float.hpp:118
void shiftBounds(Unit shiftMagnitude)
Definition wrapped_float.hpp:62
void setUnwrappedValue(const Unit &newValue)
Definition wrapped_float.hpp:113
static Unit limitValue(const WrappedFloat &valueToLimit, const Unit min, const Unit max, int *status)
Definition wrapped_float.hpp:68
Unit getUnwrappedValue() const
Definition wrapped_float.hpp:98
WrappedFloat operator-(const WrappedFloat &other) const
Definition wrapped_float.hpp:47
static Unit rangeOverlap(const WrappedFloat &lowerA, const WrappedFloat &upperA, const WrappedFloat &lowerB, const WrappedFloat &upperB)
Definition wrapped_float.hpp:91
tap::algorithms::WrappedFloat TappedFloat
Definition wrapped_float.hpp:16
Definition dimensional_smooth_pid.hpp:8