Rigid Body Dynamics Library
RigidBodyDynamics::Math Namespace Reference

Math types such as vectors and matrices and utility functions. More...

Data Structures

class  Quaternion
 Quaternion that are used for singularity free joints. More...
 
struct  SpatialRigidBodyInertia
 Compact representation for Spatial Inertia. More...
 
struct  SpatialTransform
 Compact representation of spatial transformations. More...
 

Typedefs

typedef Vector3_t Vector3d
 
typedef Vector4_t Vector4d
 
typedef Matrix3_t Matrix3d
 
typedef SpatialVector_t SpatialVector
 
typedef SpatialMatrix_t SpatialMatrix
 
typedef Matrix63_t Matrix63
 
typedef VectorN_t VectorNd
 
typedef MatrixN_t MatrixNd
 

Functions

RBDL_DLLAPI Vector3d Vector3dZero (0., 0., 0.)
 
RBDL_DLLAPI Matrix3d Matrix3dIdentity (1., 0., 0., 0., 1., 0., 0., 0., 1)
 
RBDL_DLLAPI Matrix3d Matrix3dZero (0., 0., 0., 0., 0., 0., 0., 0., 0.)
 
RBDL_DLLAPI SpatialVector SpatialVectorZero (0., 0., 0., 0., 0., 0.)
 
RBDL_DLLAPI SpatialMatrix SpatialMatrixIdentity (1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 1.)
 
RBDL_DLLAPI SpatialMatrix SpatialMatrixZero (0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.)
 
RBDL_DLLAPI bool LinSolveGaussElimPivot (MatrixNd A, VectorNd b, VectorNd &x)
 Solves a linear system using gaussian elimination with pivoting. More...
 
RBDL_DLLAPI void SpatialMatrixSetSubmatrix (SpatialMatrix &dest, unsigned int row, unsigned int col, const Matrix3d &matrix)
 
RBDL_DLLAPI bool SpatialMatrixCompareEpsilon (const SpatialMatrix &matrix_a, const SpatialMatrix &matrix_b, double epsilon)
 
RBDL_DLLAPI bool SpatialVectorCompareEpsilon (const SpatialVector &vector_a, const SpatialVector &vector_b, double epsilon)
 
RBDL_DLLAPI Matrix3d parallel_axis (const Matrix3d &inertia, double mass, const Vector3d &com)
 Translates the inertia matrix to a new center. More...
 
RBDL_DLLAPI SpatialMatrix Xtrans_mat (const Vector3d &displacement)
 Creates a transformation of a linear displacement. More...
 
RBDL_DLLAPI SpatialMatrix Xrotx_mat (const double &xrot)
 Creates a rotational transformation around the X-axis. More...
 
RBDL_DLLAPI SpatialMatrix Xroty_mat (const double &yrot)
 Creates a rotational transformation around the Y-axis. More...
 
RBDL_DLLAPI SpatialMatrix Xrotz_mat (const double &zrot)
 Creates a rotational transformation around the Z-axis. More...
 
RBDL_DLLAPI SpatialMatrix XtransRotZYXEuler (const Vector3d &displacement, const Vector3d &zyx_euler)
 Creates a spatial transformation for given parameters. More...
 
RBDL_DLLAPI void SparseFactorizeLTL (Model &model, Math::MatrixNd &H)
 
RBDL_DLLAPI void SparseMultiplyHx (Model &model, Math::MatrixNd &L)
 
RBDL_DLLAPI void SparseMultiplyLx (Model &model, Math::MatrixNd &L)
 
RBDL_DLLAPI void SparseMultiplyLTx (Model &model, Math::MatrixNd &L)
 
RBDL_DLLAPI void SparseSolveLx (Model &model, Math::MatrixNd &L, Math::VectorNd &x)
 
RBDL_DLLAPI void SparseSolveLTx (Model &model, Math::MatrixNd &L, Math::VectorNd &x)
 
RBDL_DLLAPI VectorNd VectorFromPtr (unsigned int n, double *ptr)
 
RBDL_DLLAPI MatrixNd MatrixFromPtr (unsigned int rows, unsigned int cols, double *ptr, bool row_major=true)
 
RBDL_DLLAPI Matrix3d rotx (const double &xrot)
 
RBDL_DLLAPI Matrix3d roty (const double &yrot)
 
RBDL_DLLAPI Matrix3d rotz (const double &zrot)
 
RBDL_DLLAPI Matrix3d rotxdot (const double &x, const double &xdot)
 
RBDL_DLLAPI Matrix3d rotydot (const double &y, const double &ydot)
 
RBDL_DLLAPI Matrix3d rotzdot (const double &z, const double &zdot)
 
RBDL_DLLAPI Vector3d angular_velocity_from_angle_rates (const Vector3d &zyx_angles, const Vector3d &zyx_angle_rates)
 
RBDL_DLLAPI Vector3d global_angular_velocity_from_rates (const Vector3d &zyx_angles, const Vector3d &zyx_rates)
 
RBDL_DLLAPI Vector3d angular_acceleration_from_angle_rates (const Vector3d &zyx_angles, const Vector3d &zyx_angle_rates, const Vector3d &zyx_angle_rates_dot)
 
Matrix3d VectorCrossMatrix (const Vector3d &vector)
 
std::ostream & operator<< (std::ostream &output, const SpatialRigidBodyInertia &rbi)
 
std::ostream & operator<< (std::ostream &output, const SpatialTransform &X)
 
SpatialTransform Xrot (double angle_rad, const Vector3d &axis)
 
SpatialTransform Xrotx (const double &xrot)
 
SpatialTransform Xroty (const double &yrot)
 
SpatialTransform Xrotz (const double &zrot)
 
SpatialTransform Xtrans (const Vector3d &r)
 
SpatialMatrix crossm (const SpatialVector &v)
 
SpatialVector crossm (const SpatialVector &v1, const SpatialVector &v2)
 
SpatialMatrix crossf (const SpatialVector &v)
 
SpatialVector crossf (const SpatialVector &v1, const SpatialVector &v2)
 

Variables

RBDL_DLLAPI Vector3d Vector3dZero
 
RBDL_DLLAPI Matrix3d Matrix3dIdentity
 
RBDL_DLLAPI Matrix3d Matrix3dZero
 
RBDL_DLLAPI SpatialVector SpatialVectorZero
 
RBDL_DLLAPI SpatialMatrix SpatialMatrixIdentity
 
RBDL_DLLAPI SpatialMatrix SpatialMatrixZero
 

Detailed Description

Math types such as vectors and matrices and utility functions.

Typedef Documentation

Definition at line 53 of file rbdl_math.h.

Definition at line 56 of file rbdl_math.h.

Definition at line 58 of file rbdl_math.h.

Definition at line 55 of file rbdl_math.h.

Definition at line 54 of file rbdl_math.h.

Definition at line 51 of file rbdl_math.h.

Definition at line 52 of file rbdl_math.h.

Definition at line 57 of file rbdl_math.h.

Function Documentation

RBDL_DLLAPI Vector3d RigidBodyDynamics::Math::angular_acceleration_from_angle_rates ( const Vector3d zyx_angles,
const Vector3d zyx_angle_rates,
const Vector3d zyx_angle_rates_dot 
)
inline
RBDL_DLLAPI Vector3d RigidBodyDynamics::Math::angular_velocity_from_angle_rates ( const Vector3d zyx_angles,
const Vector3d zyx_angle_rates 
)
inline

Definition at line 205 of file rbdl_mathutils.h.

SpatialMatrix RigidBodyDynamics::Math::crossf ( const SpatialVector v)
inline

Definition at line 425 of file SpatialAlgebraOperators.h.

SpatialVector RigidBodyDynamics::Math::crossf ( const SpatialVector v1,
const SpatialVector v2 
)
inline

Definition at line 436 of file SpatialAlgebraOperators.h.

SpatialMatrix RigidBodyDynamics::Math::crossm ( const SpatialVector v)
inline

Definition at line 403 of file SpatialAlgebraOperators.h.

SpatialVector RigidBodyDynamics::Math::crossm ( const SpatialVector v1,
const SpatialVector v2 
)
inline

Definition at line 414 of file SpatialAlgebraOperators.h.

RBDL_DLLAPI Vector3d RigidBodyDynamics::Math::global_angular_velocity_from_rates ( const Vector3d zyx_angles,
const Vector3d zyx_rates 
)
inline

Definition at line 218 of file rbdl_mathutils.h.

References roty(), and rotz().

RBDL_DLLAPI bool LinSolveGaussElimPivot ( MatrixNd  A,
VectorNd  b,
VectorNd x 
)

Solves a linear system using gaussian elimination with pivoting.

Definition at line 54 of file rbdl_mathutils.cc.

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::Matrix3dIdentity ( 1.  ,
0.  ,
0.  ,
0.  ,
1.  ,
0.  ,
0.  ,
0.  ,
 
)
RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::Matrix3dZero ( 0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.   
)
RBDL_DLLAPI MatrixNd RigidBodyDynamics::Math::MatrixFromPtr ( unsigned int  rows,
unsigned int  cols,
double *  ptr,
bool  row_major = true 
)
inline
std::ostream& RigidBodyDynamics::Math::operator<< ( std::ostream &  output,
const SpatialTransform X 
)
inline

Definition at line 324 of file SpatialAlgebraOperators.h.

References SpatialTransform::E, and SpatialTransform::r.

RBDL_DLLAPI Matrix3d parallel_axis ( const Matrix3d inertia,
double  mass,
const Vector3d com 
)

Translates the inertia matrix to a new center.

Definition at line 204 of file rbdl_mathutils.cc.

References VectorCrossMatrix().

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::rotx ( const double &  xrot)
inline

Definition at line 139 of file rbdl_mathutils.h.

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::rotxdot ( const double &  x,
const double &  xdot 
)
inline

Definition at line 172 of file rbdl_mathutils.h.

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::roty ( const double &  yrot)
inline

Definition at line 150 of file rbdl_mathutils.h.

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::rotydot ( const double &  y,
const double &  ydot 
)
inline

Definition at line 183 of file rbdl_mathutils.h.

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::rotz ( const double &  zrot)
inline

Definition at line 161 of file rbdl_mathutils.h.

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::rotzdot ( const double &  z,
const double &  zdot 
)
inline

Definition at line 194 of file rbdl_mathutils.h.

RBDL_DLLAPI void SparseFactorizeLTL ( Model model,
Math::MatrixNd H 
)

Definition at line 275 of file rbdl_mathutils.cc.

References Model::lambda_q, and Model::qdot_size.

RBDL_DLLAPI void SparseMultiplyHx ( Model model,
Math::MatrixNd L 
)

Definition at line 302 of file rbdl_mathutils.cc.

RBDL_DLLAPI void SparseMultiplyLTx ( Model model,
Math::MatrixNd L 
)

Definition at line 310 of file rbdl_mathutils.cc.

RBDL_DLLAPI void SparseMultiplyLx ( Model model,
Math::MatrixNd L 
)

Definition at line 306 of file rbdl_mathutils.cc.

RBDL_DLLAPI void SparseSolveLTx ( Model model,
Math::MatrixNd L,
Math::VectorNd x 
)

Definition at line 325 of file rbdl_mathutils.cc.

References Model::lambda_q, and Model::qdot_size.

RBDL_DLLAPI void SparseSolveLx ( Model model,
Math::MatrixNd L,
Math::VectorNd x 
)

Definition at line 314 of file rbdl_mathutils.cc.

References Model::lambda_q, and Model::qdot_size.

RBDL_DLLAPI bool SpatialMatrixCompareEpsilon ( const SpatialMatrix matrix_a,
const SpatialMatrix matrix_b,
double  epsilon 
)

Definition at line 162 of file rbdl_mathutils.cc.

RBDL_DLLAPI SpatialMatrix RigidBodyDynamics::Math::SpatialMatrixIdentity ( 1.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
1.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
1.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
1.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
1.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
1.   
)
RBDL_DLLAPI void SpatialMatrixSetSubmatrix ( SpatialMatrix dest,
unsigned int  row,
unsigned int  col,
const Matrix3d matrix 
)

Definition at line 142 of file rbdl_mathutils.cc.

RBDL_DLLAPI SpatialMatrix RigidBodyDynamics::Math::SpatialMatrixZero ( 0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.   
)
RBDL_DLLAPI bool SpatialVectorCompareEpsilon ( const SpatialVector vector_a,
const SpatialVector vector_b,
double  epsilon 
)

Definition at line 184 of file rbdl_mathutils.cc.

RBDL_DLLAPI SpatialVector RigidBodyDynamics::Math::SpatialVectorZero ( 0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.   
)
RBDL_DLLAPI Vector3d RigidBodyDynamics::Math::Vector3dZero ( 0.  ,
0.  ,
0.   
)
Matrix3d RigidBodyDynamics::Math::VectorCrossMatrix ( const Vector3d vector)
inline

Definition at line 18 of file SpatialAlgebraOperators.h.

RBDL_DLLAPI VectorNd RigidBodyDynamics::Math::VectorFromPtr ( unsigned int  n,
double *  ptr 
)
inline

Definition at line 44 of file rbdl_mathutils.h.

SpatialTransform RigidBodyDynamics::Math::Xrot ( double  angle_rad,
const Vector3d axis 
)
inline

Definition at line 330 of file SpatialAlgebraOperators.h.

SpatialTransform RigidBodyDynamics::Math::Xrotx ( const double &  xrot)
inline

Definition at line 354 of file SpatialAlgebraOperators.h.

RBDL_DLLAPI SpatialMatrix Xrotx_mat ( const double &  xrot)

Creates a rotational transformation around the X-axis.

Creates a rotation around the current X-axis by the given angle (specified in radians).

Parameters
xrotRotation angle in radians.

Definition at line 224 of file rbdl_mathutils.cc.

SpatialTransform RigidBodyDynamics::Math::Xroty ( const double &  yrot)
inline

Definition at line 368 of file SpatialAlgebraOperators.h.

RBDL_DLLAPI SpatialMatrix Xroty_mat ( const double &  yrot)

Creates a rotational transformation around the Y-axis.

Creates a rotation around the current Y-axis by the given angle (specified in radians).

Parameters
yrotRotation angle in radians.

Definition at line 239 of file rbdl_mathutils.cc.

SpatialTransform RigidBodyDynamics::Math::Xrotz ( const double &  zrot)
inline

Definition at line 382 of file SpatialAlgebraOperators.h.

RBDL_DLLAPI SpatialMatrix Xrotz_mat ( const double &  zrot)

Creates a rotational transformation around the Z-axis.

Creates a rotation around the current Z-axis by the given angle (specified in radians).

Parameters
zrotRotation angle in radians.

Definition at line 254 of file rbdl_mathutils.cc.

SpatialTransform RigidBodyDynamics::Math::Xtrans ( const Vector3d r)
inline

Definition at line 396 of file SpatialAlgebraOperators.h.

RBDL_DLLAPI SpatialMatrix Xtrans_mat ( const Vector3d displacement)

Creates a transformation of a linear displacement.

This can be used to specify the translation to the joint center when adding a body to a model. See also section 2.8 in RBDA.

Note
The transformation returned is for motions. For a transformation for forces
one has to conjugate the matrix.
Parameters
displacementThe displacement as a 3D vector

Definition at line 213 of file rbdl_mathutils.cc.

RBDL_DLLAPI SpatialMatrix XtransRotZYXEuler ( const Vector3d displacement,
const Vector3d zyx_euler 
)

Creates a spatial transformation for given parameters.

Creates a transformation to a coordinate system that is first rotated and then translated.

Parameters
displacementThe displacement to the new origin
zyx_eulerThe orientation of the new coordinate system, specifyed by ZYX-Euler angles.

Definition at line 269 of file rbdl_mathutils.cc.

References Xrotx_mat(), Xroty_mat(), Xrotz_mat(), and Xtrans_mat().

Variable Documentation

RBDL_DLLAPI Matrix3d Matrix3dIdentity
RBDL_DLLAPI Matrix3d Matrix3dZero
RBDL_DLLAPI SpatialMatrix SpatialMatrixIdentity
RBDL_DLLAPI SpatialMatrix SpatialMatrixZero
RBDL_DLLAPI SpatialVector SpatialVectorZero
RBDL_DLLAPI Vector3d Vector3dZero