You can measure frame rotation in different formats. These include
axis-angle, quaternion, and transform. The different formats are available
through the Transform Sensor block and,
to a limited extent, in joint blocks ^{[1]}
. The choice of measurement format depends on the model.
Select the format that is most convenient for the application.

Rotation is a relative quantity. The rotation of one frame is meaningful only with respect to another frame. As such, blocks with rotation sensing capability require two frames to make a measurement: measured and reference frames. In these blocks, the follower frame port identifies the measured frame; the base frame port identifies the reference frame of the measurement.

SimMechanics™ defines the rotation formats according to standard conventions. In some cases, more than one convention exists. This is the case, for example, of the quaternion. To properly interpret rotation measurements, review the definitions of the rotation formats.

Axis-angle is one of the simpler rotation measurement formats. This format uses two parameters to completely describe a rotation: axis vector and angle. The usefulness of the axis-angle format follows directly from Euler's rotation theorem. According to the theorem, any 3–D rotation or rotation sequence can be described as a pure rotation about a single fixed axis.

To measure frame rotation in axis-angle format, use the Transform
Sensor block. The block dialog box contains separate **Axis** and **Angle** parameters
that you can select to expose the corresponding physical signal (PS)
ports (labeled axs and q, respectively). Because the axis-angle parameters
are listed separately, you can choose to measure the axis, the angle,
or both.

The axis output is a 3–D unit vector in the form [*a _{x}*,

The angle output is a scalar number in the range 0–π.
This number encodes the extent of rotation about the measured axis.
By default, the angle is measured in radians. You can change the angle
units in the PS-Simulink Converter block
used to interface with Simulink^{®} blocks.

The quaternion is a rotation representation based on hypercomplex
numbers. This representation uses a 4-vector containing one scalar
(*S*) and three vector components (*V _{x}*,

A key advantage of quaternions is the singularity-free parameter space. Mathematical singularities, present in Euler angle sequences, result in the loss of rotational degrees of freedom. This phenomenon is known as gimbal lock. In SimMechanics, gimbal lock causes numerical errors that lead to simulation failure. The absence of singularities means that quaternions are more robust for simulation purposes.

To measure frame rotation in quaternion format, use:

Transform Sensor block, if measuring rotation between two general frames. The

**Rotation**menu of the dialog box contains a**Quaternion**option that you can select to expose the corresponding physical signal port (labeled Q).Joint block possessing spherical primitive, if measuring 3–D rotation between the two joint frames. The

**Sensing**menu of the dialog box contains a**Position**option that you can select to expose the corresponding physical signal port (also labeled Q). For more information, see Spherical Joint block reference page.

The quaternion output is a 4-element row vector $$Q=\left(\begin{array}{cc}S& V\end{array}\right)$$, where:

$$S=\mathrm{cos}\left(\raisebox{1ex}{$\theta $}\!\left/ \!\raisebox{-1ex}{$2$}\right.\right)$$

and

$$V=[{V}_{x}\text{\hspace{0.17em}}{V}_{y}\text{\hspace{0.17em}}{V}_{z}]\mathrm{sin}\left(\frac{\theta}{2}\right)$$

θ is the rotation
angle. The angle can take any value between 0–π. [*V _{x}*,

The rotation transform is a 3×3 matrix
that encodes frame rotation. In terms of base frame axes [*x*, *y*, *z*]_{B},
the follower frame axes [*x*, *y*, *z*]_{F} are:

$${\left[\begin{array}{c}x\\ y\\ z\end{array}\right]}_{B}=\left[\begin{array}{ccc}{r}_{xx}& {r}_{xy}& {r}_{xz}\\ {r}_{yx}& {r}_{yy}& {r}_{yz}\\ {r}_{zx}& {r}_{zy}& {r}_{zz}\end{array}\right]{\left[\begin{array}{c}x\\ y\\ z\end{array}\right]}_{F}$$

Each matrix column contains the coordinates of a follower frame axis resolved in the base frame. For example, the first column contains the coordinates of the follower frame X-axis, as resolved in the base frame. Similarly, the second and third columns contain the coordinates of the Y and Z-axes, respectively. Operating on a vector with the rotation matrix transforms the vector coordinates from the follower frame to the base frame.

You can sense frame rotation in terms of a rotation matrix using
the Transform Sensor block. The dialog box for this block contains
a **Transform** option that when selected exposes
a physical signal port labeled R. Use this port to output the rotation
matrix signal, for example, for processing and analysis in a Simulink
subsystem—after converting the output physical signal to a
Simulink signal through the PS-Simulink Converter block.

^{[1] }Weld Joint is
an exception

Was this topic helpful?