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 Vector2_t Vector2d
 
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 Matrix43_t Matrix43
 
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 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
 

Detailed Description

Math types such as vectors and matrices and utility functions.

Typedef Documentation

◆ Matrix3d

Definition at line 58 of file rbdl_math.h.

◆ Matrix43

Definition at line 62 of file rbdl_math.h.

◆ Matrix63

Definition at line 61 of file rbdl_math.h.

◆ MatrixNd

Definition at line 64 of file rbdl_math.h.

◆ SpatialMatrix

Definition at line 60 of file rbdl_math.h.

◆ SpatialVector

Definition at line 59 of file rbdl_math.h.

◆ Vector2d

Definition at line 55 of file rbdl_math.h.

◆ Vector3d

Definition at line 56 of file rbdl_math.h.

◆ Vector4d

Definition at line 57 of file rbdl_math.h.

◆ VectorNd

Definition at line 63 of file rbdl_math.h.

Function Documentation

◆ angular_acceleration_from_angle_rates()

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

◆ angular_velocity_from_angle_rates()

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

Definition at line 201 of file rbdl_mathutils.h.

◆ crossf() [1/2]

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

Definition at line 425 of file SpatialAlgebraOperators.h.

◆ crossf() [2/2]

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

Definition at line 436 of file SpatialAlgebraOperators.h.

◆ crossm() [1/2]

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

Definition at line 403 of file SpatialAlgebraOperators.h.

◆ crossm() [2/2]

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

Definition at line 414 of file SpatialAlgebraOperators.h.

◆ global_angular_velocity_from_rates()

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

Definition at line 214 of file rbdl_mathutils.h.

References roty(), and rotz().

◆ LinSolveGaussElimPivot()

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

Solves a linear system using gaussian elimination with pivoting.

Definition at line 36 of file rbdl_mathutils.cc.

◆ Matrix3dIdentity()

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::Matrix3dIdentity ( 1.  ,
0.  ,
0.  ,
0.  ,
1.  ,
0.  ,
0.  ,
0.  ,
 
)

◆ Matrix3dZero()

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::Matrix3dZero ( 0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.   
)

◆ MatrixFromPtr()

RBDL_DLLAPI MatrixNd RigidBodyDynamics::Math::MatrixFromPtr ( unsigned int  rows,
unsigned int  cols,
double *  ptr,
bool  row_major = true 
)
inline

◆ operator<<() [1/2]

◆ operator<<() [2/2]

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.

◆ parallel_axis()

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

Translates the inertia matrix to a new center.

Definition at line 186 of file rbdl_mathutils.cc.

References VectorCrossMatrix().

◆ rotx()

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

Definition at line 135 of file rbdl_mathutils.h.

◆ rotxdot()

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

Definition at line 168 of file rbdl_mathutils.h.

◆ roty()

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

Definition at line 146 of file rbdl_mathutils.h.

◆ rotydot()

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

Definition at line 179 of file rbdl_mathutils.h.

◆ rotz()

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

Definition at line 157 of file rbdl_mathutils.h.

◆ rotzdot()

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

Definition at line 190 of file rbdl_mathutils.h.

◆ SparseFactorizeLTL()

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

Definition at line 257 of file rbdl_mathutils.cc.

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

◆ SparseMultiplyHx()

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

Definition at line 284 of file rbdl_mathutils.cc.

◆ SparseMultiplyLTx()

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

Definition at line 292 of file rbdl_mathutils.cc.

◆ SparseMultiplyLx()

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

Definition at line 288 of file rbdl_mathutils.cc.

◆ SparseSolveLTx()

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

Definition at line 307 of file rbdl_mathutils.cc.

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

◆ SparseSolveLx()

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

Definition at line 296 of file rbdl_mathutils.cc.

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

◆ SpatialMatrixCompareEpsilon()

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

Definition at line 144 of file rbdl_mathutils.cc.

◆ SpatialMatrixSetSubmatrix()

RBDL_DLLAPI void SpatialMatrixSetSubmatrix ( SpatialMatrix dest,
unsigned int  row,
unsigned int  col,
const Matrix3d matrix 
)

Definition at line 124 of file rbdl_mathutils.cc.

◆ SpatialVectorCompareEpsilon()

RBDL_DLLAPI bool SpatialVectorCompareEpsilon ( const SpatialVector vector_a,
const SpatialVector vector_b,
double  epsilon 
)

Definition at line 166 of file rbdl_mathutils.cc.

◆ SpatialVectorZero()

RBDL_DLLAPI SpatialVector RigidBodyDynamics::Math::SpatialVectorZero ( 0.  ,
0.  ,
0.  ,
0.  ,
0.  ,
0.   
)

◆ Vector3dZero()

RBDL_DLLAPI Vector3d RigidBodyDynamics::Math::Vector3dZero ( 0.  ,
0.  ,
0.   
)

◆ VectorCrossMatrix()

Matrix3d RigidBodyDynamics::Math::VectorCrossMatrix ( const Vector3d vector)
inline

Definition at line 18 of file SpatialAlgebraOperators.h.

◆ VectorFromPtr()

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

Definition at line 40 of file rbdl_mathutils.h.

◆ Xrot()

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

Definition at line 330 of file SpatialAlgebraOperators.h.

◆ Xrotx()

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

Definition at line 354 of file SpatialAlgebraOperators.h.

◆ Xrotx_mat()

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 206 of file rbdl_mathutils.cc.

◆ Xroty()

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

Definition at line 368 of file SpatialAlgebraOperators.h.

◆ Xroty_mat()

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 221 of file rbdl_mathutils.cc.

◆ Xrotz()

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

Definition at line 382 of file SpatialAlgebraOperators.h.

◆ Xrotz_mat()

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 236 of file rbdl_mathutils.cc.

◆ Xtrans()

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

Definition at line 396 of file SpatialAlgebraOperators.h.

◆ Xtrans_mat()

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 195 of file rbdl_mathutils.cc.

◆ XtransRotZYXEuler()

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 251 of file rbdl_mathutils.cc.

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

Variable Documentation

◆ Matrix3dIdentity

RBDL_DLLAPI Matrix3d Matrix3dIdentity

◆ Matrix3dZero

RBDL_DLLAPI Matrix3d Matrix3dZero

◆ Vector3dZero

RBDL_DLLAPI Vector3d Vector3dZero