dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
misc_math.c File Reference
#include <stdbool.h>
#include <math.h>
#include "misc_math.h"
#include "physical_constants.h"

Go to the source code of this file.

Functions

float bound_min_max (float val, float min, float max)
 Bound input value between min and max. More...
 
float bound_sym (float val, float range)
 Bound input value within range (plus or minus) More...
 
float circular_modulus_deg (float err)
 Circular modulus. More...
 
float circular_modulus_rad (float err)
 
float expo3 (float x, int32_t g)
 Approximation an exponential scale curve. More...
 
float expoM (float x, int32_t g, float exponent)
 
float interpolate_value (const float fraction, const float beginVal, const float endVal)
 
float vectorn_magnitude (const float *v, int n)
 
float vector3_distances (const float *actual, const float *desired, float *out, bool normalize)
 
void vector2_clip (float *vels, float limit)
 
void vector2_rotate (const float *original, float *out, float angle)
 
float cubic_deadband (float in, float w, float b, float m, float r)
 
void cubic_deadband_setup (float w, float b, float *m, float *r)
 
float linear_interpolate (float const input, float const *curve, uint8_t num_points, const float input_min, const float input_max)
 
void randomize_addseed (uint32_t seed)
 
static uint32_t randomize_int32 ()
 
uint32_t randomize_int (uint32_t interval)
 
void apply_channel_deadband (float *value, float deadband)
 Apply deadband to Roll/Pitch/Yaw channels. More...
 

Variables

static uint32_t random_state [4] = { 0xdeadbeef, 0xfeedfeed, 0xcafebabe, 1234 }