# Frames¶

## Definitions¶

A frame is defined with an origin position \(\mathbf{P}\) and three unit axes in three dimensions (\(\mathbf{e}_1\), \(\mathbf{e}_2\) and \(\mathbf{e}_3\)) corresponding to a system of coordinates.

Note

A frame can also be considered as a transformation function from a parent frame, with a translation vector and a rotation matrix. Note that a frame has no reference to its parent frame, even if it is constructed based on this parent frame. The frame hierarchy co-exists with its associated item hierarchy : system (world reference frame) –> body (body reference frame) –> node (node reference frame) for example.

Note

By default, a local frame has no parent and depends on the object to which it is associated. When a frame is applied to a body its parent is the world reference frame whereas when a frame is applied to a node (links, cables,…) its parent is the body frame of reference.

### World reference frame¶

The world reference frame (Oxyz) is the arbitrary frame of reference of the simulation. Its geographic origin can be set up, however it’s orientation is mostly defined : the x-axis is always pointing North.

The two available frame conventions are indeed :

- North-West-Up (NWU) with z-axis pointing upward,
- North-East-Down (NED) with z-axis pointing downward.

### Body reference frame¶

The body reference plane locates the body relatively to the world reference frame. Its origin is defined arbitrary by the user: it can be located at the bow, on the keel, at the center of gravity, etc. Its orientation gives the direction of the degrees of freedom:

- surge and roll are respectively the translation and rotation related to the x axis of the reference frame,
- sway and pitch are respectively the translation and rotation related to the y axis of the reference frame,
- heave and yaw are respectively the translation and rotation related to the z axis of the reference frame.

All body components (nodes, links, forces) are then set up, relatively to this reference frame.

## Rotation¶

The direction of a frame can be associated to a rotation, corresponding to the rotation applied to the parent frame to obtain the current frame. This rotation is represented by unit quaternion in FRyDoM to avoid gimbal lock. However, for better convenience, the rotation can be set up with Euler or Cardan angles as exposed in the following.

### Euler angles¶

The Euler angles are a combination of three rotation angles used to represent any rotation or the orientation of a frame relatively to another. These angles are elemental rotations around the axis of a frame of reference. They are usually called \((\phi,\theta,\psi)\) but different sequences exists.

### Cardan angles¶

The Cardan angles are denoted as yaw, pitch and roll, and correspond to the Euler sequence (1,2,3). It consists of three consecutive rotations (Fig. 5) :

- first rotation of an angle \(\psi\) around the z-axis,
- second rotation of an angle \(\theta\) around the y’’’ axis,
- third rotation of an angle \(phi\) around the x’’ axis.

The body reference frame’s x-axis is defined toward the front of the body for both NED and NWU frame convention. However in NED the y-axis is along the starboard (with the z-axis pointing downward) while, in NWU, the y-axis is along to the port (with the z-axis pointing upward). The direct implications on rotation is that a positive change in \(\theta\) corresponds to a pitching downward in the NWU convention, and a pitching upward in the NED convention.

For more information on rotation matrix, and function that pass Cardan angles to their corresponding unit quaternion, please refer to Diebel [DIEBEL].

References

[DIEBEL] | (1, 2) Diebel, J., Representing Attitude: Euler Angles, Unit Quaternions, and Rotation Vectors, 2006, Standford University, https://www.astro.rug.nl/software/kapteyn/_downloads/attitude.pdf |