![]() |
Hummingbird Flight Software
Flight software for the Hummingbird FCU quadcopter flight controller. Designed to run on the Teensy 4.1. Developed with VSCode+PlatformIO.
|
#include <Arduino.h>#include <math.h>#include <float.h>#include "constants.h"#include "hummingbird_config.h"Go to the source code of this file.
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<typename T > | |
| float | sqrtf_safe (const T val) |
| Compute safe square root of a value. More... | |
| template<typename T > | |
| float | asinf_safe (const T val) |
| Take the arcsine of a number with safety checks. More... | |
| float asinf_safe | ( | const T | val | ) |
Take the arcsine of a number with safety checks.
Return float
| val | Value to take the arcsine of |
| float InvSqrtf | ( | float | num | ) |
Extra math functions such as fast square root, 'safe' trig.
functions, etc.
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 |
| float sqrtf_safe | ( | const T | val | ) |
Compute safe square root of a value.
Checks for NaN's
| val | Value to take square root of. |