Documentation |
On this page… |
---|
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}, a_{y}, a_{z}]. This unit vector encodes the rotation direction according to the right-hand rule. For example, a frame spinning in a counterclockwise direction about the +X axis has rotation axis [1 0 0]. A frame spinning in a clockwise direction about the same axis has rotation axis [-1 0 0].
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}, V_{y}, V_{z}). The scalar component encodes the rotation angle. The vector components encode the rotation axis.
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.
Note: The Transform Sensor block provides a quaternion option for rotation and its first two time-derivatives (angular velocity and acceleration). On the other hand, the Spherical Joint block provides a quaternion option only for rotation — angular velocity and acceleration are measured only in terms of rotation axis and angle. |
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}, V_{y}, V_{z}] is the rotation axis. Axis components can take any value between 0–1.
The rotation transform is a 3×3 matrix that encodes frame rotation. In terms of base frame axes (X, Y, and Z), the follower frame axes (X', Y', and Z') are:
$$\left[\begin{array}{c}X\text{'}\\ Y\text{'}\\ Z\text{'}\end{array}\right]=\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]$$
The transform describes the rotation required to bring one frame into coincidence with another frame. In terms of Transform Sensor port frames, the rotation transform describes the rotation that brings the base port frame into coincidence with the follower port frame.
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 measured 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 base frame to the follower frame.
To measure frame rotation in transform format, use the Transform Sensor block. The block dialog box contains a Transform option that you can select to expose the corresponding physical signal port (labeled R). The transform output is a nine-element matrix with elements valued between 0–1.
^{[1] }Weld Joint is an exception