Drake

This class is used to represent a spatial force (also called a wrench) that combines both rotational (torque) and translational force components.
Spatial forces are 6element quantities that are pairs of ordinary 3vectors. Elements 02 are the torque component while elements 35 are the force component. Both vectors must be expressed in the same frame, and the translational force is applied to a particular point of a body, but neither the frame nor the point are stored with a SpatialForce object; they must be understood from context. It is the responsibility of the user to keep track of the application point and the expressedin frame. That is best accomplished through disciplined notation. In source code we use monogram notation where capital F is used to designate a spatial force quantity. We write a point P fixed to body (or frame) B as \(B_P\) which appears in code and comments as Bp
. Then we write a particular spatial force as F_Bp_E
where the _E
suffix indicates that the expressedin frame is E. This symbol represents a torque applied to body B, and a force applied to point P on B, with both vectors expressed in E. Very often the application point will be the body origin Bo
; if no point is shown the origin is understood, so F_B_E
means F_Bo_E
. For a more detailed introduction on spatial vectors and the monogram notation please refer to section Spatial Vectors.
T  The underlying scalar type. Must be a valid Eigen scalar. 
#include <drake/multibody/math/spatial_velocity.h>
Public Member Functions  
SpatialForce ()  
Default constructor. More...  
SpatialForce (const Eigen::Ref< const Vector3< T >> &tau, const Eigen::Ref< const Vector3< T >> &f)  
SpatialForce constructor from a torque tau and a force f . More...  
template<typename Derived >  
SpatialForce (const Eigen::MatrixBase< Derived > &F)  
SpatialForce constructor from an Eigen expression that represents a sixdimensional vector. More...  
SpatialForce< T > &  ShiftInPlace (const Vector3< T > &p_BpBq_E) 
Inplace shift of a SpatialForce from one application point to another. More...  
SpatialForce< T >  Shift (const Vector3< T > &p_BpBq_E) const 
Shift of a SpatialForce from one application point to another. More...  
SpatialForce< T > &  operator+= (const SpatialForce< T > &F_Sp_E) 
Adds in a spatial force to this spatial force. More...  
SpatialForce< T > &  operator= (const SpatialForce< T > &F_Sp_E) 
Subtracts a spatial force from this spatial force. More...  
T  dot (const SpatialVelocity< T > &V_IBp_E) const 
Given this spatial force F_Bp_E applied at point P of body B and expressed in a frame E, this method computes the 6dimensional dot product with the spatial velocity V_IBp_E of body B at point P, measured in an inertial frame I and expressed in the same frame E in which the spatial force is expressed. More...  
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable  
SpatialForce (const SpatialForce &)=default  
SpatialForce &  operator= (const SpatialForce &)=default 
SpatialForce (SpatialForce &&)=default  
SpatialForce &  operator= (SpatialForce &&)=default 
Public Member Functions inherited from SpatialVector< SpatialForce, T >  
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...  
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...  
SpatialVector (const SpatialVector &)=default  
SpatialVector (SpatialVector &&)=default  
SpatialVector &  operator= (const SpatialVector &)=default 
SpatialVector &  operator= (SpatialVector &&)=default 
Additional Inherited Members  
Public Types inherited from SpatialVector< SpatialForce, T >  
enum  
Sizes for spatial quantities and its components in three dimensions. More...  
using  SpatialQuantity = SpatialForce< 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 
Static Public Member Functions inherited from SpatialVector< SpatialForce, T >  
static SpatialQuantity  Zero () 
Factory to create a zero SpatialVector, i.e. More...  
Related Functions inherited from SpatialVector< SpatialForce, T >  
std::ostream &  operator<< (std::ostream &o, const SpatialVector< SpatialQuantity, T > &V) 
Stream insertion operator to write SpatialVector objects into a std::ostream . More...  

default 

default 
SpatialForce  (  ) 
Default constructor.
In Release builds the elements of the newly constructed spatial force 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 force fail fast, allowing fast bug detection.
SpatialForce  (  const Eigen::Ref< const Vector3< T >> &  tau, 
const Eigen::Ref< const Vector3< T >> &  f  
) 
SpatialForce constructor from a torque tau
and a force f
.

explicit 
SpatialForce constructor from an Eigen expression that represents a sixdimensional vector.
This constructor will assert the size of F is six (6) at compiletime for fixed sized Eigen expressions and at runtime for dynamic sized Eigen expressions.
T dot  (  const SpatialVelocity< T > &  V_IBp_E  )  const 
Given this
spatial force F_Bp_E
applied at point P of body B and expressed in a frame E, this method computes the 6dimensional dot product with the spatial velocity V_IBp_E
of body B at point P, measured in an inertial frame I and expressed in the same frame E in which the spatial force is expressed.
This dotproduct represents the power generated by this
spatial force when its body and application point have the given spatial velocity. Although the two spatial vectors must be expressed in the same frame, the result is independent of that frame.
SpatialForce<T>& operator+=  (  const SpatialForce< T > &  F_Sp_E  ) 
Adds in a spatial force to this
spatial force.
[in]  F_Sp_E  A spatial force to be added to this spatial force. It must be on the same system or body S on which this spatial force is applied and at the same point P as this spatial force, and expressed in the same frame E. 
this
spatial force, which has been updated to include the given spatial force F_Sp_E
.SpatialForce<T>& operator=  (  const SpatialForce< T > &  F_Sp_E  ) 
Subtracts a spatial force from this
spatial force.
[in]  F_Sp_E  A spatial force to be subtracted from this spatial force. It must be on the same system or body S on which this spatial force is applied and at the same point P as this spatial force, and expressed in the same frame E. 
this
spatial force, which has been updated to exclude the given spatial force F_Sp_E
.

default 

default 
SpatialForce<T> Shift  (  const Vector3< T > &  p_BpBq_E  )  const 
Shift of a SpatialForce from one application point to another.
This is an alternate signature for shifting a spatial force's application point that does not change the original object. See ShiftInPlace() for more information.
[in]  p_BpBq_E  Shift vector from point P of body B to point Q of B, expressed in frame E. The "from" point Bp must be the current application point of this spatial force, and E must be the same expressedin frame as for this spatial force. 
F_Bq_E  The equivalent shifted spatial force, now applied at point Q rather than P. 
SpatialForce<T>& ShiftInPlace  (  const Vector3< T > &  p_BpBq_E  ) 
Inplace shift of a SpatialForce from one application point to another.
this
spatial force F_Bp_E
, which applies its translational force component to point P of body B, is modified to become the equivalent spatial force F_Bq_E
that considers the force to be applied to point Q of body B instead (see class comment for more about this notation). This requires adjusting the torque component to account for the change in moment caused by the force shift.
We are given the vector from point P to point Q, as a position vector p_BpBq_E
(or p_PQ_E
) expressed in the same frame E as the spatial force. The operation performed, in coordinatefree form, is:
τ_B = τ_B  p_BpBq x f_Bp f_Bq = f_Bp, i.e. the force as applied to body B at Q is the same as was applied to B at P.
where τ and f represent the torque and force components respectively.
Notice this operation is linear. [Jain 2010], (§1.5, page 15) uses the "rigid body transformation operator" to write this as:
F_Bq = Φ(p_BqBp)F_Bp = Φ(p_BpBq)F_Bp
where Φ(p_PQ)
is the linear operator:
Φ(p_PQ) =  I₃ p_PQx   0 I₃ 
where p_PQx
denotes the cross product, skewsymmetric, matrix such that p_PQx v = p_PQ x v
. The transpose of this operator allow us to shift spatial velocities, see SpatialVelocity::Shift().
For computation, all quantities above must be expressed in a common frame E; we add an _E
suffix to each symbol to indicate that.
This operation is performed inplace modifying the original object.
[in]  p_BpBq_E  Shift vector from point P of body B to point Q of B, expressed in frame E. The "from" point Bp must be the current application point of this spatial force, and E must be the same expressedin frame as for this spatial force. 
this
spatial force which is now F_Bq_E
, that is, the force is now applied at point Q rather than P.