Drake

This class is used to represent a spatial velocity (also called a twist) that combines rotational (angular) and translational (linear) velocity components. More...
#include <drake/multibody/multibody_tree/math/spatial_force.h>
Public Member Functions  
SpatialVelocity ()  
Default constructor. More...  
SpatialVelocity (const Eigen::Ref< const Vector3< T >> &w, const Eigen::Ref< const Vector3< T >> &v)  
SpatialVelocity constructor from an angular velocity w and a linear velocity v . More...  
template<typename Derived >  
SpatialVelocity (const Eigen::MatrixBase< Derived > &V)  
SpatialVelocity constructor from an Eigen expression that represents a sixdimensional vector. More...  
SpatialVelocity< T > &  ShiftInPlace (const Vector3< T > &p_BpBq_E) 
Inplace shift of a SpatialVelocity from one point on a rigid body or frame to another point on the same body or frame. More...  
SpatialVelocity< T >  Shift (const Vector3< T > &p_BpBq_E) const 
Shift of a SpatialVelocity from one point on a rigid body or frame to another point on the same body or frame. More...  
SpatialVelocity< T >  ComposeWithMovingFrameVelocity (const Vector3< T > &p_PoBo_E, const SpatialVelocity< T > &V_PB_E) const 
This method composes this spatial velocity V_WP of a frame P measured in a frame W, with that of a third frame B moving in P with spatial velocity V_PB . More...  
T  dot (const SpatialForce< T > &F_Q_E) const 
Given this spatial velocity V_IBp_E of point P of body B, measured in an inertial frame I and expressed in a frame E, this method computes the 6dimensional dot product with the spatial force F_Bp_E applied to point P, and expressed in the same frame E in which the spatial velocity is expressed. More...  
T  dot (const SpatialMomentum< T > &L_NBp_E) const 
Given this spatial velocity V_NBp_E of rigid body B frame shifted to point P, measured in an inertial (or Newtonian) frame N and, expressed in a frame E this method computes the dot product with the spatial momentum L_NBp_E of rigid body B, about point P, and expressed in the same frame E. More...  
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable  
SpatialVelocity (const SpatialVelocity &)=default  
SpatialVelocity &  operator= (const SpatialVelocity &)=default 
SpatialVelocity (SpatialVelocity &&)=default  
SpatialVelocity &  operator= (SpatialVelocity &&)=default 
Public Member Functions inherited from SpatialVector< SpatialVelocity, 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< SpatialVelocity, T >  
enum  
Sizes for spatial quantities and its components in three dimensions. More...  
using  SpatialQuantity = SpatialVelocity< 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< SpatialVelocity, T >  
static SpatialQuantity  Zero () 
Factory to create a zero SpatialVector, i.e. More...  
This class is used to represent a spatial velocity (also called a twist) that combines rotational (angular) and translational (linear) velocity components.
Spatial velocities are 6element quantities that are pairs of ordinary 3vectors. Elements 02 are the angular velocity component while elements 35 are the translational velocity. Spatial velocities represent the motion of a "moving frame" B measured with respect to a "measuredin" frame A. In addition, the two contained vectors must be expressed in the same "expressedin" frame E, which may be distinct from either A or B. Finally, while angular velocity is identical for any frame fixed to a rigid body, translational velocity refers to a particular point. Only the vector values are stored in a SpatialVelocity object; the three frames and the point must be understood from context. It is the responsibility of the user to keep track of them. That is best accomplished through disciplined notation. In source code we use monogram notation where capital V is used to designate a spatial velocity 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 velocity as V_ABp_E
where the _E
suffix indicates that the expressedin frame is E. This symbol represents the angular velocity of frame B in frame A, and the translational velocity of point P in A, where P is fixed to frame B, with both vectors expressed in E. Very often the point of interest will be the body origin Bo
; if no point is shown the origin is understood, so V_AB_E
means V_ABo_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. 

default 

default 

inline 
Default constructor.
In Release builds the elements of the newly constructed spatial velocity 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 velocity fail fast, allowing fast bug detection.

inline 
SpatialVelocity constructor from an angular velocity w
and a linear velocity v
.

inlineexplicit 
SpatialVelocity 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 
This method composes this
spatial velocity V_WP
of a frame P measured in a frame W, with that of a third frame B moving in P with spatial velocity V_PB
.
The result is the spatial velocity V_WB
of frame B measured in W. At the instant in which the velocities are composed, frame B is located with its origin Bo
at p_PoBo
from P's origin Po.
The composition cannot be performed directly since frames P and B do not have the same origins. To perform the composition V_WB
, the velocity of P needs to be shifted to point Bo
:
V_WB_E = V_WPb_E + V_PB_E = V_WP_E.Shift(p_PoBo_E) + V_PB_E
where p_PoBo is the position vector from P's origin to B's origin and V_WPb
is the spatial velocity of a new frame Pb
which is an offset frame rigidly aligned with P, but with its origin shifted to B's origin. The key is that in the expression above, the two spatial velocities being added must be for frames with the same origin point, in this case Bo.
For computation, all quantities above must be expressed in a common frame E; we add an _E
suffix to each symbol to indicate that.
V_PB = 0
and the result of this method equals that of the Shift() operation.[in]  p_PoBo_E  Shift vector from P's origin to B's origin, expressed in frame E. The "from" point Po must be the point whose velocity is currently represented in this spatial velocity, and E must be the same expressedin frame as for this spatial velocity. 
[in]  V_PB_E  The spatial velocity of a third frame B in motion with respect to P, expressed in the same frame E as this spatial velocity. 
V_WB_E  The spatial velocity of frame B in W resulting from the composition of this spatial velocity V_WP and B's velocity in P, V_PB . The result is expressed in the same frame E as this spatial velocity. 
T dot  (  const SpatialForce< T > &  F_Q_E  )  const 
Given this
spatial velocity V_IBp_E
of point P of body B, measured in an inertial frame I and expressed in a frame E, this method computes the 6dimensional dot product with the spatial force F_Bp_E
applied to point P, and expressed in the same frame E in which the spatial velocity is expressed.
This dotproduct represents the power generated by the spatial force when its body and application point have this
spatial velocity. Although the two spatial vectors must be expressed in the same frame, the result is independent of that frame.
this
spatial velocity is measured in an inertial frame I, which cannot be enforced by this class. T dot  (  const SpatialMomentum< T > &  L_NBp_E  )  const 
Given this
spatial velocity V_NBp_E
of rigid body B frame shifted to point P, measured in an inertial (or Newtonian) frame N and, expressed in a frame E this method computes the dot product with the spatial momentum L_NBp_E
of rigid body B, about point P, and expressed in the same frame E.
This dotproduct is twice the kinetic energy ke_NB
of body B in reference frame N. The kinetic energy ke_NB
is independent of the aboutpoint P and so is this dot product. Therefore it is always true that:
ke_NB = 1/2 (L_NBp⋅V_NBp) = 1/2 (L_NBcm⋅V_NBcm)
where L_NBcm
is the spatial momentum about the center of mass of body B and V_NBcm
is the spatial velocity of frame B shifted to its center of mass. The above is true due to how spatial momentum and velocity shift when changing point P, see SpatialMomentum::Shift() and SpatialVelocity::Shift().

default 

default 

inline 
Shift of a SpatialVelocity from one point on a rigid body or frame to another point on the same body or frame.
This is an alternate signature for shifting a spatial velocity's 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 point whose velocity is currently represented in this spatial velocity, and E must be the same expressedin frame as for this spatial velocity. 
V_ABq_E  The spatial velocity of frame B at point Q, measured in frame A and expressed in frame E. 

inline 
Inplace shift of a SpatialVelocity from one point on a rigid body or frame to another point on the same body or frame.
this
spatial velocity V_ABp_E
of a frame B at a point P fixed on B, measured in a frame A, and expressed in a frame E, is modified to become V_ABq_E
, representing the velocity of another point Q on B instead (see class comment for more about this notation). This requires adjusting the translational (linear) velocity component to account for the velocity difference between P and Q due to the angular velocity of B in A.
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 velocity. The operation performed, in coordinatefree form, is:
w_AB = w_AB, i.e. the angular velocity is unchanged. v_ABq = v_ABp + w_AB x p_BpBq
where w and v represent the angular and linear velocity components respectively. Notice this operation is linear. [Jain 2010], (§1.4, page 12) uses the "rigid body transformation operator" to write this as:
V_ABq = Φᵀ(p_BpBq)V_ABp
where Φᵀ(p_PQ)
is the linear operator:
Φᵀ(p_PQ) =  I₃ 0   p_PQx I₃ 
where p_PQx
denotes the cross product, skewsymmetric, matrix such that p_PQx v = p_PQ x v
. This same operator (not its transpose as for spatial velocities) allow us to shift spatial forces, see SpatialForce::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 point whose velocity is currently represented in this spatial velocity, and E must be the same expressedin frame as for this spatial velocity. 
this
spatial velocity which is now V_ABq_E
, that is, the spatial velocity of frame B at point Q, still measured in frame A and expressed in frame E.