Drake
SpatialVector< SV, T > Class Template Reference

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 in-memory 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 six-dimensional 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 i-th component of this spatial vector. More...

T & operator[] (int i)
Mutable access to the i-th 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...

bool IsApprox (const SpatialQuantity &other, double tolerance=Eigen::NumTraits< T >::epsilon()) const
Compares this spatial vector to the provided spatial vector other within a specified precision. More...

void SetNaN ()
Sets all entries in this SpatialVector to NaN. More...

SpatialQuantitySetZero ()
Sets both rotational and translational components of this SpatialVector to zero. More...

CoeffsEigenTypeget_coeffs ()
Returns a reference to the underlying storage. More...

const CoeffsEigenTypeget_coeffs () const
Returns a constant reference to the underlying storage. More...

Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
SpatialVector (const SpatialVector &)=default

SpatialVectoroperator= (const SpatialVector &)=default

SpatialVector (SpatialVector &&)=default

SpatialVectoroperator= (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 re-expresses 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...

## Detailed Description

### template<template< typename > class SV, typename T> class drake::multibody::SpatialVector< SV, T >

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 6-element quantities that are pairs of ordinary 3-vectors. Elements 0-2 are always the rotational component while elements 3-5 are always the translational component. For a more detailed introduction on spatial vectors please refer to section Spatial Vectors.

Template Parameters
 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.

## Member Typedef Documentation

 typedef Vector6 CoeffsEigenType

The type of the underlying in-memory representation using an Eigen vector.

 typedef T ScalarType
 using SpatialQuantity = SV

The more specialized spatial vector class templated on the scalar type T.

## Member Enumeration Documentation

 anonymous enum

Sizes for spatial quantities and its components in three dimensions.

Enumerator
kSpatialVectorSize
kRotationSize
kTranslationSize

## Constructor & Destructor Documentation

 SpatialVector ( const SpatialVector< SV, T > & )
default
 SpatialVector ( SpatialVector< SV, T > && )
default
 SpatialVector ( )
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.

 SpatialVector ( const Eigen::Ref< const Vector3< T >> & w, const Eigen::Ref< const Vector3< T >> & v )
inline

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

 SpatialVector ( const Eigen::MatrixBase< OtherDerived > & V )
inlineexplicit

SpatialVector constructor from an Eigen expression that represents a six-dimensional vector.

This constructor will assert the size of V is six (6) at compile-time for fixed sized Eigen expressions and at run-time for dynamic sized Eigen expressions.

## Member Function Documentation

 const T* data ( ) const
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.

 CoeffsEigenType& get_coeffs ( )
inline

Returns a reference to the underlying storage.

 const CoeffsEigenType& get_coeffs ( ) const
inline

Returns a constant reference to the underlying storage.

 bool IsApprox ( const SpatialQuantity & other, double tolerance = Eigen::NumTraits::epsilon() ) const
inline

Compares this spatial vector to the provided spatial vector other within a specified precision.

Returns
true if other is within a precision given by tolerance. The comparison is performed by comparing the translational component of this spatial vector with the rotational component of other using the fuzzy comparison provided by Eigen's method isApprox().
 T* mutable_data ( )
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.

 SpatialVector& operator= ( const SpatialVector< SV, T > & )
default
 SpatialVector& operator= ( SpatialVector< SV, T > && )
default
 const T& operator[] ( int i ) const
inline

Const access to the i-th component of this spatial vector.

Bounds are only checked in Debug builds for a zero overhead implementation in Release builds.

 T& operator[] ( int i )
inline

Mutable access to the i-th component of this spatial vector.

Bounds are only checked in Debug builds for a zero overhead implementation in Release builds.

 const Vector3& rotational ( ) const
inline

Const access to the rotational component of this spatial vector.

Here is the caller graph for this function:

 Vector3& rotational ( )
inline

Mutable access to the rotational component of this spatial vector.

 void SetNaN ( )
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.

Here is the caller graph for this function:

 SpatialQuantity& SetZero ( )
inline

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

 int size ( ) const
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.

 const Vector3& translational ( ) const
inline

Const access to the translational component of this spatial vector.

Here is the caller graph for this function:

 Vector3& translational ( )
inline

Mutable access to the translational component of this spatial vector.

 static SpatialQuantity Zero ( )
inlinestatic

Factory to create a zero SpatialVector, i.e.

rotational and translational components are both zero.

## Friends And Related Function Documentation

 SpatialQuantity operator* ( const T & s, const SpatialQuantity & V )
friend

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

 SpatialQuantity operator* ( const SpatialQuantity & V, const T & s )
friend

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

 SpatialQuantity operator* ( const Matrix3< T > & R_FE, const SpatialQuantity & V_E )
friend

This operation re-expresses 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()

Returns
V_F The same spatial vector re-expressed in frame F.
 std::ostream & operator<< ( std::ostream & o, const SpatialVector< SpatialQuantity, T > & V )
related

Stream insertion operator to write SpatialVector objects into a std::ostream.

Especially useful for debugging.

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