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 Vector1_t Scalar
 
typedef Vector2_t Vector2d
 
typedef Vector3_t Vector3d
 
typedef Vector4_t Vector4d
 
typedef Matrix2_t Matrix2d
 
typedef Matrix3_t Matrix3d
 
typedef SpatialVector_t SpatialVector
 
typedef SpatialMatrix_t SpatialMatrix
 
typedef Matrix63_t Matrix63
 
typedef Matrix43_t Matrix43
 
typedef Matrix4_t Matrix4d
 
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, Scalar epsilon)
 
RBDL_DLLAPI bool SpatialVectorCompareEpsilon (const SpatialVector &vector_a, const SpatialVector &vector_b, Scalar epsilon)
 
RBDL_DLLAPI Matrix3d parallel_axis (const Matrix3d &inertia, Scalar 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 Scalar &xrot)
 Creates a rotational transformation around the X-axis. More...
 
RBDL_DLLAPI SpatialMatrix Xroty_mat (const Scalar &yrot)
 Creates a rotational transformation around the Y-axis. More...
 
RBDL_DLLAPI SpatialMatrix Xrotz_mat (const Scalar &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, Scalar *ptr)
 
RBDL_DLLAPI MatrixNd MatrixFromPtr (unsigned int rows, unsigned int cols, Scalar *ptr, bool row_major=true)
 
RBDL_DLLAPI Matrix3d rotx (const Scalar &xrot)
 
RBDL_DLLAPI Matrix3d roty (const Scalar &yrot)
 
RBDL_DLLAPI Matrix3d rotz (const Scalar &zrot)
 
RBDL_DLLAPI Matrix3d rotxdot (const Scalar &x, const Scalar &xdot)
 
RBDL_DLLAPI Matrix3d rotydot (const Scalar &y, const Scalar &ydot)
 
RBDL_DLLAPI Matrix3d rotzdot (const Scalar &z, const Scalar &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 (Scalar angle_rad, const Vector3d &axis)
 
SpatialTransform Xrotx (const Scalar &xrot)
 
SpatialTransform Xroty (const Scalar &yrot)
 
SpatialTransform Xrotz (const Scalar &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

◆ Matrix2d

Definition at line 59 of file rbdl_math.h.

◆ Matrix3d

Definition at line 60 of file rbdl_math.h.

◆ Matrix43

Definition at line 64 of file rbdl_math.h.

◆ Matrix4d

Definition at line 65 of file rbdl_math.h.

◆ Matrix63

Definition at line 63 of file rbdl_math.h.

◆ MatrixNd

Definition at line 67 of file rbdl_math.h.

◆ Scalar

typedef Vector1_t Scalar

Definition at line 55 of file rbdl_math.h.

◆ SpatialMatrix

Definition at line 62 of file rbdl_math.h.

◆ SpatialVector

Definition at line 61 of file rbdl_math.h.

◆ Vector2d

Definition at line 56 of file rbdl_math.h.

◆ Vector3d

Definition at line 57 of file rbdl_math.h.

◆ Vector4d

Definition at line 58 of file rbdl_math.h.

◆ VectorNd

Definition at line 66 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

Definition at line 229 of file rbdl_mathutils.h.

References std::cos(), and std::sin().

◆ 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 205 of file rbdl_mathutils.h.

References std::cos(), and std::sin().

◆ 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 218 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 37 of file rbdl_mathutils.cc.

References MX_Xd_dynamic::cols(), std::fabs(), MX_Xd_dynamic::rows(), MX_Xd_dynamic::size(), and MX_Xd_dynamic::Zero().

◆ 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,
Scalar ptr,
bool  row_major = true 
)
inline

Definition at line 51 of file rbdl_mathutils.h.

◆ 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,
Scalar  mass,
const Vector3d com 
)

Translates the inertia matrix to a new center.

Definition at line 190 of file rbdl_mathutils.cc.

References VectorCrossMatrix().

◆ rotx()

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::rotx ( const Scalar xrot)
inline

Definition at line 139 of file rbdl_mathutils.h.

References std::cos(), and std::sin().

◆ rotxdot()

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

Definition at line 172 of file rbdl_mathutils.h.

References std::cos(), and std::sin().

◆ roty()

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::roty ( const Scalar yrot)
inline

Definition at line 150 of file rbdl_mathutils.h.

References std::cos(), and std::sin().

◆ rotydot()

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

Definition at line 183 of file rbdl_mathutils.h.

References std::cos(), and std::sin().

◆ rotz()

RBDL_DLLAPI Matrix3d RigidBodyDynamics::Math::rotz ( const Scalar zrot)
inline

Definition at line 161 of file rbdl_mathutils.h.

References std::cos(), and std::sin().

◆ rotzdot()

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

Definition at line 194 of file rbdl_mathutils.h.

References std::cos(), and std::sin().

◆ SparseFactorizeLTL()

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

Definition at line 261 of file rbdl_mathutils.cc.

References std::sqrt().

◆ SparseMultiplyHx()

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

Definition at line 288 of file rbdl_mathutils.cc.

◆ SparseMultiplyLTx()

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

Definition at line 296 of file rbdl_mathutils.cc.

◆ SparseMultiplyLx()

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

Definition at line 292 of file rbdl_mathutils.cc.

◆ SparseSolveLTx()

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

Definition at line 311 of file rbdl_mathutils.cc.

◆ SparseSolveLx()

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

Definition at line 300 of file rbdl_mathutils.cc.

◆ SpatialMatrixCompareEpsilon()

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

Definition at line 147 of file rbdl_mathutils.cc.

References std::fabs().

◆ SpatialMatrixSetSubmatrix()

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

Definition at line 126 of file rbdl_mathutils.cc.

◆ SpatialVectorCompareEpsilon()

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

Definition at line 169 of file rbdl_mathutils.cc.

References std::fabs().

◆ 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,
Scalar ptr 
)
inline

Definition at line 40 of file rbdl_mathutils.h.

◆ Xrot()

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

Definition at line 330 of file SpatialAlgebraOperators.h.

References std::cos(), and std::sin().

◆ Xrotx()

SpatialTransform RigidBodyDynamics::Math::Xrotx ( const Scalar xrot)
inline

Definition at line 354 of file SpatialAlgebraOperators.h.

References std::cos(), and std::sin().

◆ Xrotx_mat()

RBDL_DLLAPI SpatialMatrix Xrotx_mat ( const Scalar 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 210 of file rbdl_mathutils.cc.

References std::cos(), and std::sin().

◆ Xroty()

SpatialTransform RigidBodyDynamics::Math::Xroty ( const Scalar yrot)
inline

Definition at line 368 of file SpatialAlgebraOperators.h.

References std::cos(), and std::sin().

◆ Xroty_mat()

RBDL_DLLAPI SpatialMatrix Xroty_mat ( const Scalar 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 225 of file rbdl_mathutils.cc.

References std::cos(), and std::sin().

◆ Xrotz()

SpatialTransform RigidBodyDynamics::Math::Xrotz ( const Scalar zrot)
inline

Definition at line 382 of file SpatialAlgebraOperators.h.

References std::cos(), and std::sin().

◆ Xrotz_mat()

RBDL_DLLAPI SpatialMatrix Xrotz_mat ( const Scalar 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 240 of file rbdl_mathutils.cc.

References std::cos(), and std::sin().

◆ 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 199 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 255 of file rbdl_mathutils.cc.

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

Variable Documentation

◆ Matrix3dIdentity

RBDL_DLLAPI Matrix3d Matrix3dIdentity
extern

◆ Matrix3dZero

RBDL_DLLAPI Matrix3d Matrix3dZero
extern

◆ Vector3dZero

RBDL_DLLAPI Vector3d Vector3dZero
extern