RobWorkProject  23.9.11-
Public Member Functions | Friends | Related Functions | List of all members
Wrench6D< T > Class Template Reference

Class for representing 6 degrees of freedom wrenches. More...

#include <Wrench6D.hpp>

Public Member Functions

 Wrench6D (T fx, T fy, T fz, T tx, T ty, T tz)
 Constructs a 6 degrees of freedom velocity screw. More...
 
template<class R >
 Wrench6D (const Eigen::MatrixBase< R > &v)
 Constructs based on Eigen data type.
 
 Wrench6D ()
 Default Constructor. Initialized the wrench to 0.
 
 Wrench6D (const rw::math::Vector3D< T > &force, const rw::math::Vector3D< T > &torque)
 Constructs a wrench from a force and torque. More...
 
void setForce (const rw::math::Vector3D< T > &force)
 Sets the force component. More...
 
void setTorque (const rw::math::Vector3D< T > &torque)
 Sets the torque component. More...
 
const rw::math::Vector3D< T > force () const
 Extracts the force. More...
 
const rw::math::Vector3D< T > torque () const
 Extracts the torque and represents it using an Vector3D<T> More...
 
T & operator() (std::size_t index)
 Returns reference to wrench element. More...
 
const T & operator() (std::size_t index) const
 Returns const reference to wrench element. More...
 
const T & operator[] (size_t i) const
 Returns const reference to velocity screw element. More...
 
T & operator[] (size_t i)
 Returns const reference to velocity screw element. More...
 
Wrench6D< T > & operator+= (const Wrench6D< T > &wrench)
 Adds the wrench given as a parameter to the wrench. More...
 
Wrench6D< T > & operator-= (const Wrench6D< T > &wrench)
 Subtracts the wrench given as a parameter from the wrench. More...
 
Wrench6D< T > & operator*= (T s)
 Scales wrench with s. More...
 
const Wrench6D< T > operator* (T s) const
 Scales wrench and returns scaled version. More...
 
const Wrench6D< T > operator+ (const Wrench6D< T > &rhs) const
 Adds two wrenches together \( \mathbf{w}_{12}=\mathbf{w}_1+\mathbf{w}_2 \). More...
 
const Wrench6D< T > operator- (const Wrench6D< T > &rhs) const
 Subtracts two velocity screws \(\mathbf{\nu}_{12}=\mathbf{\nu}_1-\mathbf{\nu}_2\). More...
 
T norm1 () const
 Takes the 1-norm of the wrench. All elements both force and torque are given the same weight. More...
 
T norm2 () const
 Takes the 2-norm of the wrench. All elements both force and torque are given the same weight. More...
 
T normInf () const
 Takes the infinite norm of the wrench. All elements both force and torque are given the same weight. More...
 
Eigen::Matrix< T, 6, 1 > e () const
 Converter to Eigen data type.
 
bool operator== (const Wrench6D< T > &b) const
 Compares a and b for equality. More...
 
bool operator!= (const Wrench6D< T > &b) const
 Compares a and b for inequality. More...
 

Friends

const Wrench6D< T > operator* (const Transform3D< T > &aTb, const Wrench6D< T > &bV)
 Changes frame of reference and referencepoint of wrench: \( \robabx{b}{b}{\mathbf{w}}\to \robabx{a}{a}{\mathbf{w}} \). More...
 
const Wrench6D< T > operator* (const rw::math::Vector3D< T > &aPb, const Wrench6D< T > &bV)
 Changes wrench referencepoint of wrench: \( \robabx{b}{b}{\mathbf{w}}\to \robabx{a}{a}{\mathbf{w}} \). More...
 
const Wrench6D< T > operator* (const Rotation3D< T > &aRb, const Wrench6D< T > &bV)
 Changes frame of reference for wrench: \( \robabx{b}{i}{\mathbf{w}}\to \robabx{a}{i}{\mathbf{w}} \). More...
 
std::ostream & operator<< (std::ostream &os, const Wrench6D< T > &wrench)
 Ouputs wrench to stream. More...
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

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

Class for representing 6 degrees of freedom wrenches.

\[ \mathbf{\nu} = \left[ \begin{array}{c} f_x\\ f_y\\ f_z\\ \tau_x\\ \tau_y\\ \tau_z \end{array} \right] \]

A Wrench is the description of a frames linear force and rotational torque with respect to some reference frame.

Constructor & Destructor Documentation

◆ Wrench6D() [1/2]

Wrench6D ( T  fx,
T  fy,
T  fz,
T  tx,
T  ty,
T  tz 
)

Constructs a 6 degrees of freedom velocity screw.

Parameters
fx[in] \( f_x \)
fy[in] \( f_y \)
fz[in] \( f_z \)
tx[in] \( \tau_x \)
ty[in] \( \tau_y \)
tz[in] \( \tau_z \)

◆ Wrench6D() [2/2]

Wrench6D ( const rw::math::Vector3D< T > &  force,
const rw::math::Vector3D< T > &  torque 
)

Constructs a wrench from a force and torque.

Parameters
force[in] linear force
torque[in] angular torque

Member Function Documentation

◆ force()

const rw::math::Vector3D<T> force ( ) const
inline

Extracts the force.

Returns
the force

◆ norm1()

T norm1 ( ) const
inline

Takes the 1-norm of the wrench. All elements both force and torque are given the same weight.

Returns
the 1-norm

◆ norm2()

T norm2 ( ) const
inline

Takes the 2-norm of the wrench. All elements both force and torque are given the same weight.

Returns
the 2-norm

◆ normInf()

T normInf ( ) const
inline

Takes the infinite norm of the wrench. All elements both force and torque are given the same weight.

Returns
the infinite norm

◆ operator!=()

bool operator!= ( const Wrench6D< T > &  b) const
inline

Compares a and b for inequality.

Parameters
b[in] other wrench to compare with.
Returns
True if a and b are different, false otherwise.

◆ operator()() [1/2]

T& operator() ( std::size_t  index)
inline

Returns reference to wrench element.

Parameters
index[in] index in the wrench, index must be \( < 6 \).
Returns
reference to wrench element

◆ operator()() [2/2]

const T& operator() ( std::size_t  index) const
inline

Returns const reference to wrench element.

Parameters
index[in] index in the wrench, index must be \( < 6 \).
Returns
const reference to wrench element

◆ operator*()

const Wrench6D<T> operator* ( T  s) const
inline

Scales wrench and returns scaled version.

Parameters
s[in] scaling value
Returns
Scaled wrench

◆ operator*=()

Wrench6D<T>& operator*= ( T  s)
inline

Scales wrench with s.

Parameters
s[in] scaling value
Returns
reference to the Wrench6D to support additional assigments

◆ operator+()

const Wrench6D<T> operator+ ( const Wrench6D< T > &  rhs) const
inline

Adds two wrenches together \( \mathbf{w}_{12}=\mathbf{w}_1+\mathbf{w}_2 \).

Parameters
rhs[in] \( \mathbf{\nu}_1 \)
Returns
the wrench \( \mathbf{w}_{12} \)

◆ operator+=()

Wrench6D<T>& operator+= ( const Wrench6D< T > &  wrench)
inline

Adds the wrench given as a parameter to the wrench.

Assumes the wrenches are represented in the same coordinate system.

Parameters
wrench[in] Wrench to add
Returns
reference to the Wrench6D to support additional assignments.

◆ operator-()

const Wrench6D<T> operator- ( const Wrench6D< T > &  rhs) const
inline

Subtracts two velocity screws \(\mathbf{\nu}_{12}=\mathbf{\nu}_1-\mathbf{\nu}_2\).

Parameters
rhs[in] \(\mathbf{w}_1\)
Returns
the wrench \(\mathbf{w}_{12} \)

◆ operator-=()

Wrench6D<T>& operator-= ( const Wrench6D< T > &  wrench)
inline

Subtracts the wrench given as a parameter from the wrench.

Assumes the wrenches are represented in the same coordinate system.

Parameters
wrench[in] Velocity screw to subtract
Returns
reference to the Wrench6D to support additional assignments.

◆ operator==()

bool operator== ( const Wrench6D< T > &  b) const
inline

Compares a and b for equality.

Parameters
b[in] other wrench to compare with.
Returns
True if a equals b, false otherwise.

◆ operator[]() [1/2]

T& operator[] ( size_t  i)
inline

Returns const reference to velocity screw element.

Parameters
i[in] index in the screw, index must be \( < 6 \).
Returns
const reference to velocity screw element

◆ operator[]() [2/2]

const T& operator[] ( size_t  i) const
inline

Returns const reference to velocity screw element.

Parameters
i[in] index in the screw, index must be \( < 6 \).
Returns
const reference to velocity screw element

◆ setForce()

void setForce ( const rw::math::Vector3D< T > &  force)
inline

Sets the force component.

Parameters
force[in] linear force

◆ setTorque()

void setTorque ( const rw::math::Vector3D< T > &  torque)
inline

Sets the torque component.

Parameters
torque[in] angular torque

◆ torque()

const rw::math::Vector3D<T> torque ( ) const
inline

Extracts the torque and represents it using an Vector3D<T>

Returns
the torque

Friends And Related Function Documentation

◆ operator* [1/3]

const Wrench6D<T> operator* ( const Rotation3D< T > &  aRb,
const Wrench6D< T > &  bV 
)
friend

Changes frame of reference for wrench: \( \robabx{b}{i}{\mathbf{w}}\to \robabx{a}{i}{\mathbf{w}} \).

Parameters
aRb[in] the change in orientation between frame \( \mathcal{F}_a \) and frame \( \mathcal{F}_b \): \( \robabx{a}{b}{\mathbf{R}} \)
bV[in] velocity screw wrt. frame \( \mathcal{F}_b \): \( \robabx{b}{i}{\mathbf{\nu}} \)
Returns
the wrench wrt. frame \( \mathcal{F}_a \): \( \robabx{a}{i}{\mathbf{w}} \)

Transformation of the base to which the wrench is expressed. The wrench reference point is left intact

\[ \robabx{a}{i}{\mathbf{w}} = \left[ \begin{array}{c} \robabx{a}{i}{\mathbf{force}} \\ \robabx{a}{i}{\mathbf{torque}} \end{array} \right] = \left[ \begin{array}{cc} \robabx{a}{b}{\mathbf{R}} & \mathbf{0}^{3x3} \\ \mathbf{0}^{3x3} & \robabx{a}{b}{\mathbf{R}} \end{array} \right] \robabx{b}{i}{\mathbf{\nu}} = \left[ \begin{array}{c} \robabx{a}{b}{\mathbf{R}} \robabx{b}{i}{\mathbf{v}} \\ \robabx{a}{b}{\mathbf{R}} \robabx{b}{i}{\mathbf{\omega}} \end{array} \right] \]

◆ operator* [2/3]

const Wrench6D<T> operator* ( const rw::math::Vector3D< T > &  aPb,
const Wrench6D< T > &  bV 
)
friend

Changes wrench referencepoint of wrench: \( \robabx{b}{b}{\mathbf{w}}\to \robabx{a}{a}{\mathbf{w}} \).

The frames \( \mathcal{F}_a \) and \( \mathcal{F}_b \) are rigidly connected.

Parameters
aPb[in] the location of frame \( \mathcal{F}_b \) wrt. frame \( \mathcal{F}_a \): \( \robabx{a}{b}{\mathbf{T}} \)
bV[in] wrench wrt. frame \( \mathcal{F}_b \): \( \robabx{b}{b}{\mathbf{\nu}} \)
Returns
the wrench wrt. frame \( \mathcal{F}_a \): \( \robabx{a}{a}{\mathbf{\nu}} \)

Transformation of both the velocity reference point and of the base to which the wrench is expressed

\[ \robabx{a}{a}{\mathbf{w}} = \left[ \begin{array}{c} \robabx{a}{a}{\mathbf{force}} \\ \robabx{a}{a}{\mathbf{torque}} \end{array} \right] = \left[ \begin{array}{cc} \robabx{a}{b}{\mathbf{R}} & S(\robabx{a}{b}{\mathbf{p}}) \robabx{a}{b}{\mathbf{R}} \\ \mathbf{0}^{3x3} & \robabx{a}{b}{\mathbf{R}} \end{array} \right] \robabx{b}{b}{\mathbf{\nu}} = \left[ \begin{array}{c} \robabx{a}{b}{\mathbf{R}} \robabx{b}{b}{\mathbf{v}} + \robabx{a}{b}{\mathbf{p}} \times \robabx{a}{b}{\mathbf{R}} \robabx{b}{b}{\mathbf{\omega}}\\ \robabx{a}{b}{\mathbf{R}} \robabx{b}{b}{\mathbf{\omega}} \end{array} \right] \]

◆ operator* [3/3]

const Wrench6D<T> operator* ( const Transform3D< T > &  aTb,
const Wrench6D< T > &  bV 
)
friend

Changes frame of reference and referencepoint of wrench: \( \robabx{b}{b}{\mathbf{w}}\to \robabx{a}{a}{\mathbf{w}} \).

The frames \( \mathcal{F}_a \) and \( \mathcal{F}_b \) are rigidly connected.

Parameters
aTb[in] the location of frame \( \mathcal{F}_b \) wrt. frame \( \mathcal{F}_a \): \( \robabx{a}{b}{\mathbf{T}} \)
bV[in] wrench wrt. frame \( \mathcal{F}_b \): \( \robabx{b}{b}{\mathbf{\nu}} \)
Returns
the wrench wrt. frame \( \mathcal{F}_a \): \( \robabx{a}{a}{\mathbf{\nu}} \)

Transformation of both the wrench reference point and of the base to which the wrench is expressed

\[ \robabx{a}{a}{\mathbf{w}} = \left[ \begin{array}{c} \robabx{a}{a}{\mathbf{force}} \\ \robabx{a}{a}{\mathbf{torque}} \end{array} \right] = \left[ \begin{array}{cc} \robabx{a}{b}{\mathbf{R}} & S(\robabx{a}{b}{\mathbf{p}}) \robabx{a}{b}{\mathbf{R}} \\ \mathbf{0}^{3x3} & \robabx{a}{b}{\mathbf{R}} \end{array} \right] \robabx{b}{b}{\mathbf{\nu}} = \left[ \begin{array}{c} \robabx{a}{b}{\mathbf{R}} \robabx{b}{b}{\mathbf{v}} + \robabx{a}{b}{\mathbf{p}} \times \robabx{a}{b}{\mathbf{R}} \robabx{b}{b}{\mathbf{\omega}}\\ \robabx{a}{b}{\mathbf{R}} \robabx{b}{b}{\mathbf{\omega}} \end{array} \right] \]

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Wrench6D< T > &  wrench 
)
friend

Ouputs wrench to stream.

Parameters
os[in/out] stream to use
wrench[in] the wrench
Returns
the resulting stream

◆ read() [1/2]

void read ( rw::math::Wrench6D< 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::Wrench6D< 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::Wrench6D< 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::Wrench6D< 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 files: