-
Notifications
You must be signed in to change notification settings - Fork 164
/
angularVelocity2.mo
55 lines (52 loc) · 2.16 KB
/
angularVelocity2.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
within Modelica.Mechanics.MultiBody.Frames.TransformationMatrices;
function angularVelocity2
"Return angular velocity resolved in frame 2 from orientation object and its derivative"
extends Modelica.Icons.Function;
input TransformationMatrices.Orientation T
"Orientation object to rotate frame 1 into frame 2";
input der_Orientation der_T "Derivative of T";
output SI.AngularVelocity w[3]
"Angular velocity of frame 2 with respect to frame 1 resolved in frame 2";
algorithm
/* The angular velocity w of frame 2 with respect to frame 1 resolved in frame 2,
is defined as:
w = vec(T*der(transpose(T)));
where
| 0 -w3 w2 |
skew(w) = | w3 0 -w1 | and w = vec(skew(w))
| -w2 w1 0 |
i.e.
W = T*der(transpose(T))
w = {W(3,2), -W(3,1), W(2,1)}
Therefore, only 3 values of W need to be computed:
| T[1,:] |
W = | T[2,:] | * | der(T[1,:]), der(T[2,:]), der(T[3,:]) |
| T[3,:] |
| W(3,2) | | T[3,:]*der(T[2,:]) |
w = | -W(3,1) | = | -T[3,:]*der(T[1,:]) |
| W(2,1) | | T[2,:]*der(T[1,:]) |
*/
w := {T[3, :]*der_T[2, :],-T[3, :]*der_T[1, :],T[2, :]*der_T[1, :]};
annotation(Inline=true, Documentation(info="<html>
<h4>Syntax</h4>
<blockquote><pre>
w = TransformationMatrices.<strong>angularVelocity2</strong>(T, der_T);
</pre></blockquote>
<h4>Description</h4>
<p>
This function returns the angular velocity w of frame 2 with
respect to frame 1, <strong>resolved in frame 2</strong>, from the
<a href=\"modelica://Modelica.Mechanics.MultiBody.Frames.TransformationMatrices.Orientation\">transformation matrix</a> T
that describes the orientation to rotate frame 1 into frame 2
and from its first time derivative der_T:
</p>
<blockquote><pre>
w = vec( T * der(transpose(T)) ).
</pre></blockquote>
<h4>See also</h4>
<p>
<a href=\"modelica://Modelica.Mechanics.MultiBody.Frames.angularVelocity2\">Frames.angularVelocity2</a>,
<a href=\"modelica://Modelica.Mechanics.MultiBody.Frames.Quaternions.angularVelocity2\">Quaternions.angularVelocity2</a>.
</p>
</html>"));
end angularVelocity2;