Simbody
3.4 (development)
|
Three mobilities -- body fixed 3-2 (z-y) rotation followed by translation along body z or body x. More...
#include <MobilizedBody_SphericalCoords.h>
Public Member Functions | |
SphericalCoords () | |
Default constructor provides an empty handle that can be assigned to reference any MobilizedBody::SphericalCoords. | |
SphericalCoords (MobilizedBody &parent, const Transform &X_PF, const Body &bodyInfo, const Transform &X_BM, Direction=Forward) | |
Create a SphericalCoords mobilizer between an existing parent (inboard) body P and a new child (outboard) body B created by copying the given bodyInfo into a privately-owned Body within the constructed MobilizedBody object. | |
SphericalCoords (MobilizedBody &parent, const Body &bodyInfo, Direction=Forward) | |
Abbreviated constructor you can use if the mobilizer frames are coincident with the parent and child body frames. | |
SphericalCoords (MobilizedBody &parent, const Transform &X_PF, const Body &bodyInfo, const Transform &X_BM, Real azimuthOffset, bool azimuthNegated, Real zenithOffset, bool zenithNegated, CoordinateAxis radialAxis, bool radialNegated, Direction=Forward) | |
Use this constructor to specify the general case described above. | |
SphericalCoords & | addBodyDecoration (const Transform &X_BD, const DecorativeGeometry &g) |
Add decorative geometry specified relative to the new (outboard) body's reference frame B. | |
SphericalCoords & | addOutboardDecoration (const Transform &X_MD, const DecorativeGeometry &g) |
Add decorative geometry specified relative to the outboard mobilizer frame M attached to body B. | |
SphericalCoords & | addInboardDecoration (const Transform &X_FD, const DecorativeGeometry &g) |
Add decorative geometry specified relative to the inboard mobilizer frame F attached to the parent body P. | |
SphericalCoords & | setDefaultInboardFrame (const Transform &X_PF) |
Change this mobilizer's frame F on the parent body P. | |
SphericalCoords & | setDefaultOutboardFrame (const Transform &X_BM) |
Change this mobilizer's frame M fixed on this (the outboard) body B. | |
SphericalCoords & | setDefaultAngles (const Vec2 &a) |
SphericalCoords & | setDefaultRadius (Real r) |
SphericalCoords & | setRadialAxis (CoordinateAxis) |
SphericalCoords & | setNegateAzimuth (bool) |
SphericalCoords & | setNegateZenith (bool) |
SphericalCoords & | setNegateRadial (bool) |
const Vec2 & | getDefaultAngles () const |
Real | getDefaultTranslation () const |
CoordinateAxis | getRadialAxis () const |
bool | isAzimuthNegated () const |
bool | isZenithNegated () const |
bool | isRadialNegated () const |
void | setAngles (State &s, const Vec2 &a) |
void | setRadius (State &s, Real r) |
const Vec2 & | getAngles (const State &s) const |
Real | getRadius (const State &s) const |
const Vec3 & | getDefaultQ () const |
SphericalCoords & | setDefaultQ (const Vec3 &q) |
const Vec3 & | getQ (const State &) const |
const Vec3 & | getQDot (const State &) const |
const Vec3 & | getQDotDot (const State &) const |
const Vec3 & | getU (const State &) const |
const Vec3 & | getUDot (const State &) const |
void | setQ (State &, const Vec3 &) const |
void | setU (State &, const Vec3 &) const |
const Vec3 & | getMyPartQ (const State &, const Vector &qlike) const |
const Vec3 & | getMyPartU (const State &, const Vector &ulike) const |
Vec3 & | updMyPartQ (const State &, Vector &qlike) const |
Vec3 & | updMyPartU (const State &, Vector &ulike) const |
Three mobilities -- body fixed 3-2 (z-y) rotation followed by translation along body z or body x.
Interpreted as spherical coordinates the first rotation is the azimuth angle, the second is the zenith, and the translation is the radius. We permit a simple mapping from generalized coordinates to (azimuth, zenith, radius):
azimuth = s0*q0 + az0 (about Fz==Mz) zenith = s1*q1 + ze0 (about My) radius = s2*q2 (along Mz or Mx; Mz is default)
where s0,s1,s2 are signs (1 or -1) and az0 and ze0 are offset angles. The F and M frames are coincident when azimuth==zenith==radius==0. But note that with non-zero offsets the F and M frames will not be aligned in the reference configuration where q0==q1==q2==0. The F and M origins will always be coincident when q2==0, however.
With this you can define a "geographical" coordinate system where Mx is the Greenwich line, a is latitude and z longitude (with north positive):
v = Mx s0 = 1, az0 = 0 s1 = -1, ze0 = 0 s2 = 1
If you want the translation direction to be in Mz (the default) but would like q1=0 to mean the equatorial position rather than the (possibly singular) north pole which should be -90, define
v = Mz s0 = 1, az0 = 0 s1 = 1, ze0 = Pi/2 s2 = 1
One common convention for atomic (torsion,bend,stretch) uses the default spherical coordinate system but the final stretch is along the -z direction. For that, take all defaults but set s2=-1.
This mobilizer can be used to give unrestricted 3-d motion to inertialess particles (as with a Cartesian mobilizer but parameterized torsion,bend,stretch instead of x,y,z) but in this case you must watch for two possible singularities: (1) radius==0, and (2) zenith==n*Pi (or equivalently q1==n*Pi-s1*ze0). If your operating range steers clear of those singularities, you're fine.
Default constructor provides an empty handle that can be assigned to reference any MobilizedBody::SphericalCoords.
SimTK::MobilizedBody::SphericalCoords::SphericalCoords | ( | MobilizedBody & | parent, |
const Transform & | X_PF, | ||
const Body & | bodyInfo, | ||
const Transform & | X_BM, | ||
Direction | = Forward |
||
) |
Create a SphericalCoords mobilizer between an existing parent (inboard) body P and a new child (outboard) body B created by copying the given bodyInfo into a privately-owned Body within the constructed MobilizedBody object.
Specify the mobilizer frames F fixed to parent P and M fixed to child B. This constructor gives you a pure spherical coordinate system in which q0=azimuth about Fz(==Mz), q1=zenith about My, and q2=radius along Mz. See the longer signature for more control.
SimTK::MobilizedBody::SphericalCoords::SphericalCoords | ( | MobilizedBody & | parent, |
const Body & | bodyInfo, | ||
Direction | = Forward |
||
) |
Abbreviated constructor you can use if the mobilizer frames are coincident with the parent and child body frames.
SimTK::MobilizedBody::SphericalCoords::SphericalCoords | ( | MobilizedBody & | parent, |
const Transform & | X_PF, | ||
const Body & | bodyInfo, | ||
const Transform & | X_BM, | ||
Real | azimuthOffset, | ||
bool | azimuthNegated, | ||
Real | zenithOffset, | ||
bool | zenithNegated, | ||
CoordinateAxis | radialAxis, | ||
bool | radialNegated, | ||
Direction | = Forward |
||
) |
Use this constructor to specify the general case described above.
SphericalCoords& SimTK::MobilizedBody::SphericalCoords::addBodyDecoration | ( | const Transform & | X_BD, |
const DecorativeGeometry & | geometry | ||
) | [inline] |
Add decorative geometry specified relative to the new (outboard) body's reference frame B.
Note that the body itself may already have had some decorative geometry on it when it was first put into this MobilizedBody; this just adds more and the returned index is larger. Use the underlying Body object's accessors to find this decorative geometry again. The given geometry
object is copied here; we do not keep a reference to the supplied object.
Reimplemented from SimTK::MobilizedBody.
SphericalCoords& SimTK::MobilizedBody::SphericalCoords::addOutboardDecoration | ( | const Transform & | X_MD, |
const DecorativeGeometry & | geometry | ||
) | [inline] |
Add decorative geometry specified relative to the outboard mobilizer frame M attached to body B.
If body B already has decorative geometry on it, this just adds some more, but kept in a separate list from the body decorations and inboard decorations. Returns a unique index that can be used to identify this outboard decoration later (numbered starting from zero for outboard decorations only).
Reimplemented from SimTK::MobilizedBody.
SphericalCoords& SimTK::MobilizedBody::SphericalCoords::addInboardDecoration | ( | const Transform & | X_FD, |
const DecorativeGeometry & | geometry | ||
) | [inline] |
Add decorative geometry specified relative to the inboard mobilizer frame F attached to the parent body P.
If body P already has decorative geometry on it, this just adds some more, but kept in a separate list from the body decorations and outboard decorations. Returns a unique index that can be used to identify this inboard decoration later (numbered starting from zero for inboard decorations only).
Reimplemented from SimTK::MobilizedBody.
SphericalCoords& SimTK::MobilizedBody::SphericalCoords::setDefaultInboardFrame | ( | const Transform & | X_PF | ) | [inline] |
Change this mobilizer's frame F on the parent body P.
Calling this method invalidates the MobilizedBody's topology, so the containing matter subsystem's realizeTopology() method must be called again. A reference to this MobilizedBody is returned so that this can be chained like an assignment operator.
Reimplemented from SimTK::MobilizedBody.
SphericalCoords& SimTK::MobilizedBody::SphericalCoords::setDefaultOutboardFrame | ( | const Transform & | X_BM | ) | [inline] |
Change this mobilizer's frame M fixed on this (the outboard) body B.
Calling this method invalidates the MobilizedBody's topology, so the containing matter subsystem's realizeTopology() method must be called again. A reference to this MobilizedBody is returned so that this can be chained like an assignment operator.
Reimplemented from SimTK::MobilizedBody.
SphericalCoords& SimTK::MobilizedBody::SphericalCoords::setDefaultAngles | ( | const Vec2 & | a | ) | [inline] |
SphericalCoords& SimTK::MobilizedBody::SphericalCoords::setDefaultRadius | ( | Real | r | ) | [inline] |
const Vec2& SimTK::MobilizedBody::SphericalCoords::getDefaultAngles | ( | ) | const [inline] |
Real SimTK::MobilizedBody::SphericalCoords::getDefaultTranslation | ( | ) | const [inline] |
bool SimTK::MobilizedBody::SphericalCoords::isAzimuthNegated | ( | ) | const |
bool SimTK::MobilizedBody::SphericalCoords::isZenithNegated | ( | ) | const |
bool SimTK::MobilizedBody::SphericalCoords::isRadialNegated | ( | ) | const |
void SimTK::MobilizedBody::SphericalCoords::setAngles | ( | State & | s, |
const Vec2 & | a | ||
) | [inline] |
void SimTK::MobilizedBody::SphericalCoords::setRadius | ( | State & | s, |
Real | r | ||
) | [inline] |
const Vec2& SimTK::MobilizedBody::SphericalCoords::getAngles | ( | const State & | s | ) | const [inline] |
Real SimTK::MobilizedBody::SphericalCoords::getRadius | ( | const State & | s | ) | const [inline] |
const Vec3& SimTK::MobilizedBody::SphericalCoords::getDefaultQ | ( | ) | const |
const Vec3& SimTK::MobilizedBody::SphericalCoords::getQ | ( | const State & | ) | const |
const Vec3& SimTK::MobilizedBody::SphericalCoords::getQDot | ( | const State & | ) | const |
const Vec3& SimTK::MobilizedBody::SphericalCoords::getQDotDot | ( | const State & | ) | const |
const Vec3& SimTK::MobilizedBody::SphericalCoords::getU | ( | const State & | ) | const |
const Vec3& SimTK::MobilizedBody::SphericalCoords::getUDot | ( | const State & | ) | const |
void SimTK::MobilizedBody::SphericalCoords::setQ | ( | State & | , |
const Vec3 & | |||
) | const |
void SimTK::MobilizedBody::SphericalCoords::setU | ( | State & | , |
const Vec3 & | |||
) | const |
const Vec3& SimTK::MobilizedBody::SphericalCoords::getMyPartQ | ( | const State & | , |
const Vector & | qlike | ||
) | const |
const Vec3& SimTK::MobilizedBody::SphericalCoords::getMyPartU | ( | const State & | , |
const Vector & | ulike | ||
) | const |
Vec3& SimTK::MobilizedBody::SphericalCoords::updMyPartQ | ( | const State & | , |
Vector & | qlike | ||
) | const |
Vec3& SimTK::MobilizedBody::SphericalCoords::updMyPartU | ( | const State & | , |
Vector & | ulike | ||
) | const |