24#ifndef TAPROOT_WRAPPED_FLOAT_HPP_
25#define TAPROOT_WRAPPED_FLOAT_HPP_
31#include <modm/architecture/interface/assert.hpp>
32#include <modm/math/utils.hpp>
58 WrappedFloat(
float value,
float lowerBound,
float upperBound);
62 return WrappedFloat(value, this->lowerBound, this->upperBound);
288 return wrapped + (upperBound - lowerBound) * revolutions;
301 this->wrapped = newWrappedValue;
310 this->wrapped = newUnwrappedValue;
311 this->revolutions = 0;
373 "WrappedFloat::assertBoundsEqual",
374 "Lower bounds do not match");
377 "WrappedFloat::assertBoundsEqual",
378 "Upper bounds do not match");
381 inline void assertBoundsEqual(
const WrappedFloat& other)
const
383 assertBoundsEqual(*
this, other);
398 return Angle(modm::toRadian(degrees));
Definition wrapped_float.hpp:392
static WrappedFloat fromDegrees(const float degrees)
Definition wrapped_float.hpp:396
Angle(const float value)
Definition wrapped_float.hpp:394
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
WrappedFloat operator+(const WrappedFloat &other) const
Definition wrapped_float.cpp:65
static constexpr float EPSILON
Definition wrapped_float.hpp:341
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
bool operator==(const WrappedFloat &other) const
Definition wrapped_float.cpp:40
void operator+=(const WrappedFloat &other)
Definition wrapped_float.cpp:47
WrappedFloat withSameBounds(const float value) const
Definition wrapped_float.hpp:60
static float rangeOverlap(const WrappedFloat &lowerA, const WrappedFloat &upperA, const WrappedFloat &lowerB, const WrappedFloat &upperB)
Definition wrapped_float.cpp:200
WrappedFloat operator-(const WrappedFloat &other) const
Definition wrapped_float.cpp:74
void operator-=(const WrappedFloat &other)
Definition wrapped_float.cpp:56
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
WrappedFloat minInterpolate(const WrappedFloat &other, float alpha) const
Definition wrapped_float.cpp:114
bool compareFloatClose(float val1, float val2, float epsilon)
Definition math_user_utils.hpp:57
Definition ballistics.cpp:29