Macros | Functions | Variables
utils.h File Reference

Utility header file. More...

#include <stdio.h>
#include <limits>
#include "newmatap.h"
#include "newmatio.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GRAVITY   9.81
 
#define M_PI   3.14159265358979
 
#define WANT_FSTREAM   /* include.h will get fstream fns */
 
#define WANT_MATH   /* include.h will get math fns */
 
#define WANT_STREAM   /* include.h will get stream fns */
 
#define WANT_STRING   /* include.h will get string fns */
 

Functions

double deg2rad (const double angle_deg)
 
ReturnMatrix eulzxz (const ColumnVector &a)
 Euler ZXZ rotation. More...
 
ReturnMatrix ieulzxz (const Matrix &R)
 Obtain Roll, Pitch and Yaw from a rotation matrix. More...
 
ReturnMatrix Integ_Trap (const ColumnVector &present, ColumnVector &past, const Real dt)
 Trapezoidal integration. More...
 
ReturnMatrix irotk (const Matrix &R)
 Obtain axis from a rotation matrix. More...
 
ReturnMatrix irpy (const Matrix &R)
 Obtain Roll, Pitch and Yaw from a rotation matrix. More...
 
bool isZero (const double x)
 
void odeint (ReturnMatrix(*xdot)(Real time, const Matrix &xin), Matrix &xo, Real to, Real tf, Real eps, Real h1, Real hmin, int &nok, int &nbad, RowVector &tout, Matrix &xout, Real dtsav)
 Integrate the ordinary differential equation xdot from time to to time tf using an adaptive step size strategy. More...
 
ReturnMatrix pinv (const Matrix &M)
 Matrix pseudo inverse using SVD. More...
 
double rad2deg (const double angle_rad)
 
ReturnMatrix rotd (const Real theta, const ColumnVector &k1, const ColumnVector &k2)
 Rotation around an arbitrary line. More...
 
ReturnMatrix rotk (const Real theta, const ColumnVector &k)
 Rotation around arbitrary axis. More...
 
ReturnMatrix rotx (const Real alpha)
 Rotation around x axis. More...
 
ReturnMatrix roty (const Real beta)
 Rotation around x axis. More...
 
ReturnMatrix rotz (const Real gamma)
 Rotation around z axis. More...
 
ReturnMatrix rpy (const ColumnVector &a)
 Roll Pitch Yaw rotation. More...
 
void Runge_Kutta4 (ReturnMatrix(*xdot)(Real time, const Matrix &xin), const Matrix &xo, Real to, Real tf, int nsteps, RowVector &tout, Matrix &xout)
 Fixed step size fourth-order Runge-Kutta integrator. More...
 
void Runge_Kutta4_Real_time (ReturnMatrix(*xdot)(Real time, const Matrix &xin), const Matrix &xo, Real to, Real tf, int nsteps)
 
void Runge_Kutta4_Real_time (ReturnMatrix(*xdot)(Real time, const Matrix &xin, bool &exit, bool &init), const Matrix &xo, Real to, Real tf, int nsteps)
 Fixed step size fourth-order Runge-Kutta integrator. More...
 
ReturnMatrix sign (const Matrix &x)
 Sign of a matrix. More...
 
short sign (const Real x)
 Sign of real. More...
 
ReturnMatrix trans (const ColumnVector &a)
 Translation. More...
 
ReturnMatrix x_prod_matrix (const ColumnVector &x)
 Cross product matrix. More...
 

Variables

const double epsilon = 0.0000001
 
Real fourbyfourident []
 Used to initialize a $4\times 4$ matrix. More...
 
static const char header_utils_rcsid [] = "$Id: utils.h,v 1.10 2006/05/16 16:11:15 gourdeau Exp $"
 RCS/CVS version. More...
 
Real threebythreeident []
 Used to initialize a $3\times 3$ matrix. More...
 

Detailed Description

Utility header file.

Definition in file utils.h.

Macro Definition Documentation

#define GRAVITY   9.81

Definition at line 86 of file utils.h.

#define M_PI   3.14159265358979

Definition at line 83 of file utils.h.

#define WANT_FSTREAM   /* include.h will get fstream fns */

Definition at line 69 of file utils.h.

#define WANT_MATH   /* include.h will get math fns */

Definition at line 70 of file utils.h.

#define WANT_STREAM   /* include.h will get stream fns */

Definition at line 68 of file utils.h.

#define WANT_STRING   /* include.h will get string fns */

Definition at line 67 of file utils.h.

Function Documentation

double deg2rad ( const double  angle_deg)
inline

Definition at line 93 of file utils.h.

ReturnMatrix eulzxz ( const ColumnVector a)

Euler ZXZ rotation.

Definition at line 211 of file homogen.cpp.

ReturnMatrix ieulzxz ( const Matrix R)

Obtain Roll, Pitch and Yaw from a rotation matrix.

Definition at line 294 of file homogen.cpp.

ReturnMatrix Integ_Trap ( const ColumnVector present,
ColumnVector past,
const Real  dt 
)

Trapezoidal integration.

Definition at line 165 of file utils.cpp.

ReturnMatrix irotk ( const Matrix R)

Obtain axis from a rotation matrix.

Definition at line 253 of file homogen.cpp.

ReturnMatrix irpy ( const Matrix R)

Obtain Roll, Pitch and Yaw from a rotation matrix.

Definition at line 271 of file homogen.cpp.

bool isZero ( const double  x)
inline

Definition at line 128 of file utils.h.

void odeint ( ReturnMatrix(*)(Real time, const Matrix &xin)  xdot,
Matrix xo,
Real  to,
Real  tf,
Real  eps,
Real  h1,
Real  hmin,
int &  nok,
int &  nbad,
RowVector tout,
Matrix xout,
Real  dtsav 
)

Integrate the ordinary differential equation xdot from time to to time tf using an adaptive step size strategy.

adapted from: Numerical Recipes in C, The Art of Scientific Computing, Press, William H. and Flannery, Brian P. and Teukolsky, Saul A. and Vetterling, William T., Cambridge University Press, 1988.

Definition at line 347 of file utils.cpp.

ReturnMatrix pinv ( const Matrix M)

Matrix pseudo inverse using SVD.

If $ A = U^{*}QV $ is a singular value decomposition of A, then $ A^{\dagger} = V^{*}Q^{\dagger}U$ where $ X^{*} $ is the conjugate transpose of $ X $ and $ Q^{\dagger} = \left [ \begin{array}{cccc} 1/\sigma_1 & & & \\ & 1/\sigma_2& & \\ & & \ddots & \\ & & & 0 \end{array} \right ]$ where the $1/\sigma_i $ are replaced by 0 when $1/\sigma_i < tol $

Definition at line 99 of file utils.cpp.

double rad2deg ( const double  angle_rad)
inline

Definition at line 94 of file utils.h.

ReturnMatrix rotd ( const Real  theta,
const ColumnVector k1,
const ColumnVector k2 
)

Rotation around an arbitrary line.

Definition at line 240 of file homogen.cpp.

ReturnMatrix rotk ( const Real  theta,
const ColumnVector k 
)

Rotation around arbitrary axis.

Definition at line 149 of file homogen.cpp.

ReturnMatrix rotx ( const Real  alpha)

Rotation around x axis.

Definition at line 87 of file homogen.cpp.

ReturnMatrix roty ( const Real  beta)

Rotation around x axis.

Definition at line 107 of file homogen.cpp.

ReturnMatrix rotz ( const Real  gamma)

Rotation around z axis.

Definition at line 127 of file homogen.cpp.

ReturnMatrix rpy ( const ColumnVector a)

Roll Pitch Yaw rotation.

Definition at line 182 of file homogen.cpp.

void Runge_Kutta4 ( ReturnMatrix(*)(Real time, const Matrix &xin)  xdot,
const Matrix xo,
Real  to,
Real  tf,
int  nsteps,
RowVector tout,
Matrix xout 
)

Fixed step size fourth-order Runge-Kutta integrator.

Definition at line 232 of file utils.cpp.

void Runge_Kutta4_Real_time ( ReturnMatrix(*)(Real time, const Matrix &xin)  xdot,
const Matrix xo,
Real  to,
Real  tf,
int  nsteps 
)
void Runge_Kutta4_Real_time ( ReturnMatrix(*)(Real time, const Matrix &xin, bool &exit, bool &init)  xdot,
const Matrix xo,
Real  to,
Real  tf,
int  nsteps 
)

Fixed step size fourth-order Runge-Kutta integrator.

Definition at line 178 of file utils.cpp.

ReturnMatrix sign ( const Matrix x)

Sign of a matrix.

Definition at line 406 of file utils.cpp.

short sign ( const Real  x)

Sign of real.

Definition at line 425 of file utils.cpp.

ReturnMatrix trans ( const ColumnVector a)

Translation.

Definition at line 68 of file homogen.cpp.

ReturnMatrix x_prod_matrix ( const ColumnVector x)

Cross product matrix.

Definition at line 88 of file utils.cpp.

Variable Documentation

const double epsilon = 0.0000001

Definition at line 126 of file utils.h.

Real fourbyfourident[]

Used to initialize a $4\times 4$ matrix.

Definition at line 133 of file robot.cpp.

const char header_utils_rcsid[] = "$Id: utils.h,v 1.10 2006/05/16 16:11:15 gourdeau Exp $"
static

RCS/CVS version.

Definition at line 60 of file utils.h.

Real threebythreeident[]

Used to initialize a $3\times 3$ matrix.

Definition at line 136 of file robot.cpp.



kni
Author(s): Martin Günther
autogenerated on Fri Jan 3 2020 04:01:17