Drake
Drake C++ Documentation
Frames and Bodies

The frame and body are fundamental to multibody mechanics.

Unless specified otherwise, each frame (also called a coordinate frame) contains a right-handed orthogonal unitary basis and an origin point. Its name is usually one capital letter (e.g., A, B, or C). Shown below is a frame F. Frame F's origin point Fo locates the frame and its basis orients the frame.

     Fz
^    Fy          Frame F has origin point Fo and a
|   /            right-handed orthogonal basis having
|  /             unit vectors Fx, Fy, Fz.  The basis
| /              is right-handed because Fz = Fx x Fy.
o ------> Fx
Fo


Newton's laws of motion are valid in a non-rotating, non-accelerating "inertial frame", herein called the World frame W (also called Ground frame G or Newtonian Frame N). Any frame with fixed pose in W is also an inertial frame. Drake supports Model frames (inertial frames fixed in W) so a simulation can be built from multiple independent models, each defined with respect to its own Model frame. This corresponds to the <model> tag in an .sdf file.

In unambiguous situations, abbreviated notation uses the frame name to also designate the frame's origin or the frame's basis. For example, if A and B are frames, p_AB denotes the position vector from point Ao (A's origin) to point Bo (B's origin), expressed in frame A (i.e., expressed in terms of unit vectors Ax, Ay, Az). Similarly, w_AB denotes frame B's angular velocity in frame A, expressed in frame A. v_AB denotes the translational velocity of point Bo (B's origin) in frame A, expressed in frame A. V_AB denotes frame B's spatial velocity in frame A, expressed in frame A and is defined as the combination of w_AB and v_AB. See Multibody Quantities for more information about notation.

Each body contains a body frame and we use the same symbol B for both a body B and its body frame. Body B's location is defined via Bo (the origin of the body frame) and body B's pose is defined via the pose of B's body frame. Body properties (e.g., inertia and geometry) are measured with respect to the body frame. Body B's center of mass is denoted Bcm (in typeset as $$B_{cm}$$) and its location is specified by a position vector from Bo to Bcm. Bcm is not necessarily coincident with Bo and body B's translational and spatial properties (e.g., position, velocity, acceleration) are measured using Bo (not Bcm). If an additional frame is fixed to a rigid body, its position is located from the body frame. For a flexible body, deformations are measured with respect to the body frame.

When a user initially specifies a body, such as in a <link> tag of an .sdf or .urdf file, there is a link frame L that may differ from Drake's body frame B. Since frames L and B are always related by a constant transform, parameters (mass properties, visual geometry, collision geometry, etc.) given with respect to frame L are transformed and stored internally with respect to B's body frame.

### Notation for offset frame

As discussed above, a frame F consists of right-handed orthogonal unit vectors Fx, Fy, Fz and an origin point Fo. Sometimes we need a frame that is fixed to F but whose origin is shifted to a point coincident with some other point Q. We call that an offset frame and typeset that as $$F_Q$$ or Fq in code (the lowercase q in Fq is to associate with point Q and compensate for the lack of subscripts in ASCII and unicode). Since Fq is fixed to F, Fq's spatial velocity (and spatial acceleration) measured in frame F is always 0. Consistent with frame notation elsewhere, the name Fq can denote the frame or its origin point (it is disambiguated by context). Frame Fq can be a useful intermediary for calculating Q's velocity or for applying forces from Q to F. Likewise, a rigid body B has a center of mass point Bcm which may be regarded as an offset frame Bcm. There may be a need for other offset frames fixed to body B, e.g., an offset frame Bq whose origin point Bq is fixed to B but instantaneously coincident with a point (or frame) Q, where Q may be moving on B and/or in contact with B. By default, the orthogonal unit vectors in an offset frame Bp are the same as those in B. If Bp's orthogonal unit vectors differ from B, their orientation must be very carefully documented in code.

A FixedOffsetFrame is a special type of offset frame. A FixedOffsetFrame can be constructed with an argument of type RigidTransform. One possible use case for a FixedOffsetFrame is for a body B's center of mass frame Bcm in which the origin of frame Bcm has a constant offset from Bo (body B's origin) and/or frame Bcm has unit vectors with a constant rotation relative to frame B's unit vectors. As documented in FixedOffsetFrame, body frame B is called the "parent frame" and frame Bcm is a fixed offset frame.

Notation example: V_AB $$(^AV^B)$$ denotes the spatial velocity of a frame B measured in a frame A and contains the angular velocity w_AB $$(^A𝛚^B)$$ and translational velocity v_ABo $$(^A𝐯^{Bo})$$. V_AB may also be denoted V_ABo. For a body B, V_ABcm $$(^AV^{Bcm})$$ denotes the spatial velocity of a frame with unit vectors Bx, By, Bz with origin at Bcm (B's center of mass). V_ABq $$(^AV^{Bq)}$$ denotes the spatial velocity of a frame with unit vectors Bx, By, Bz, whose origin point Bq is fixed on B and instantaneously coincident with some point Q.

If this notation is insufficient for your purposes, please carefully and thoughtfully name the offset frame and use comments to precisely describe the orientation of its orthogonal unit vectors and the location of its origin.

Next topic: Multibody Quantities