DART  6.7.3
dart::dynamics::Inertia Class Reference

#include <Inertia.hpp>

Public Types

enum  Param {
  MASS = 0 , COM_X , COM_Y , COM_Z ,
  I_XX , I_YY , I_ZZ , I_XY ,
  I_XZ , I_YZ
}
 Enumeration for minimal inertia parameters. More...
 

Public Member Functions

 Inertia (double _mass=1, const Eigen::Vector3d &_com=Eigen::Vector3d::Zero(), const Eigen::Matrix3d &_momentOfInertia=Eigen::Matrix3d::Identity())
 
 Inertia (const Eigen::Matrix6d &_spatialInertiaTensor)
 
 Inertia (double _mass, double _comX, double _comY, double _comZ, double _Ixx, double _Iyy, double _Izz, double _Ixy, double _Ixz, double _Iyz)
 
void setParameter (Param _param, double _value)
 Set an inertial parameter. More...
 
double getParameter (Param _param) const
 Get an inertial parameter. More...
 
void setMass (double _mass)
 Set the mass. More...
 
double getMass () const
 Get the mass. More...
 
void setLocalCOM (const Eigen::Vector3d &_com)
 Set the center of mass with respect to the Body-fixed frame. More...
 
const Eigen::Vector3d & getLocalCOM () const
 Get the center of mass with respect to the Body-fixed frame. More...
 
void setMoment (const Eigen::Matrix3d &_moment)
 Set the moment of inertia (about the center of mass). More...
 
void setMoment (double _Ixx, double _Iyy, double _Izz, double _Ixy, double _Ixz, double _Iyz)
 Set the moment of inertia (about the center of mass) More...
 
Eigen::Matrix3d getMoment () const
 Get the moment of inertia. More...
 
void setSpatialTensor (const Eigen::Matrix6d &_spatial)
 Set the spatial tensor. More...
 
const Eigen::Matrix6dgetSpatialTensor () const
 Get the spatial inertia tensor. More...
 
bool verify (bool _printWarnings=true, double _tolerance=1e-8) const
 Returns true iff this Inertia object is physically valid. More...
 
bool operator== (const Inertia &other) const
 Check for equality. More...
 

Static Public Member Functions

static bool verifyMoment (const Eigen::Matrix3d &_moment, bool _printWarnings=true, double _tolerance=1e-8)
 Returns true iff _moment is a physically valid moment of inertia. More...
 
static bool verifySpatialTensor (const Eigen::Matrix6d &_spatial, bool _printWarnings=true, double _tolerance=1e-8)
 Returns true iff _spatial is a physically valid spatial inertia tensor. More...
 

Protected Member Functions

void computeSpatialTensor ()
 Compute the spatial tensor based on the inertial parameters. More...
 
void computeParameters ()
 Compute the inertial parameters from the spatial tensor. More...
 

Protected Attributes

double mMass
 Overall mass. More...
 
Eigen::Vector3d mCenterOfMass
 Center of mass in the Body frame. More...
 
std::array< double, 6 > mMoment
 The six parameters of the moment of inertia located at the center of mass. More...
 
Eigen::Matrix6d mSpatialTensor
 Cache for generalized spatial inertia of the Body. More...
 

Member Enumeration Documentation

◆ Param

Enumeration for minimal inertia parameters.

Enumerator
MASS 
COM_X 
COM_Y 
COM_Z 
I_XX 
I_YY 
I_ZZ 
I_XY 
I_XZ 
I_YZ 

Constructor & Destructor Documentation

◆ Inertia() [1/3]

dart::dynamics::Inertia::Inertia ( double  _mass = 1,
const Eigen::Vector3d &  _com = Eigen::Vector3d::Zero(),
const Eigen::Matrix3d &  _momentOfInertia = Eigen::Matrix3d::Identity() 
)

◆ Inertia() [2/3]

dart::dynamics::Inertia::Inertia ( const Eigen::Matrix6d _spatialInertiaTensor)

◆ Inertia() [3/3]

dart::dynamics::Inertia::Inertia ( double  _mass,
double  _comX,
double  _comY,
double  _comZ,
double  _Ixx,
double  _Iyy,
double  _Izz,
double  _Ixy,
double  _Ixz,
double  _Iyz 
)

Member Function Documentation

◆ computeParameters()

void dart::dynamics::Inertia::computeParameters ( )
protected

Compute the inertial parameters from the spatial tensor.

◆ computeSpatialTensor()

void dart::dynamics::Inertia::computeSpatialTensor ( )
protected

Compute the spatial tensor based on the inertial parameters.

◆ getLocalCOM()

const Eigen::Vector3d & dart::dynamics::Inertia::getLocalCOM ( ) const

Get the center of mass with respect to the Body-fixed frame.

◆ getMass()

double dart::dynamics::Inertia::getMass ( ) const

Get the mass.

◆ getMoment()

Eigen::Matrix3d dart::dynamics::Inertia::getMoment ( ) const

Get the moment of inertia.

◆ getParameter()

double dart::dynamics::Inertia::getParameter ( Param  _param) const

Get an inertial parameter.

◆ getSpatialTensor()

const Eigen::Matrix6d & dart::dynamics::Inertia::getSpatialTensor ( ) const

Get the spatial inertia tensor.

◆ operator==()

bool dart::dynamics::Inertia::operator== ( const Inertia other) const

Check for equality.

◆ setLocalCOM()

void dart::dynamics::Inertia::setLocalCOM ( const Eigen::Vector3d &  _com)

Set the center of mass with respect to the Body-fixed frame.

◆ setMass()

void dart::dynamics::Inertia::setMass ( double  _mass)

Set the mass.

◆ setMoment() [1/2]

void dart::dynamics::Inertia::setMoment ( const Eigen::Matrix3d &  _moment)

Set the moment of inertia (about the center of mass).

Note that only the top-right corner of the matrix will be used, because a well-formed inertia matrix is always symmetric.

◆ setMoment() [2/2]

void dart::dynamics::Inertia::setMoment ( double  _Ixx,
double  _Iyy,
double  _Izz,
double  _Ixy,
double  _Ixz,
double  _Iyz 
)

Set the moment of inertia (about the center of mass)

◆ setParameter()

void dart::dynamics::Inertia::setParameter ( Param  _param,
double  _value 
)

Set an inertial parameter.

◆ setSpatialTensor()

void dart::dynamics::Inertia::setSpatialTensor ( const Eigen::Matrix6d _spatial)

Set the spatial tensor.

◆ verify()

bool dart::dynamics::Inertia::verify ( bool  _printWarnings = true,
double  _tolerance = 1e-8 
) const

Returns true iff this Inertia object is physically valid.

◆ verifyMoment()

bool dart::dynamics::Inertia::verifyMoment ( const Eigen::Matrix3d &  _moment,
bool  _printWarnings = true,
double  _tolerance = 1e-8 
)
static

Returns true iff _moment is a physically valid moment of inertia.

◆ verifySpatialTensor()

bool dart::dynamics::Inertia::verifySpatialTensor ( const Eigen::Matrix6d _spatial,
bool  _printWarnings = true,
double  _tolerance = 1e-8 
)
static

Returns true iff _spatial is a physically valid spatial inertia tensor.

Member Data Documentation

◆ mCenterOfMass

Eigen::Vector3d dart::dynamics::Inertia::mCenterOfMass
protected

Center of mass in the Body frame.

◆ mMass

double dart::dynamics::Inertia::mMass
protected

Overall mass.

◆ mMoment

std::array<double,6> dart::dynamics::Inertia::mMoment
protected

The six parameters of the moment of inertia located at the center of mass.

◆ mSpatialTensor

Eigen::Matrix6d dart::dynamics::Inertia::mSpatialTensor
protected

Cache for generalized spatial inertia of the Body.