Namespaces | Classes | Typedefs | Functions | Variables
sr_math_utils Namespace Reference

Namespaces

namespace  filters

Classes

class  Random_

Typedefs

typedef
boost::detail::thread::singleton
< class Random_
Random

Functions

static uint64_t counter_with_overflow (uint64_t full_value, uint16_t new_value)
static int ipow (int base, int exp)
static bool is_bit_mask_index_false (long int bit_mask, int index)
static bool is_bit_mask_index_true (long int bit_mask, int index)
static double linear_interpolate_ (double x, double x0, double y0, double x1, double y1)
static int sign (double x)
static double to_degrees (double rad)
static double to_rad (double degrees)

Variables

static const double pi = 3.14159265

Typedef Documentation

typedef boost::detail::thread::singleton< class Random_ > sr_math_utils::Random

This is the usable singleton of the Random class.

The typical usage for this class is: -> generate double betwen 0 and 1 sr_math_utils::Random::instance().generate<double>()

-> generate integer between 0 and 10 sr_math_utils::Random::instance().generate<int>(0, 10)

-> generate double betwen 0 and 10 sr_math_utils::Random::instance().generate<double>(0, 10)

Definition at line 310 of file sr_math_utils.hpp.


Function Documentation

static uint64_t sr_math_utils::counter_with_overflow ( uint64_t  full_value,
uint16_t  new_value 
) [inline, static]

Increment a counter given a value which can overflow.

WARNING: only works if called often enough: if new_value > last_value but overflowed between the 2 calls, then we're not able to detect the overflow.

Parameters:
full_valuethe full value (with no overflow)
new_valuethe new value we received from the motor.
Returns:
The new full value

Definition at line 98 of file sr_math_utils.hpp.

static int sr_math_utils::ipow ( int  base,
int  exp 
) [inline, static]

Definition at line 63 of file sr_math_utils.hpp.

static bool sr_math_utils::is_bit_mask_index_false ( long int  bit_mask,
int  index 
) [inline, static]

Definition at line 83 of file sr_math_utils.hpp.

static bool sr_math_utils::is_bit_mask_index_true ( long int  bit_mask,
int  index 
) [inline, static]

Definition at line 76 of file sr_math_utils.hpp.

static double sr_math_utils::linear_interpolate_ ( double  x,
double  x0,
double  y0,
double  x1,
double  y1 
) [inline, static]

Interpolate linearly between the 2 points, for the given value

y = y0 + (x-x0)*((y1-y0)/(x1-x0))

Parameters:
xthe X value to compute the interpolation for.
x0the X value of our first point
y0the Y value of our first point
x1the X value of our second point
y1the Y value of our second point
Returns:
the computed Y value (calibrated value)

Definition at line 123 of file sr_math_utils.hpp.

static int sr_math_utils::sign ( double  x) [inline, static]

Checks the sign of a given number.

Parameters:
xthe number we want to study.
Returns:
1 if x is positive, -1 if negative.

Definition at line 145 of file sr_math_utils.hpp.

static double sr_math_utils::to_degrees ( double  rad) [inline, static]

Convert an angle in degrees to an angle in degrees.

Parameters:
radthe value in radians.
Returns:
the value in degrees.

Definition at line 59 of file sr_math_utils.hpp.

static double sr_math_utils::to_rad ( double  degrees) [inline, static]

Convert an angle in degrees to an angle in radians.

Parameters:
degreesthe value in degrees
Returns:
the value in radians.

Definition at line 48 of file sr_math_utils.hpp.


Variable Documentation

const double sr_math_utils::pi = 3.14159265 [static]

Definition at line 40 of file sr_math_utils.hpp.



sr_utilities
Author(s): Ugo Cupcic
autogenerated on Fri Aug 21 2015 12:24:47