wuzp
Wrong Unit? Zero Points! Compile-time checks for units, coordinate systems and points vs. vectors.
Loading...
Searching...
No Matches
wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ > Class Template Reference

The base class of the spatial vectors SpatialVelocity, SpatialAcceleration and SpatialForce: a rotational and a translational part, two three-dimensional vectors expressed in the same coordinate system, the rotational part first, like the spatial vectors of Drake (https://drake.mit.edu/doxygen_cxx/group__multibody__spatial__vectors.html), Modern Robotics (Lynch and Park, Cambridge University Press, 2017, sections 3.3.2 and 3.4) and Featherstone (Rigid Body Dynamics Algorithms, Springer, 2008). More...

#include <wuzp/trafo/SpatialVector.hpp>

Public Types

using RotationalT = RotationalT_
 The rotational part, e.g. the angular velocity of a spatial velocity.
using TranslationalT = TranslationalT_
 The translational part, e.g. the velocity of the point of a spatial velocity.
using ValueT = typename RotationalT_::ValueT
 The value type of both parts, e.g. double.

Public Member Functions

 SpatialVector (const SpatialVector &)=default
 SpatialVector (SpatialVector &&)=default
SpatialVector & operator= (const SpatialVector &)=default
SpatialVector & operator= (SpatialVector &&)=default
const RotationalT & getRotational () const &
 The rotational part, e.g. the angular velocity of a spatial velocity.
RotationalT getRotational () &&
 The rotational part of a temporary is moved out of it.
const TranslationalT & getTranslational () const &
 The translational part, e.g. the velocity of the point of a spatial velocity.
TranslationalT getTranslational () &&
 The translational part of a temporary is moved out of it.
template<typename OtherT_, typename RotationalOtherT_, typename TranslationalOtherT_>
bool isApprox (const SpatialVector< OtherT_, RotationalOtherT_, TranslationalOtherT_ > &other, const ValueT precision=Precision< ValueT >::value()) const
 Whether both spatial vectors, which must have the same tags, are approximately equal: their rotational and their translational parts are compared separately, like tensors (see Tensor::isApprox()), so that the units of one part do not weigh against those of the other.

Protected Member Functions

 SpatialVector ()=default
template<typename RotationalOtherT_, typename TranslationalOtherT_>
 SpatialVector (RotationalOtherT_ &&rotational, TranslationalOtherT_ &&translational)
 Direct-initializes each part, so that a part of the wrong kind, e.g. a velocity as an angular velocity, fails with the message of the conversion of tensors, e.g. "Units do not match.".
 ~SpatialVector ()=default

Detailed Description

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
class wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >

The base class of the spatial vectors SpatialVelocity, SpatialAcceleration and SpatialForce: a rotational and a translational part, two three-dimensional vectors expressed in the same coordinate system, the rotational part first, like the spatial vectors of Drake (https://drake.mit.edu/doxygen_cxx/group__multibody__spatial__vectors.html), Modern Robotics (Lynch and Park, Cambridge University Press, 2017, sections 3.3.2 and 3.4) and Featherstone (Rigid Body Dynamics Algorithms, Springer, 2008).

Each part is a tensor with a unit of its own, e.g. an angular velocity and a velocity, so that the operations of tensors check them. The spatial vector DerivedT_ that derives from it, in the curiously recurring template pattern (CRTP), defines the tags: FrameT, PointT and ExpressedInT, and for motion vectors MeasuredInT. Spatial vectors are added, subtracted and compared, with operator+, operator-, operator==, operator!= and isApprox(), only if all their tags match, and fail otherwise with "Measured-in frames do not match.", "Frames do not match.", "Reference points do not match." or "Coordinate systems do not match.". The spatial vectors combine spatial vectors with other tags with their shift() and compositions, e.g. SpatialVelocity::composeWithMovingFrameVelocity(). A passive rotation or a passive proper rigid transformation re-expresses a spatial vector about the same point, through the TransformationTraits of this header, and adjoint() maps spatial velocities and spatial forces by a passive proper rigid transformation. AnySpatialVector tells whether a type is a spatial vector. The destructor is protected and not virtual, like that of Transformation: spatial vectors are values, which are never deleted through a pointer to this class. A declared destructor suppresses the implicit moves, so the copies and the moves are defaulted too: a moved spatial vector moves its parts instead of copying them, which would allocate with e.g. Blitz++.

Definition at line 77 of file SpatialVector.hpp.

Member Typedef Documentation

◆ RotationalT

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
using wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::RotationalT = RotationalT_

The rotational part, e.g. the angular velocity of a spatial velocity.

Definition at line 80 of file SpatialVector.hpp.

◆ TranslationalT

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
using wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::TranslationalT = TranslationalT_

The translational part, e.g. the velocity of the point of a spatial velocity.

Definition at line 82 of file SpatialVector.hpp.

◆ ValueT

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
using wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::ValueT = typename RotationalT_::ValueT

The value type of both parts, e.g. double.

Definition at line 84 of file SpatialVector.hpp.

Constructor & Destructor Documentation

◆ SpatialVector() [1/4]

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::SpatialVector ( const SpatialVector< DerivedT_, RotationalT_, TranslationalT_ > & )
default

◆ SpatialVector() [2/4]

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::SpatialVector ( SpatialVector< DerivedT_, RotationalT_, TranslationalT_ > && )
default

◆ SpatialVector() [3/4]

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::SpatialVector ( )
protecteddefault

◆ SpatialVector() [4/4]

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
template<typename RotationalOtherT_, typename TranslationalOtherT_>
wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::SpatialVector ( RotationalOtherT_ && rotational,
TranslationalOtherT_ && translational )
inlineprotected

Direct-initializes each part, so that a part of the wrong kind, e.g. a velocity as an angular velocity, fails with the message of the conversion of tensors, e.g. "Units do not match.".

Definition at line 118 of file SpatialVector.hpp.

◆ ~SpatialVector()

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::~SpatialVector ( )
protecteddefault

Member Function Documentation

◆ getRotational() [1/2]

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
RotationalT wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::getRotational ( ) &&
inline

The rotational part of a temporary is moved out of it.

Definition at line 94 of file SpatialVector.hpp.

◆ getRotational() [2/2]

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
const RotationalT & wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::getRotational ( ) const &
inline

The rotational part, e.g. the angular velocity of a spatial velocity.

Definition at line 92 of file SpatialVector.hpp.

◆ getTranslational() [1/2]

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
TranslationalT wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::getTranslational ( ) &&
inline

The translational part of a temporary is moved out of it.

Definition at line 98 of file SpatialVector.hpp.

◆ getTranslational() [2/2]

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
const TranslationalT & wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::getTranslational ( ) const &
inline

The translational part, e.g. the velocity of the point of a spatial velocity.

Definition at line 96 of file SpatialVector.hpp.

◆ isApprox()

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
template<typename OtherT_, typename RotationalOtherT_, typename TranslationalOtherT_>
bool wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::isApprox ( const SpatialVector< OtherT_, RotationalOtherT_, TranslationalOtherT_ > & other,
const ValueT precision = Precision<ValueT>::value() ) const
inline

Whether both spatial vectors, which must have the same tags, are approximately equal: their rotational and their translational parts are compared separately, like tensors (see Tensor::isApprox()), so that the units of one part do not weigh against those of the other.

Like the comparison of tensors, it is relative, so a part cannot be compared with zero: only zero is approximately equal to zero.

Definition at line 107 of file SpatialVector.hpp.

◆ operator=() [1/2]

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
SpatialVector & wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::operator= ( const SpatialVector< DerivedT_, RotationalT_, TranslationalT_ > & )
default

◆ operator=() [2/2]

template<typename DerivedT_, AnyTensor RotationalT_, AnyTensor TranslationalT_>
SpatialVector & wuzp::SpatialVector< DerivedT_, RotationalT_, TranslationalT_ >::operator= ( SpatialVector< DerivedT_, RotationalT_, TranslationalT_ > && )
default

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