Simbody
|
These utility functions are used for manipulation of spatial quantities that are contained in SpatialVec or SpatialMat objects. More...
Typedefs | |
typedef Vec< 2, Vec3 > | SimTK::SpatialVec |
Spatial vectors are used for (rotation,translation) quantities and consist of a pair of Vec3 objects, arranged as a 2-vector of 3-vectors. | |
typedef Row< 2, Row3 > | SimTK::SpatialRow |
This is the type of a transposed SpatialVec; it does not usually appear explicitly in user programs. | |
typedef Mat< 2, 2, Mat33 > | SimTK::SpatialMat |
Spatial matrices are used to hold 6x6 matrices that are best viewed as 2x2 matrices of 3x3 matrices; most commonly for spatial and articulated body inertias and spatial shift matrices. | |
Functions | |
SpatialVec | SimTK::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 | SimTK::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 | SimTK::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 | SimTK::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 | SimTK::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 | SimTK::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 | SimTK::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 | SimTK::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. |
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.
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.
typedef Vec< 2, Vec3 > SimTK::SpatialVec |
Spatial vectors are used for (rotation,translation) quantities and consist of a pair of Vec3 objects, arranged as a 2-vector of 3-vectors.
SpatialVec[0] is the rotational component; [1] is translational.
Quantities represented this way include
Spatial configuration has to be handled differently though since orientation is not a vector quantity. (We use Transform for this concept which includes a Rotation matrix and a translation Vec3.)
typedef Row< 2, Row3 > SimTK::SpatialRow |
This is the type of a transposed SpatialVec; it does not usually appear explicitly in user programs.
This is the type of a transposed SpatialVec.
typedef Mat< 2, 2, Mat33 > SimTK::SpatialMat |
Spatial matrices are used to hold 6x6 matrices that are best viewed as 2x2 matrices of 3x3 matrices; most commonly for spatial and articulated body inertias and spatial shift matrices.
This is used for primarily for spatial mass properties.
They also arise commonly as intermediates in computations involving SpatialVec objects.
SpatialVec SimTK::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.
[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. |
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);
Cost is 51 flops.
SpatialVec SimTK::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.
[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. |
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.
SpatialVec SimTK::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.
[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. |
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);
Cost is 51 flops.
SpatialVec SimTK::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.
[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. |
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.
SpatialVec SimTK::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.
[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. |
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);
Cost is 12 flops.
SpatialVec SimTK::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.
[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. |
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);
Cost is 15 flops.
SpatialVec SimTK::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.
[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. |
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);
Cost is 12 flops.
SpatialVec SimTK::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.
[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. |
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);
Cost is 15 flops.