-
Notifications
You must be signed in to change notification settings - Fork 164
/
package.mo
132 lines (112 loc) · 4.2 KB
/
package.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
within Modelica.Mechanics.MultiBody.Frames;
package Quaternions "Functions to transform rotational frame quantities based on quaternions (also called Euler parameters)"
extends Modelica.Icons.FunctionsPackage;
annotation (Documentation(info="<html>
<p>
Package <strong>Frames.Quaternions</strong> contains type definitions and
functions to transform rotational frame quantities with quaternions.
Functions of this package are currently only utilized in
MultiBody.Parts.Body components, when quaternions shall be used
as parts of the body states.
Some functions are also used in a new Modelica package for
B-Spline interpolation that is able to interpolate paths consisting of
position vectors and orientation objects.
</p>
<h4>Content</h4>
<p>In the table below an example is given for every function definition.
The used variables have the following declaration:
</p>
<blockquote><pre>
Quaternions.Orientation Q, Q1, Q2, Q_rel, Q_inv;
Real[3,3] T, T_inv;
Real[3] v1, v2, w1, w2, n_x, n_y, n_z, res_ori, phi;
Real[6] res_equal;
Real L, angle;
</pre></blockquote>
<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">
<tr><th><strong><em>Function/type</em></strong></th><th><strong><em>Description</em></strong></th></tr>
<tr><td><strong>Orientation Q;</strong></td>
<td>New type defining a quaternion object that describes<br>
the rotation of frame 1 into frame 2.
</td>
</tr>
<tr><td><strong>der_Orientation</strong> der_Q;</td>
<td>New type defining the first time derivative
of Frames.Quaternions.Orientation.
</td>
</tr>
<tr><td>res_ori = <strong>orientationConstraint</strong>(Q);</td>
<td>Return the constraints between the variables of a quaternion object<br>
(shall be zero).</td>
</tr>
<tr><td>w1 = <strong>angularVelocity1</strong>(Q, der_Q);</td>
<td>Return angular velocity resolved in frame 1 from
quaternion object Q<br> and its derivative der_Q.
</td>
</tr>
<tr><td>w2 = <strong>angularVelocity2</strong>(Q, der_Q);</td>
<td>Return angular velocity resolved in frame 2 from
quaternion object Q<br> and its derivative der_Q.
</td>
</tr>
<tr><td>v1 = <strong>resolve1</strong>(Q,v2);</td>
<td>Transform vector v2 from frame 2 to frame 1.
</td>
</tr>
<tr><td>v2 = <strong>resolve2</strong>(Q,v1);</td>
<td>Transform vector v1 from frame 1 to frame 2.
</td>
</tr>
<tr><td>[v1,w1] = <strong>multipleResolve1</strong>(Q, [v2,w2]);</td>
<td>Transform several vectors from frame 2 to frame 1.
</td>
</tr>
<tr><td>[v2,w2] = <strong>multipleResolve2</strong>(Q, [v1,w1]);</td>
<td>Transform several vectors from frame 1 to frame 2.
</td>
</tr>
<tr><td>Q = <strong>nullRotation</strong>()</td>
<td>Return quaternion object R that does not rotate a frame.
</td>
</tr>
<tr><td>Q_inv = <strong>inverseRotation</strong>(Q);</td>
<td>Return inverse quaternion object.
</td>
</tr>
<tr><td>Q_rel = <strong>relativeRotation</strong>(Q1,Q2);</td>
<td>Return relative quaternion object from two absolute
quaternion objects.
</td>
</tr>
<tr><td>Q2 = <strong>absoluteRotation</strong>(Q1,Q_rel);</td>
<td>Return absolute quaternion object from another
absolute<br> and a relative quaternion object.
</td>
</tr>
<tr><td>Q = <strong>planarRotation</strong>(e, angle);</td>
<td>Return quaternion object of a planar rotation.
</td>
</tr>
<tr><td>phi = <strong>smallRotation</strong>(Q);</td>
<td>Return rotation angles phi valid for a small rotation.
</td>
</tr>
<tr><td>Q = <strong>from_T</strong>(T);</td>
<td>Return quaternion object Q from transformation matrix T.
</td>
</tr>
<tr><td>Q = <strong>from_T_inv</strong>(T_inv);</td>
<td>Return quaternion object Q from inverse transformation matrix T_inv.
</td>
</tr>
<tr><td>T = <strong>to_T</strong>(Q);</td>
<td>Return transformation matrix T from quaternion object Q.
</td>
</tr>
<tr><td>T_inv = <strong>to_T_inv</strong>(Q);</td>
<td>Return inverse transformation matrix T_inv from quaternion object Q.
</td>
</tr>
</table>
</html>"));
end Quaternions;