![]() |
Hummingbird Flight Software
Flight software for the Hummingbird FCU quadcopter flight controller. Designed to run on the Teensy 4.1. Developed with VSCode+PlatformIO.
|
Functions | |
float | InvSqrtf (float num) |
Extra math functions such as fast square root, 'safe' trig. More... | |
template<typename T > | |
T | RangeConstrain (const T val, const T lower, const T upper) |
Templates to constrain a value to a certain range. More... | |
template int | RangeConstrain< int > (int val, int lower, int upper) |
template uint16_t | RangeConstrain< uint16_t > (uint16_t val, uint16_t lower, uint16_t upper) |
template float | RangeConstrain< float > (const float val, const float lower, const float upper) |
template<typename T > | |
float | sqrtf_safe (const T val) |
Compute safe square root of a value. More... | |
template float | sqrtf_safe< int > (const int val) |
template float | sqrtf_safe< uint16_t > (const uint16_t val) |
template float | sqrtf_safe< float > (const float val) |
template<typename T > | |
float | asinf_safe (const T val) |
Take the arcsine of a number with safety checks. More... | |
template float | asinf_safe< int > (const int val) |
template float | asinf_safe< uint16_t > (const uint16_t val) |
template float | asinf_safe< float > (const float val) |
float asinf_safe | ( | const T | val | ) |
Take the arcsine of a number with safety checks.
Return float
val | Value to take the arcsine of |
template float asinf_safe< float > | ( | const float | val | ) |
template float asinf_safe< int > | ( | const int | val | ) |
template float asinf_safe< uint16_t > | ( | const uint16_t | val | ) |
float InvSqrtf | ( | float | num | ) |
Extra math functions such as fast square root, 'safe' trig.
functions, etc. norm = a * InvSqrtf(a); Fast inverse square root algorithm. Use when normalizing vectors! See: https://en.wikipedia.org/wiki/Fast_inverse_square_root
num | Number to square-root. |
T RangeConstrain | ( | const T | val, |
const T | lower, | ||
const T | upper | ||
) |
Templates to constrain a value to a certain range.
Works for floats, uint16, etc. If value is out of specified bounds, constrain it to be within the bounds.
val | Input value to constrain |
lower | Lower bound |
upper | Upper bound |
template float RangeConstrain< float > | ( | const float | val, |
const float | lower, | ||
const float | upper | ||
) |
template int RangeConstrain< int > | ( | int | val, |
int | lower, | ||
int | upper | ||
) |
template uint16_t RangeConstrain< uint16_t > | ( | uint16_t | val, |
uint16_t | lower, | ||
uint16_t | upper | ||
) |
float sqrtf_safe | ( | const T | val | ) |
Compute safe square root of a value.
Checks for NaN's
val | Value to take square root of. |
template float sqrtf_safe< float > | ( | const float | val | ) |
template float sqrtf_safe< int > | ( | const int | val | ) |
template float sqrtf_safe< uint16_t > | ( | const uint16_t | val | ) |