Spatial Algebra Utilities
[Global Functions in the SimTK namespace]

These utility functions are used for manipulation of spatial quantities that are contained in SpatialVec or SpatialMat objects. More...

Typedefs

typedef Vec< 2, Vec3 > SpatialVec
 SpatialVec[0] is the rotational component; [1] is translational.
typedef Row< 2, Row3 > SpatialRow
 This is the type of a transposed SpatialVec.
typedef Mat< 2, 2, Mat33 > SpatialMat
 This is used for primarily for spatial mass properties.

Functions

SpatialVec findRelativeVelocity (const Transform &X_FA, const SpatialVec &V_FA, const Transform &X_FB, const SpatialVec &V_FB)
 Find the relative spatial velocity between two frames A and B whose individual spatial velocities are known with respect to a third frame F, with the result returned in A.
SpatialVec findRelativeVelocityInF (const Vec3 &p_AB_F, const SpatialVec &V_FA, const SpatialVec &V_FB)
 Find the relative spatial velocity between two frames A and B whose individual spatial velocities are known in a third frame F, but leave the result in F.
SpatialVec reverseRelativeVelocity (const Transform &X_AB, const SpatialVec &V_AB)
 Given the relative velocity of frame B in frame A, reverse that to give the relative velocity of frame A in B.
SpatialVec reverseRelativeVelocityInA (const Transform &X_AB, const SpatialVec &V_AB)
 Given the relative velocity of frame B in frame A, reverse that to give the relative velocity of frame A in B, but leave the result expressed in frame A.
SpatialVec shiftVelocityBy (const SpatialVec &V_AB, const Vec3 &r_A)
 Shift a relative spatial velocity measured at some point to that same relative spatial quantity but measured at a new point given by an offset from the old one.
SpatialVec shiftVelocityFromTo (const SpatialVec &V_A_BP, const Vec3 &fromP_A, const Vec3 &toQ_A)
 Shift a relative spatial velocity measured at some point P to that same relative spatial quantity but measured at a new point Q given the points P and Q.
SpatialVec shiftForceBy (const SpatialVec &F_AP, const Vec3 &r_A)
 Shift a spatial force applied at some point of a body to that same spatial force applied at a new point given by an offset from the old one.
SpatialVec shiftForceFromTo (const SpatialVec &F_AP, const Vec3 &fromP_A, const Vec3 &toQ_A)
 Shift a spatial force applied at some point P of a body to that same spatial force applied at a new point Q, given P and Q.

Detailed Description

These utility functions are used for manipulation of spatial quantities that are contained in SpatialVec or SpatialMat objects.

These are intended for expert use and are mostly used in the implemention of friendlier methods such as those in MobilizedBody that are used to obtain various spatial quantities.

Note:
Although we use SpatialVec for both, there are two different spatial vector bases: one for motion quantities like velocities, accelerations, and momentum and another for forces and impulses; be sure to use the appropriate functions. Also, we use a pair of ordinary vectors, following Abhi Jain, rather than the similar but subtly different Plucker basis vectors used by Roy Featherstone.

Spatial vectors are used for combined (rotational,translational) quantities. These include

     spatial velocity     = (angularVelocity,linearVelocity)
     spatial acceleration = (angularAcceleration,linearAcceleration)
     spatial force        = (moment,force)

Spatial configuration (pose) has to be handled differently though since orientation is not a vector quantity. We use the Transform class for this concept, which includes an orientation matrix and a translation vector.

See also:
Transform

Typedef Documentation

typedef Mat< 2, 2, Mat33 > SpatialMat

This is used for primarily for spatial mass properties.

typedef Row< 2, Row3 > SpatialRow

This is the type of a transposed SpatialVec.

typedef Vec< 2, Vec3 > SpatialVec

SpatialVec[0] is the rotational component; [1] is translational.


Function Documentation

SpatialVec findRelativeVelocity ( const Transform &  X_FA,
const SpatialVec &  V_FA,
const Transform &  X_FB,
const SpatialVec &  V_FB 
) [inline]

Find the relative spatial velocity between two frames A and B whose individual spatial velocities are known with respect to a third frame F, with the result returned in A.

Parameters:
[in] X_FA The pose of frame A measured and expressed in frame F.
[in] V_FA The spatial velocity of frame A measured and expressed in frame F.
[in] X_FB The pose of frame B measured and expressed in frame F.
[in] V_FB The spatial velocity of frame B measured and expressed in frame F.
Returns:
V_AB, the relative spatial velocity of frame B in frame A, expressed in A.

Given the spatial velocity V_FA of frame A in a reference frame F, and the spatial velocity V_FB of frame B in F, and transforms giving the poses of frames A and B in F, calculate the relative velocity V_AB of frame B in frame A, measured and expressed in A. Typical usage:

    Transform X_GA, X_GB;       // assume these are known from somewhere
    SpatialVec V_GA, V_GB;

    SpatialVec V_AB = findRelativeVelocity(X_FA, V_FA, 
                                           X_FB, V_FB);
Note:
This returns the result expressed in A which is almost always what you want; however, if you don't want it in that frame you can save 30 flops by calling findRelativeVelocityInF() instead.

Cost is 51 flops.

See also:
findRelativeVelocityInF()

References SimTK::findRelativeVelocityInF(), Transform_< P >::p(), and Transform_< P >::R().

SpatialVec findRelativeVelocityInF ( const Vec3 &  p_AB_F,
const SpatialVec &  V_FA,
const SpatialVec &  V_FB 
) [inline]

Find the relative spatial velocity between two frames A and B whose individual spatial velocities are known in a third frame F, but leave the result in F.

Parameters:
[in] p_AB_F The vector from the A frame origin OA to the B frame origin OB, but expressed in frame F.
[in] V_FA The spatial velocity of frame A measured and expressed in frame F.
[in] V_FB The spatial velocity of frame B measured and expressed in frame F.
Returns:
V_AB_F, the relative spatial velocity of frame B in frame A, but still expressed in F.

Typically the relative velocity of B in A would be returned in A; most users will want to use findRelativeVelocity() instead which returns the result in A. Use of this method saves the substantial cost of reexpressing the result, so is useful in the rare case that you don't want the final result in A. Example:

    Transform X_GA, X_GB;       // assume these are known from somewhere
    SpatialVec V_GA, V_GB;

    const Vec3 p_AB_G = X_GB.p() - X_GA.p();
    SpatialVec V_AB_G = findRelativeVelocityInF(p_AB_G, V_GA, V_GB);

Cost is 18 flops.

See also:
findRelativeVelocity()

Referenced by SimTK::findRelativeVelocity().

SpatialVec reverseRelativeVelocity ( const Transform &  X_AB,
const SpatialVec &  V_AB 
) [inline]

Given the relative velocity of frame B in frame A, reverse that to give the relative velocity of frame A in B.

Parameters:
[in] X_AB The pose of frame B in frame A, measured and expressed in A.
[in] V_AB The relative spatial velocity of frame B in frame A, measured and expressed in frame A.
Returns:
V_BA, the relative spatial velocity of frame A in frame B, measured and expressed in B.

The input is expressed in the A frame; the result will be expressed in the B frame instead. If you prefer that the result remain in the A frame you should call reverseRelativeVelocityInA() instead to avoid the extra cost of changing frames. Example:

    Transform  X_AB;    // assume these are known from somewhere
    SpatialVec V_AB;

    SpatialVec V_BA = reverseRelativeVelocity(X_AB, V_AB);
Note:
If the frame origins were in the same spatial location, then the result would just be the negative of the supplied velocity. However, since the linear component of spatial velocity has to be measured at a point, and we're switching from measuring at a point coincident with B's origin OB to one coincident with A's origin OA, there is going to be a change in the linear part of the result. The angular velocity will just be negated, though, and then reexpressed in B.

Cost is 51 flops.

See also:
reverseRelativeVelocityInA()

References Transform_< P >::R(), and SimTK::reverseRelativeVelocityInA().

SpatialVec reverseRelativeVelocityInA ( const Transform &  X_AB,
const SpatialVec &  V_AB 
) [inline]

Given the relative velocity of frame B in frame A, reverse that to give the relative velocity of frame A in B, but leave the result expressed in frame A.

Parameters:
[in] X_AB The pose of frame B in frame A, measured and expressed in A.
[in] V_AB The relative spatial velocity of frame B in frame A, measured and expressed in frame A.
Returns:
V_BA_A, the relative velocity of frame A in frame B, but still expressed in B.

The input V_AB is expressed in the A frame; you will almost always want the output V_BA expressed in the B frame which is what the function reverseRelativeVelocity() does. However, if you're going to want it in some other frame ultimately you may prefer to avoid the substantial cost of reexpressing it in B now, in which case this routine is useful.

See reverseRelativeVelocity() for more information about what this does. Example:

    Transform  X_AB;    // assume these are known from somewhere
    SpatialVec V_AB;    // (expressed in A)

    // result is still expressed in A
    SpatialVec V_BA_A = reverseRelativeVelocityInA(X_AB, V_AB);

Cost is 21 flops.

See also:
reverseRelativeVelocity()

References Transform_< P >::p(), and SimTK::shiftVelocityBy().

Referenced by SimTK::reverseRelativeVelocity().

SpatialVec shiftForceBy ( const SpatialVec &  F_AP,
const Vec3 &  r_A 
) [inline]

Shift a spatial force applied at some point of a body to that same spatial force applied at a new point given by an offset from the old one.

Parameters:
[in] F_AP A spatial force (moment and linear force), expressed in the A frame, whose translational component is applied at a point P.
[in] r_A The vector offset, expressed in frame A, by which to change the point at which the translational component of the input force is to be applied.
Returns:
F_AQ, the same physical effect as the input but with the moment adjusted to reflect force application at point Q=P+r rather than at the original point P.

Given the spatial force F_AP including a pure moment m and a force vector f applied at a point P, return the equivalent force F_AQ representing the same physical quantity but as though the force were applied at a point Q=P+r for some position vector r. All vectors are expressed in frame A. Example:

    SpatialVec F_AP;     // assume these are known from somewhere
    Vec3       offset_A; // Q = P + offset

    SpatialVec F_AQ = shiftForceBy(F_AP, offset_A);
Note:
The shift in location leaves the force f the same but results in an adjustment to the moment of -(r X f).

Cost is 12 flops.

See also:
shiftForceFromTo()

Referenced by SimTK::shiftForceFromTo().

SpatialVec shiftForceFromTo ( const SpatialVec &  F_AP,
const Vec3 &  fromP_A,
const Vec3 &  toQ_A 
) [inline]

Shift a spatial force applied at some point P of a body to that same spatial force applied at a new point Q, given P and Q.

Parameters:
[in] F_AP A spatial force (moment and linear force), expressed in the A frame, whose translational component is applied at a point P.
[in] fromP_A The "from" point P at which the input force is applied, given as a vector from A's origin OA to the point P, expressed in A.
[in] toQ_A The "to" point Q to which we want to move the force application point, given as a vector from A's origin OA to the point Q, expressed in A.
Returns:
F_AQ, the same physical effect as the input but with the moment adjusted to reflect force application at point Q rather than at the original point P.

Given the spatial force F_AP including a pure moment m and a force vector f applied at a point P, return the equivalent force F_AQ representing the same physical quantity but as though the force were applied at a new point Q. All vectors are expressed in frame A and points are measured from A's origin OA. Example:

    // assume these are known from somewhere
    SpatialVec F_AP;    // linear force is applied at point P
    Vec3       p_AP;    // vector from OA to P, in A
    Vec3       p_AQ;    // vector from OA to some other point Q, in A

    SpatialVec F_AQ = shiftForceFromTo(F_AP, p_AP, p_AQ);
Note:
There is no way to know whether the supplied force was actually applied at P; this method really just shifts the application point by the vector r=(to-from). Use it carefully.

Cost is 15 flops.

See also:
shiftForceBy()

References SimTK::shiftForceBy().

SpatialVec shiftVelocityBy ( const SpatialVec &  V_AB,
const Vec3 &  r_A 
) [inline]

Shift a relative spatial velocity measured at some point to that same relative spatial quantity but measured at a new point given by an offset from the old one.

Parameters:
[in] V_AB The relative spatial velocity of frame B in frame A, measured and expressed in frame A.
[in] r_A The vector offset, expressed in frame A, by which to change the point at which the translational component of the relative spatial velocity is measured.
Returns:
V_A_BQ, the relative velocity of frame B in frame A, but measured at the point Q=OB+r rather than at B's origin OB.

Given the spatial velocity V_AB of frame B in A, measured at a point coincident with B's origin OB, change it to the spatial velocity V_A_BQ representing the same relationship but with the velocity measured at a new point Q=OB+r for some position vector r. All vectors are measured and expressed in frame A, including the vector r. Example:

    SpatialVec V_AB;     // assume these are known from somewhere
    Vec3       offset_A; // Q = OB + offset

    SpatialVec V_A_BQ = shiftVelocityBy(V_AB, offset_A);
Note:
The shift in location leaves the relative angular velocity w the same but results in the linear velocity changing by w X r.

Cost is 12 flops.

See also:
shiftVelocityFromTo()

Referenced by SimTK::reverseRelativeVelocityInA(), and SimTK::shiftVelocityFromTo().

SpatialVec shiftVelocityFromTo ( const SpatialVec &  V_A_BP,
const Vec3 &  fromP_A,
const Vec3 &  toQ_A 
) [inline]

Shift a relative spatial velocity measured at some point P to that same relative spatial quantity but measured at a new point Q given the points P and Q.

Parameters:
[in] V_A_BP The relative spatial velocity of frame B in frame A, measured and expressed in frame A, with the linear component measured at a point P.
[in] fromP_A The "from" point P at which the input linear velocity was measured, given as a vector from A's origin OA to the point P, expressed in A.
[in] toQ_A The "to" point Q at which we want to re-measure the linear velocity, given as a vector from A's origin OA to the point Q, expressed in A.
Returns:
V_A_BQ, the relative velocity of frame B in frame A, but measured at the point Q rather than at point P.

Given the spatial velocity V_A_BP of frame B in A, measured at a point P, change it to the spatial velocity V_A_BQ representing the same relationship but with the velocity measured at a new point Q. Example:

    // assume these are known from somewhere
    Transform  X_AB;    // contains the vector from OA to OB  
    SpatialVec V_AB;    // linear velocity is measured at origin OB of B
    Vec3       p_AQ;    // vector from OA to some other point Q, in A

    SpatialVec V_A_BQ = shiftVelocityFromTo(V_AB, X_AB.p(), p_AQ);
Note:
There is no way to know whether the supplied velocity was actually measured at P; this method really just shifts the relative velocity by the vector r=(to-from). Use it carefully.

Cost is 15 flops.

See also:
shiftVelocityBy()

References SimTK::shiftVelocityBy().


Generated on Thu Aug 12 16:37:48 2010 for SimTKcore by  doxygen 1.6.1