Drake

This class is used to represent physical quantities that correspond to spatial vectors such as spatial velocities, spatial accelerations and spatial forces. More...
#include <drake/multibody/multibody_tree/math/spatial_vector.h>
Public Types  
enum  { kSpatialVectorSize = 6, kRotationSize = 3, kTranslationSize = 3 } 
Sizes for spatial quantities and its components in three dimensions. More...  
using  SpatialQuantity = SV< T > 
The more specialized spatial vector class templated on the scalar type T. More...  
typedef Vector6< T >  CoeffsEigenType 
The type of the underlying inmemory representation using an Eigen vector. More...  
typedef T  ScalarType 
Public Member Functions  
SpatialVector ()  
Default constructor. More...  
SpatialVector (const Eigen::Ref< const Vector3< T >> &w, const Eigen::Ref< const Vector3< T >> &v)  
SpatialVector constructor from an rotational component w and a linear component v . More...  
template<typename OtherDerived >  
SpatialVector (const Eigen::MatrixBase< OtherDerived > &V)  
SpatialVector constructor from an Eigen expression that represents a sixdimensional vector. More...  
int  size () const 
The total size of the concatenation of the angular and linear components. More...  
const T &  operator[] (int i) const 
Const access to the ith component of this spatial vector. More...  
T &  operator[] (int i) 
Mutable access to the ith component of this spatial vector. More...  
const Vector3< T > &  rotational () const 
Const access to the rotational component of this spatial vector. More...  
Vector3< T > &  rotational () 
Mutable access to the rotational component of this spatial vector. More...  
const Vector3< T > &  translational () const 
Const access to the translational component of this spatial vector. More...  
Vector3< T > &  translational () 
Mutable access to the translational component of this spatial vector. More...  
const T *  data () const 
Returns a (const) bare pointer to the underlying data. More...  
T *  mutable_data () 
Returns a (mutable) bare pointer to the underlying data. More...  
std::tuple< const T, const T >  GetMaximumAbsoluteDifferences (const SpatialQuantity &other) const 
Returns the maximum absolute values of the differences in the rotational and translational components of this and other (i.e., the infinity norms of the difference in rotational and translational components). More...  
decltype(T()< T())  IsNearlyEqualWithinAbsoluteTolerance (const SpatialQuantity &other, double rotational_tolerance, double translational_tolerance) const 
Compares the rotational and translational parts of this and other to check if they are the same to within specified absolute differences. More...  
decltype(T()< T())  IsApprox (const SpatialQuantity &other, double tolerance=std::numeric_limits< double >::epsilon()) const 
Compares this spatial vector to the provided spatial vector other within a specified tolerance. More...  
void  SetNaN () 
Sets all entries in this SpatialVector to NaN. More...  
SpatialQuantity &  SetZero () 
Sets both rotational and translational components of this SpatialVector to zero. More...  
CoeffsEigenType &  get_coeffs () 
Returns a reference to the underlying storage. More...  
const CoeffsEigenType &  get_coeffs () const 
Returns a constant reference to the underlying storage. More...  
SpatialQuantity  operator () const 
Unary minus operator. More...  
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable  
SpatialVector (const SpatialVector &)=default  
SpatialVector &  operator= (const SpatialVector &)=default 
SpatialVector (SpatialVector &&)=default  
SpatialVector &  operator= (SpatialVector &&)=default 
Static Public Member Functions  
static SpatialQuantity  Zero () 
Factory to create a zero SpatialVector, i.e. More...  
Friends  
SpatialQuantity  operator* (const Matrix3< T > &R_FE, const SpatialQuantity &V_E) 
This operation reexpresses the spatial vector V_E originally expressed in frame E, into V_F , the same spatial vector expresed in another frame F. More...  
Related Functions  
(Note that these are not member functions.)  
SpatialQuantity  operator* (const T &s, const SpatialQuantity &V) 
Multiplication of a spatial vector V from the left by a scalar s . More...  
SpatialQuantity  operator* (const SpatialQuantity &V, const T &s) 
Multiplication of a spatial vector V from the right by a scalar s . More...  
template<template< typename > class SpatialQuantity, typename T >  
std::ostream &  operator<< (std::ostream &o, const SpatialVector< SpatialQuantity, T > &V) 
Stream insertion operator to write SpatialVector objects into a std::ostream . More...  
This class is used to represent physical quantities that correspond to spatial vectors such as spatial velocities, spatial accelerations and spatial forces.
Spatial vectors are 6element quantities that are pairs of ordinary 3vectors. Elements 02 are always the rotational component while elements 35 are always the translational component. For a more detailed introduction on spatial vectors please refer to section Spatial Vectors.
SV  The type of the more specialized spatial vector class. It must be a template on the scalar type T. 
T  The underlying scalar type. Must be a valid Eigen scalar. 
typedef Vector6<T> CoeffsEigenType 
The type of the underlying inmemory representation using an Eigen vector.
typedef T ScalarType 
using SpatialQuantity = SV<T> 
The more specialized spatial vector class templated on the scalar type T.
anonymous enum 

default 

default 

inline 
Default constructor.
In Release builds the elements of the newly constructed spatial vector are left uninitialized resulting in a zero cost operation. However in Debug builds those entries are set to NaN so that operations using this uninitialized spatial vector fail fast, allowing fast bug detection.

inline 
SpatialVector constructor from an rotational component w
and a linear component v
.

inlineexplicit 
SpatialVector constructor from an Eigen expression that represents a sixdimensional vector.
This constructor will assert the size of V is six (6) at compiletime for fixed sized Eigen expressions and at runtime for dynamic sized Eigen expressions.

inline 
Returns a (const) bare pointer to the underlying data.
It is guaranteed that there will be six (6) T's densely packed at data[0], data[1], etc.

inline 
Returns a reference to the underlying storage.

inline 
Returns a constant reference to the underlying storage.

inline 
Returns the maximum absolute values of the differences in the rotational and translational components of this
and other
(i.e., the infinity norms of the difference in rotational and translational components).
These quantities are returned in a tuple, in the order below.
std::tuple  Description 

w_max_difference  Maximum absolute difference in rotation components 
v_max_difference  Maximum absolute difference in translation components 

inline 
Compares this
spatial vector to the provided spatial vector other
within a specified tolerance.
Mathematically, if this
is the spatial vector U and other
is the spatial vector V, then this method returns true
if ‖UV‖∞ < ε
and false
otherwise.

inline 
Compares the rotational and translational parts of this
and other
to check if they are the same to within specified absolute differences.
[in]  rotational_tolerance  maximum allowable absolute difference between the rotational parts of this and other . The units depend on the underlying class. For example, spatial velocity, acceleration, and force have units of rad/sec, rad/sec^2, and N*m, respectively. 
[in]  translational_tolerance  maximum allowable absolute difference between the translational parts of this and other . The units depend on the underlying class. For example, spatial velocity, acceleration, and force have units of meter/sec, meter/sec^2, and Newton, respectively. 
true
if the rotational part of this
and other
are equal within rotational_tolerance
and the translational part of this
and other
are equal within translational_tolerance
.

inline 
Returns a (mutable) bare pointer to the underlying data.
It is guaranteed that there will be six (6) T's densely packed at data[0], data[1], etc.

inline 
Unary minus operator.

default 

default 

inline 
Const access to the ith component of this spatial vector.
Bounds are only checked in Debug builds for a zero overhead implementation in Release builds.

inline 
Mutable access to the ith component of this spatial vector.
Bounds are only checked in Debug builds for a zero overhead implementation in Release builds.

inline 
Const access to the rotational component of this spatial vector.

inline 
Mutable access to the rotational component of this spatial vector.

inline 
Sets all entries in this
SpatialVector to NaN.
Typically used to quickly detect uninitialized values since NaN will trigger a chain of invalid computations that can then be tracked back to the source.

inline 
Sets both rotational and translational components of this
SpatialVector to zero.

inline 
The total size of the concatenation of the angular and linear components.
In three dimensions this is six (6) and it is known at compile time.

inline 
Const access to the translational component of this spatial vector.

inline 
Mutable access to the translational component of this spatial vector.

inlinestatic 
Factory to create a zero SpatialVector, i.e.
rotational and translational components are both zero.

friend 
Multiplication of a spatial vector V from the left by a scalar s
.

friend 
Multiplication of a spatial vector V from the right by a scalar s
.

friend 
This operation reexpresses the spatial vector V_E
originally expressed in frame E, into V_F
, the same spatial vector expresed in another frame F.
The transformation requires the rotation matrix R_FE
representing the orientation of the original frame E with respect to frame F. The operation performed is:
V_F.rotational() = R_FE * V_E.rotational(), V_F.translational() = R_FE * V_E.translational()

related 
Stream insertion operator to write SpatialVector objects into a std::ostream
.
Especially useful for debugging.