Simbody  3.4 (development)
SimTK::MobilizedBody::Gimbal Class Reference

Three mobilities -- unrestricted orientation modeled as a 1-2-3 body-fixed Euler angle sequence, though with a singularity when the middle angle is +/- 90 degrees. More...

#include <MobilizedBody_Gimbal.h>

+ Inheritance diagram for SimTK::MobilizedBody::Gimbal:

List of all members.

Public Member Functions

 Gimbal ()
 Default constructor provides an empty handle that can be assigned to reference any MobilizedBody::Gimbal.
 Gimbal (MobilizedBody &parent, const Transform &X_PF, const Body &bodyInfo, const Transform &X_BM, Direction=Forward)
 Create a Gimbal 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.
 Gimbal (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.
GimbalsetDefaultInboardFrame (const Transform &X_PF)
 Change the default inboard ("fixed") frame F on the parent body of this mobilizer.
GimbalsetDefaultOutboardFrame (const Transform &X_BM)
 Change the default outboard ("moving") frame M on this mobilized body (that is, on this mobilizer's child body).
GimbalsetDefaultRotation (const Rotation &R_FM)
 Override the default orientation for this mobilizer.
Rotation getDefaultRotation () const
 Return the default orientation for this mobilizer as a Rotation matrix.
GimbaladdBodyDecoration (const Transform &X_BD, const DecorativeGeometry &g)
 Add DecorativeGeometry to the privately-owned Body contained in this MobilizedBody, positioned relative to the body's frame.
GimbaladdOutboardDecoration (const Transform &X_MD, const DecorativeGeometry &g)
 Add DecorativeGeometry to the privately-owned Body contained in this MobilizedBody, positioned relative to the mobilizer's M frame on that body.
GimbaladdInboardDecoration (const Transform &X_FD, const DecorativeGeometry &g)
 Add DecorativeGeometry to the parent (inboard) body of this mobilizer, positioned relative to the mobilizer's F frame on the parent body.
GimbalsetDefaultRadius (Real r)
 This affects the radius of the ball that will be drawn as default visualization geometry for a Gimbal mobilizer.
Real getDefaultRadius () const
 Get the current value of the default visualization ball radius.
const Vec3getDefaultQ () const
 Obtain the default value for the generalized coordinates q that has been set for this mobilizer.
GimbalsetDefaultQ (const Vec3 &q)
 Set the default value for the generalized coordinates q for this mobilizer.
const Vec3getQ (const State &state) const
 Obtain the current value for this mobilizer's generalized coordinates q from the given State, which must be realized through Stage::Model (these are state variables).
const Vec3getQDot (const State &state) const
 Obtain the current value for this mobilizer's generalized coordinate time derivatives qdot from the given State, which must be realized through Stage::Velocity.
const Vec3getQDotDot (const State &state) const
 Obtain the current value for this mobilizer's generalized coordinate second time derivatives qdotdot from the given State, which must be realized through Stage::Acceleration.
const Vec3getU (const State &state) const
 Obtain the current value for this mobilizer's generalized speeds u from the given State, which must be realized through Stage::Model (these are state variables).
const Vec3getUDot (const State &state) const
 Obtain the current value for this mobilizer's generalized accelerations udot (d/dt u) from the given State, which must be realized through Stage::Acceleration.
void setQ (State &state, const Vec3 &q) const
 Set new values for this mobilizer's generalized coordinates q in the given state.
void setU (State &state, const Vec3 &u) const
 Set new values for this mobilizer's generalized speeds u in the given state.
Advanced/Obscure

Most users won't use these methods.

const Vec3getMyPartQ (const State &state, const Vector &qlike) const
 Given a vector in the System's generalized coordinate basis, extract the three q's belonging to this mobilizer.
const Vec3getMyPartU (const State &state, const Vector &ulike) const
 Given a vector in the System's generalized speed basis, extract the three u's belonging to this mobilizer.
Vec3updMyPartQ (const State &state, Vector &qlike) const
 Given a writable vector in the System's generalized coordinate basis, extract a writable reference to the three q's in that vector that belong to this mobilizer.
Vec3updMyPartU (const State &state, Vector &ulike) const
 Given a writable vector in the System's generalized speed basis, extract a writable reference to the three u's in that vector that belong to this mobilizer.

Detailed Description

Three mobilities -- unrestricted orientation modeled as a 1-2-3 body-fixed Euler angle sequence, though with a singularity when the middle angle is +/- 90 degrees.

Use MobilizedBody::Ball for a similar joint that is free of singularities.

This mobilizer does not provide any translation, so the parent's F frame and child's M frame origins will always be coincident. (MobilizedBody::Bushing is defined like Gimbal but adds translation.) When q0=q1=q2=0, the F and M frames are aligned. Then the generalized coordinates q should be interpreted as a series of rotation angles in radians: q0 is a rotation about the x axis, then q1 is a rotation about the now-rotated y axis, and then q2 is a rotation about the now twice-rotated z axis. The generalized speeds u for the Gimbal mobilizer are the time derivatives of the generalized coordinates, that is, u=qdot. Note that this is different than the choice of generalized speeds used for MobilizedBody::Ball, where the angular velocity vector is used as the three generalized speeds. (Euler angle derivatives are not the same as angular velocity, except when q=0.)

While this mobilizer provides arbitrary orientation, the Euler angle derivatives are singular when q1 (the middle rotation) is near +/- Pi/2. That means you should not attempt to do any dynamics in that configuration; if you can't be sure the motion will remain away from that region, you should use a MobilizedBody::Ball instead, which uses quaternions to ensure singularity-free rotation.

Here is another way to describe the meaning of a Gimbal mobilizer: A Gimbal between frames F and M is exactly equivalent to a series of three pin joints using two massless intermediate bodies B1 and B2. The first pin joint rotates about the common Fx and B1x axes. The second rotates about the common B1y and B2y axes. The last one rotates about the common B2z and Mz axes. Other than performance (which is somewhat better if you use the Gimbal), the pins-and-intermediate bodies system generates exactly the same generalized coordinates and generalized speeds as the Gimbal.

See also:
MobilizedBody::Ball, MobilizedBody::Gimbal

Constructor & Destructor Documentation

Default constructor provides an empty handle that can be assigned to reference any MobilizedBody::Gimbal.

SimTK::MobilizedBody::Gimbal::Gimbal ( MobilizedBody parent,
const Transform X_PF,
const Body bodyInfo,
const Transform X_BM,
Direction  = Forward 
)

Create a Gimbal 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.

SimTK::MobilizedBody::Gimbal::Gimbal ( 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.


Member Function Documentation

Change the default inboard ("fixed") frame F on the parent body of this mobilizer.

The supplied frame is given as a Transform from the parent body's frame P and replaces the F frame specified in the constructor. This is a topological change, meaning that you must call realizeTopology() again if you call this method.

Reimplemented from SimTK::MobilizedBody.

Change the default outboard ("moving") frame M on this mobilized body (that is, on this mobilizer's child body).

The supplied frame is given as a Transform from the child body's frame B and replaces the M frame specified in the constructor. This is a topological change, meaning that you must call realizeTopology() again if you use this method.

Reimplemented from SimTK::MobilizedBody.

Override the default orientation for this mobilizer.

Normally the default is q=0. Here you can provide a Rotation giving the default orientation of the mobilizer's M frame in the parent body's F frame. That orientation will be converted to a body fixed 1-2-3 Euler sequence and used to set the default values for the generalized coordinates q that will appear in a State that has just been created by a realizeTopology() call. This is a topological change, meaning that you must call realizeTopology() again if you use this method.

Return the default orientation for this mobilizer as a Rotation matrix.

This is the initial orientation of the mobilizer's M frame in the parent body's F frame that you will see in a State that has just been created via a realizeTopology() call. This is a topological change, meaning that you must call realizeTopology() again if you use this method.

Add DecorativeGeometry to the privately-owned Body contained in this MobilizedBody, positioned relative to the body's frame.

Reimplemented from SimTK::MobilizedBody.

Add DecorativeGeometry to the privately-owned Body contained in this MobilizedBody, positioned relative to the mobilizer's M frame on that body.

Reimplemented from SimTK::MobilizedBody.

Add DecorativeGeometry to the parent (inboard) body of this mobilizer, positioned relative to the mobilizer's F frame on the parent body.

Reimplemented from SimTK::MobilizedBody.

This affects the radius of the ball that will be drawn as default visualization geometry for a Gimbal mobilizer.

It has no effect whatsoever on simulation or other computations.

Get the current value of the default visualization ball radius.

Obtain the default value for the generalized coordinates q that has been set for this mobilizer.

The value is returned as a 3-vector but note that the returned quantity is not a vector; it is a body fixed 1-2-3 Euler angle sequence in radians. The default is q=0 unless overridden.

See also:
getDefaultRotation()

Set the default value for the generalized coordinates q for this mobilizer.

The value is given as a 3-vector but note that the supplied quantity is not a vector; it is a body fixed 1-2-3 Euler angle sequence in radians. The default is q=0 unless overridden.

See also:
getDefaultRotation()
const Vec3& SimTK::MobilizedBody::Gimbal::getQ ( const State state) const

Obtain the current value for this mobilizer's generalized coordinates q from the given State, which must be realized through Stage::Model (these are state variables).

const Vec3& SimTK::MobilizedBody::Gimbal::getQDot ( const State state) const

Obtain the current value for this mobilizer's generalized coordinate time derivatives qdot from the given State, which must be realized through Stage::Velocity.

These are Euler angle time derivatives and, for the Gimbal mobilizer, have the same numerical values as the generalized speeds u.

const Vec3& SimTK::MobilizedBody::Gimbal::getQDotDot ( const State state) const

Obtain the current value for this mobilizer's generalized coordinate second time derivatives qdotdot from the given State, which must be realized through Stage::Acceleration.

These are Euler angle second time derivatives and, for the Gimbal mobilizer, have the same numerical value as the generalized accelerations udot.

const Vec3& SimTK::MobilizedBody::Gimbal::getU ( const State state) const

Obtain the current value for this mobilizer's generalized speeds u from the given State, which must be realized through Stage::Model (these are state variables).

For the Gimbal joint, these are the time derivatives of q, that is, qdot=u.

const Vec3& SimTK::MobilizedBody::Gimbal::getUDot ( const State state) const

Obtain the current value for this mobilizer's generalized accelerations udot (d/dt u) from the given State, which must be realized through Stage::Acceleration.

For the Gimbal joint, these are the time derivatives of qdot, that is, qdotdot=udot.

void SimTK::MobilizedBody::Gimbal::setQ ( State state,
const Vec3 q 
) const

Set new values for this mobilizer's generalized coordinates q in the given state.

This invalidates Stage::Position and above. The new value is given as a 3-vector, but is interpreted as a body fixed 1-2-3 Euler angle sequence in radians.

void SimTK::MobilizedBody::Gimbal::setU ( State state,
const Vec3 u 
) const

Set new values for this mobilizer's generalized speeds u in the given state.

This invalidates Stage::Velocity and above. The new value is given as a 3-vector, but is interpreted as the time derivatives of a body fixed 1-2-3 Euler angle sequence in radians/time.

const Vec3& SimTK::MobilizedBody::Gimbal::getMyPartQ ( const State state,
const Vector qlike 
) const

Given a vector in the System's generalized coordinate basis, extract the three q's belonging to this mobilizer.

const Vec3& SimTK::MobilizedBody::Gimbal::getMyPartU ( const State state,
const Vector ulike 
) const

Given a vector in the System's generalized speed basis, extract the three u's belonging to this mobilizer.

Vec3& SimTK::MobilizedBody::Gimbal::updMyPartQ ( const State state,
Vector qlike 
) const

Given a writable vector in the System's generalized coordinate basis, extract a writable reference to the three q's in that vector that belong to this mobilizer.

Vec3& SimTK::MobilizedBody::Gimbal::updMyPartU ( const State state,
Vector ulike 
) const

Given a writable vector in the System's generalized speed basis, extract a writable reference to the three u's in that vector that belong to this mobilizer.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines