state-observation 1.7.0
General implementation of observers.
Loading...
Searching...
No Matches
miscellaneous-algorithms.hpp File Reference

Gathers many kinds of algorithms. More...

#include <boost/utility.hpp>
#include <cmath>
#include <state-observation/api.h>
#include <state-observation/tools/definitions.hpp>
Include dependency graph for miscellaneous-algorithms.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  stateObservation
 Filtering of divergent component of motion (DCM) and estimation of a bias betweeen the DCM and the corresponding zero moment point for a linearized inverted pendulum model.

Functions

template<class T>
stateObservation::tools::square (const T &x)
 computes the square of a value of any type
template<class T>
stateObservation::tools::derivate (const T &o1, const T &o2, double dt)
 derivates any type with finite differences
template<typename T>
int stateObservation::tools::signum (T x)
 gives the sign of a variable (1, 0 or -1)
template<typename T>
std::string stateObservation::tools::toString (T val)
bool stateObservation::tools::checkIfNormalized (const Vector3 &v)
 checks if the vector is already normalized or not
bool stateObservation::tools::checkIfNormalized (const Vector3 &v, double &outputSquaredNorm)
 checks if the vector is already normalized or not
template<typename T>
stateObservation::tools::clampScalar (const T &x, const T &max, const T &min)
 returns the value clamped between min and max
template<typename T>
stateObservation::tools::clampScalar (const T &x, const T &limit)
 returns the value clamped between limit and -limit
Vector3 stateObservation::tools::normalizedLazy (const Vector3 &v)
 normalize the vector only if it is not normalized already. Useful if the vector is likely to be normalized
double STATE_OBSERVATION_DLLAPI stateObservation::tools::finiteTimeAccControl (double x, double xd, double kp=-1, double kv=-1)
Vector STATE_OBSERVATION_DLLAPI stateObservation::tools::finiteTimeAccControl (const Vector &x, const Vector &xd, double kp=-1, double kv=-1)
 sqme as the scalar version but for every member of the vector
double constexpr stateObservation::tools::Detail::sqrtNewtonRaphson (double x, double curr, double prev)
double constexpr stateObservation::tools::sqrt (double x)
 Constexpr version of the square root.

Detailed Description

Gathers many kinds of algorithms.

Author
Mehdi Benallegue
Date
2013

Definition in file miscellaneous-algorithms.hpp.

Function Documentation

◆ square()

template<class T>
T stateObservation::tools::square ( const T & x)
inline

computes the square of a value of any type

Definition at line 26 of file miscellaneous-algorithms.hpp.

◆ derivate()

template<class T>
T stateObservation::tools::derivate ( const T & o1,
const T & o2,
double dt )
inline

derivates any type with finite differences

Definition at line 33 of file miscellaneous-algorithms.hpp.

◆ signum()

template<typename T>
int stateObservation::tools::signum ( T x)
inline

gives the sign of a variable (1, 0 or -1)

Definition at line 41 of file miscellaneous-algorithms.hpp.

◆ toString()

template<typename T>
std::string stateObservation::tools::toString ( T val)
inline

Definition at line 47 of file miscellaneous-algorithms.hpp.

◆ checkIfNormalized() [1/2]

bool stateObservation::tools::checkIfNormalized ( const Vector3 & v)
inline

checks if the vector is already normalized or not

Parameters
vthe vector to normalize
Returns
true the vector is normalized
false The vector is not normalized

Definition at line 59 of file miscellaneous-algorithms.hpp.

◆ checkIfNormalized() [2/2]

bool stateObservation::tools::checkIfNormalized ( const Vector3 & v,
double & outputSquaredNorm )
inline

checks if the vector is already normalized or not

Parameters
vthe vector to normalize
outputSquaredNormthe squared norm as an output
Returns
true the vector is normalized
false The vector is not normalized

Definition at line 77 of file miscellaneous-algorithms.hpp.

◆ clampScalar() [1/2]

template<typename T>
T stateObservation::tools::clampScalar ( const T & x,
const T & max,
const T & min )
inline

returns the value clamped between min and max

Template Parameters
TThe type of the scalar
Parameters
xthe input value
maxthe max value
minthe min value
Returns
T the calmped value

Definition at line 98 of file miscellaneous-algorithms.hpp.

◆ clampScalar() [2/2]

template<typename T>
T stateObservation::tools::clampScalar ( const T & x,
const T & limit )
inline

returns the value clamped between limit and -limit

Template Parameters
TThe type of the scalar
Parameters
xthe input value
limitis the maximum absolute value allowed, has to be positive
Returns
T the clamped value

Definition at line 124 of file miscellaneous-algorithms.hpp.

◆ normalizedLazy()

Vector3 stateObservation::tools::normalizedLazy ( const Vector3 & v)
inline

normalize the vector only if it is not normalized already. Useful if the vector is likely to be normalized

Parameters
vthe input vector
Returns
Vector3

Definition at line 133 of file miscellaneous-algorithms.hpp.

◆ finiteTimeAccControl() [1/2]

double STATE_OBSERVATION_DLLAPI stateObservation::tools::finiteTimeAccControl ( double x,
double xd,
double kp = -1,
double kv = -1 )
inline

provides an acceleration giving a finite time convergence to zero the state is the position x and the derivative xd and the output is the acceleration. The gains kp, kv must be negative

Definition at line 149 of file miscellaneous-algorithms.hpp.

◆ finiteTimeAccControl() [2/2]

Vector STATE_OBSERVATION_DLLAPI stateObservation::tools::finiteTimeAccControl ( const Vector & x,
const Vector & xd,
double kp = -1,
double kv = -1 )
inline

sqme as the scalar version but for every member of the vector

Definition at line 159 of file miscellaneous-algorithms.hpp.

◆ sqrtNewtonRaphson()

double constexpr stateObservation::tools::Detail::sqrtNewtonRaphson ( double x,
double curr,
double prev )
constexpr

Definition at line 174 of file miscellaneous-algorithms.hpp.

◆ sqrt()

double constexpr stateObservation::tools::sqrt ( double x)
constexpr

Constexpr version of the square root.

For a finite and non-negative value of "x", returns an approximation for the square root of "x" -Otherwise, returns NaN

Parameters
x
Returns
double constexpr

Definition at line 186 of file miscellaneous-algorithms.hpp.