RobWorkProject
Public Types | Public Member Functions | Static Public Member Functions | Friends | Related Functions | List of all members
InertiaMatrix< T > Class Template Reference

A 3x3 inertia matrix. More...

#include <InertiaMatrix.hpp>

Public Types

typedef boost::numeric::ublas::bounded_matrix< T, 3, 3 > BoostBase
 Legacy type for Boost matrix implementation. More...
 
typedef Eigen::Matrix< T, 3, 3 > Base
 The type of the internal Eigen matrix implementation.
 

Public Member Functions

 InertiaMatrix (T r11, T r12, T r13, T r21, T r22, T r23, T r31, T r32, T r33)
 Constructs an initialized 3x3 rotation matrix. More...
 
 InertiaMatrix (const Vector3D< T > &i, const Vector3D< T > &j, const Vector3D< T > &k)
 Constructs an initialized 3x3 rotation matrix $ \robabx{a}{b}{\mathbf{R}} = \left[ \begin{array}{ccc} \robabx{a}{b}{\mathbf{i}} & \robabx{a}{b}{\mathbf{j}} & \robabx{a}{b}{\mathbf{k}} \end{array} \right] $. More...
 
 InertiaMatrix (T i=0.0, T j=0.0, T k=0.0)
 constructor - where only the diagonal is set More...
 
template<class R >
 InertiaMatrix (const boost::numeric::ublas::matrix_expression< R > &r)
 Construct a rotation matrix from a Boost matrix expression. More...
 
 InertiaMatrix (const Base &r)
 Construct an internal matrix from a Eigen::MatrixBase. More...
 
T & operator() (size_t row, size_t column)
 Returns reference to matrix element. More...
 
const T & operator() (size_t row, size_t column) const
 Returns reference to matrix element. More...
 
const Basee () const
 Returns reference to the internal 3x3 matrix.
 
Basee ()
 Returns reference to the internal 3x3 matrix.
 
BoostBase m ()
 Returns boost matrix. More...
 

Static Public Member Functions

static InertiaMatrix< T > makeSolidSphereInertia (T mass, T radi)
 Make inertia matrix for a solid sphere. More...
 
static InertiaMatrix< T > makeHollowSphereInertia (T mass, T radi)
 Make inertia matrix for a hollow sphere. More...
 
static InertiaMatrix< T > makeCuboidInertia (T mass, T x, T y, T z)
 calculates the inertia of a cuboid where the reference frame is in the center of the cuboid with More...
 

Friends

InertiaMatrix operator* (const Rotation3D< T > &aRb, const InertiaMatrix &bRc)
 Calculates $ \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} $. More...
 
InertiaMatrix operator* (const InertiaMatrix &aRb, const Rotation3D< T > &bRc)
 Calculates $ \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} $. More...
 
InertiaMatrix operator+ (const InertiaMatrix &I1, const InertiaMatrix &I2)
 Calculates the addition between the two InertiaMatrices.
 
Vector3D< T > operator* (const InertiaMatrix &aRb, const Vector3D< T > &bVc)
 Calculates $ \robabx{a}{c}{\mathbf{v}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{v}} $. More...
 
std::ostream & operator<< (std::ostream &os, const InertiaMatrix &r)
 Writes rotation matrix to stream. More...
 

Related Functions

(Note that these are not member functions.)

template<>
void write (const rw::math::InertiaMatrix< double > &sobject, rw::common::OutputArchive &oarchive, const std::string &id)
 
template<>
void write (const rw::math::InertiaMatrix< float > &sobject, rw::common::OutputArchive &oarchive, const std::string &id)
 
template<>
void read (rw::math::InertiaMatrix< double > &sobject, rw::common::InputArchive &iarchive, const std::string &id)
 
template<>
void read (rw::math::InertiaMatrix< float > &sobject, rw::common::InputArchive &iarchive, const std::string &id)
 

Detailed Description

template<class T = double>
class rw::math::InertiaMatrix< T >

A 3x3 inertia matrix.

Member Typedef Documentation

◆ BoostBase

typedef boost::numeric::ublas::bounded_matrix<T, 3, 3> BoostBase

Legacy type for Boost matrix implementation.

Deprecated:
Users should migrate to the Base type based on Eigen.

Constructor & Destructor Documentation

◆ InertiaMatrix() [1/5]

InertiaMatrix ( r11,
r12,
r13,
r21,
r22,
r23,
r31,
r32,
r33 
)
inline

Constructs an initialized 3x3 rotation matrix.

Parameters
r11$ r_{11} $
r12$ r_{12} $
r13$ r_{13} $
r21$ r_{21} $
r22$ r_{22} $
r23$ r_{23} $
r31$ r_{31} $
r32$ r_{32} $
r33$ r_{33} $

$ \mathbf{R} = \left[ \begin{array}{ccc} r_{11} & r_{12} & r_{13} \\ r_{21} & r_{22} & r_{23} \\ r_{31} & r_{32} & r_{33} \end{array} \right] $

◆ InertiaMatrix() [2/5]

InertiaMatrix ( const Vector3D< T > &  i,
const Vector3D< T > &  j,
const Vector3D< T > &  k 
)
inline

Constructs an initialized 3x3 rotation matrix $ \robabx{a}{b}{\mathbf{R}} = \left[ \begin{array}{ccc} \robabx{a}{b}{\mathbf{i}} & \robabx{a}{b}{\mathbf{j}} & \robabx{a}{b}{\mathbf{k}} \end{array} \right] $.

Parameters
i$ \robabx{a}{b}{\mathbf{i}} $
j$ \robabx{a}{b}{\mathbf{j}} $
k$ \robabx{a}{b}{\mathbf{k}} $

◆ InertiaMatrix() [3/5]

InertiaMatrix ( i = 0.0,
j = 0.0,
k = 0.0 
)
inline

constructor - where only the diagonal is set

Parameters
i[in] m(0,0)
j[in] m(1,1)
k[in] m(2,2)

◆ InertiaMatrix() [4/5]

InertiaMatrix ( const boost::numeric::ublas::matrix_expression< R > &  r)
inlineexplicit

Construct a rotation matrix from a Boost matrix expression.

The matrix expression must be convertible to a 3x3 bounded matrix.

It is the responsibility of the user that 3x3 matrix is indeed an inertia matrix.

Deprecated:
Please consider using Eigen matrices instead.

◆ InertiaMatrix() [5/5]

InertiaMatrix ( const Base r)
inlineexplicit

Construct an internal matrix from a Eigen::MatrixBase.

It is the responsibility of the user that 3x3 matrix is indeed an inertia matrix.

Member Function Documentation

◆ m()

BoostBase m ( )
inline

Returns boost matrix.

Returns
$ \mathbf{M}\in SO(3) $

◆ makeCuboidInertia()

static InertiaMatrix<T> makeCuboidInertia ( mass,
x,
y,
z 
)
inlinestatic

calculates the inertia of a cuboid where the reference frame is in the center of the cuboid with

Parameters
mass
x
y
z
Returns

◆ makeHollowSphereInertia()

static InertiaMatrix<T> makeHollowSphereInertia ( mass,
radi 
)
inlinestatic

Make inertia matrix for a hollow sphere.

Parameters
mass[in] mass of hollow sphere.
radi[in] radius of sphere.
Returns
the inertia matrix.

◆ makeSolidSphereInertia()

static InertiaMatrix<T> makeSolidSphereInertia ( mass,
radi 
)
inlinestatic

Make inertia matrix for a solid sphere.

Parameters
mass[in] mass of solid sphere.
radi[in] radius of sphere.
Returns
the inertia matrix.

◆ operator()() [1/2]

T& operator() ( size_t  row,
size_t  column 
)
inline

Returns reference to matrix element.

Parameters
row[in] row
column[in] column
Returns
reference to the element

◆ operator()() [2/2]

const T& operator() ( size_t  row,
size_t  column 
) const
inline

Returns reference to matrix element.

Parameters
row[in] row
column[in] column
Returns
reference to the element

Friends And Related Function Documentation

◆ operator* [1/3]

InertiaMatrix operator* ( const Rotation3D< T > &  aRb,
const InertiaMatrix< T > &  bRc 
)
friend

Calculates $ \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} $.

Parameters
aRb[in] $ \robabx{a}{b}{\mathbf{R}} $
bRc[in] $ \robabx{b}{c}{\mathbf{R}} $
Returns
$ \robabx{a}{c}{\mathbf{R}} $

◆ operator* [2/3]

InertiaMatrix operator* ( const InertiaMatrix< T > &  aRb,
const Rotation3D< T > &  bRc 
)
friend

Calculates $ \robabx{a}{c}{\mathbf{R}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{R}} $.

Parameters
aRb[in] $ \robabx{a}{b}{\mathbf{R}} $
bRc[in] $ \robabx{b}{c}{\mathbf{R}} $
Returns
$ \robabx{a}{c}{\mathbf{R}} $

◆ operator* [3/3]

Vector3D<T> operator* ( const InertiaMatrix< T > &  aRb,
const Vector3D< T > &  bVc 
)
friend

Calculates $ \robabx{a}{c}{\mathbf{v}} = \robabx{a}{b}{\mathbf{R}} \robabx{b}{c}{\mathbf{v}} $.

Parameters
aRb[in] $ \robabx{a}{b}{\mathbf{R}} $
bVc[in] $ \robabx{b}{c}{\mathbf{v}} $
Returns
$ \robabx{a}{c}{\mathbf{v}} $

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const InertiaMatrix< T > &  r 
)
friend

Writes rotation matrix to stream.

Parameters
os[in/out] output stream to use
r[in] rotation matrix to print
Returns
the updated output stream

◆ read() [1/2]

void read ( rw::math::InertiaMatrix< double > &  sobject,
rw::common::InputArchive iarchive,
const std::string &  id 
)
related

Enable read-serialization of class T by overloading this method. Data is read from iarchive and filled into sobject.

Parameters
sobject[out] the object in which the data should be streamed into
iarchive[in] the InputArchive from which to read data.
id[in] The id of the serialized sobject.
Note
the id can be empty in which case the overloaded method should provide a default identifier. E.g. the Vector3D class defined "Vector3D" as its default id.

◆ read() [2/2]

void read ( rw::math::InertiaMatrix< float > &  sobject,
rw::common::InputArchive iarchive,
const std::string &  id 
)
related

Enable read-serialization of class T by overloading this method. Data is read from iarchive and filled into sobject.

Parameters
sobject[out] the object in which the data should be streamed into
iarchive[in] the InputArchive from which to read data.
id[in] The id of the serialized sobject.
Note
the id can be empty in which case the overloaded method should provide a default identifier. E.g. the Vector3D class defined "Vector3D" as its default id.

◆ write() [1/2]

void write ( const rw::math::InertiaMatrix< double > &  sobject,
rw::common::OutputArchive oarchive,
const std::string &  id 
)
related

Enable write-serialization of class T by overloading this method. Data is written to oarchive from the sobject.

Parameters
sobject[in] the object from which the data should be streamed.
oarchive[out] the OutputArchive in which data should be written.
id[in] The id of the serialized sobject.
Note
the id can be empty in which case the overloaded method should provide a default identifier. E.g. the Vector3D class defined "Vector3D" as its default id.

◆ write() [2/2]

void write ( const rw::math::InertiaMatrix< float > &  sobject,
rw::common::OutputArchive oarchive,
const std::string &  id 
)
related

Enable write-serialization of class T by overloading this method. Data is written to oarchive from the sobject.

Parameters
sobject[in] the object from which the data should be streamed.
oarchive[out] the OutputArchive in which data should be written.
id[in] The id of the serialized sobject.
Note
the id can be empty in which case the overloaded method should provide a default identifier. E.g. the Vector3D class defined "Vector3D" as its default id.

The documentation for this class was generated from the following file: