1
1
# Class for calculating Instantaneous Axis of Rotation
2
2
3
- The instantaneous axis of rotation between two bodies is a useful concept in
4
- biomechanics. In this post, we will dig into how to calculate the instantaneous
5
- axis of rotation and show off an AnyScript ` class_template ` to do this
6
- calculation and plot the axis between any two reference frames in the AnyBody
7
- Modeling System.
8
-
9
- The are several papers that discusses the
10
- importance of the instantaneous axis of rotation in biomechanics. See for
11
- example XX and XX. But first, let us look briefly at the math behind.
12
-
13
- ## 3D Rotations
14
-
15
- We can view any displacement of a body in a three-dimensional space as rotation
16
- around a single axis and a translation along that axis. This gives rise to the
17
- idea of a screw motion in 3D along what is also called the helical axis. If we
18
- spit the movement up into infinitesimally small movements each of these will
19
- have an rotation axis and a linear velocity along that axis. This is the
20
- instantaneous axis of rotation, and as the name indicate will change direction
21
- and location as the object moves.
22
-
23
- If we know the angular and linear velocity of any point on a rigid body, we can
24
- calculate the properties of the screw motion and the instantaneous axis of
25
- rotation.
26
-
27
- From a mathematical point of view the rate of change of a 3x3 rotation matrix
28
- $R$ is:
29
-
30
- $$ \frac{{\mathrm d}}{{\mathrm d}t}R = \vec{\omega} \times R $$
31
-
32
- where $\vec{\omega}$ is called the angular velocity vector. This angular
33
- velocity is quantity shared by all points on the rigid body (including those on
34
- the rotation axis). Using $\vec{\omega}$ we can write the linear velocity
35
- $\vec{v}$ of any point at some distance $\vec{r} from the instantaneous axis of
36
- rotation as:
37
-
38
- $$ \vec{v} = \vec{\omega} \times \vec{r} $$ (1)
39
-
40
- Similarly we can also calculate backwards and find the intantanous axis of
41
- rotation at some distance $-\vec{r}$ from any point if we know the linear
42
- velocity of the point and the angular velocity:
43
-
44
- This is given by:
45
-
46
- $$
47
- -\vec{r}= \frac{\vec{\omega} \times \vec{v} }{ \vec{\omega}\cdot\vec{\omega} }
48
- $$
49
-
50
- Here is short proof. Skip it if you like:
51
-
52
- > Start with $\vec{\omega} \times \vec{v}$, insert (1) and use the tripple product to expand it:
53
- > $$
54
- >\vec{\omega} \times \vec{v} = \vec{\omega} \times (\vec{\omega} \times \vec{r})=\vec{\omega}(\vec{\omega}\cdot\vec{r})-\vec{r}(\vec{\omega}\cdot\vec>{\omega})
55
- > $$
56
- >
57
- > The shortest vector $\vec{r}$ from the rotation axis to any point is by defintion perpendicular to angular velocity $\vec{\omega}$, hence:
58
- >
59
- > $$
60
- >\require{cancel}\vec{\omega} \times \vec{v} =\vec{\omega}(\cancel{\vec{\omega}\cdot\vec{r}})-\vec{r}(\vec{\omega}\cdot\vec{\omega})=-r(\vec{\omega}>\cdot\vec{\omega})
61
- > $$
62
-
63
-
64
-
65
- Thus if know the position of a point $\vec{r}_ P$ we can find closest point
66
- $\vec{r}_ C$ on the rotation axis as:
67
-
68
- $$ \vec{r}_C = \vec{r}_P - \vec{r} = \vec{r}_P + \frac{\vec{\omega}\times\vec{v}_P}{\vec{\omega}\cdot\vec{\omega}} $$
69
-
70
-
71
-
72
- ## Properties
73
-
74
- If for example we have a rigid body with angular velocity $\vec{\omega}$ and
75
- some point $P$ with position $\vec{r}_ P$ and velocity $\vec{v}_ p$ then we can
76
- define the different properties:
77
-
78
- 1 . The magintude of agular rotation:
79
- $$ \omega = \|\vec{\omega}\| $$
80
-
81
- 2 . The direction of the intantanous axis of rotation:
82
-
83
- $$ \vec{v}_{IOAR} = \frac{\vec{\omega}}{\omega} $$
84
-
85
- 3 . The point C on the intantanous axis of rotation:
86
-
87
- $$ \vec{r}_C = \vec{r}_P + \frac{\vec{\omega}\times\vec{v}_P}{\vec{\omega}\cdot\vec{\omega}} $$
88
-
89
- 4 . Ratio of angular to linear angular velocity:
90
-
91
- $$ h = \frac{\vec{\omega} \cdot \vec{v}_P}{\vec{\omega}\cdot\vec{\omega}} $$
92
-
93
- 5 . The linear velocity at point $C$ along the screw axis is then given by
94
-
95
- $$ \vec{v}_C = h\,\vec{\omega} $$
96
-
97
-
98
- All we need to know is the rotation velocity of a body and the velocity of any point to find the instantaneous axis of rotation.
99
-
100
- ## AnyScript implementation
101
-
102
- In AnyScript we can easily find the angular velocity between two reference frames using the class ` AnyKinRotational ` and the linear velocity using the class ` AnyKinLinear ` .
103
-
104
3
We have created a custom class_template that makes it easy to add all this code to a model and display the instantaneous axis of rotation. Here is a short example on how to use the class.
105
4
5
+ First add the following to the top of your main file.
106
6
107
- The class template is called ` InstantaneousAxisOfRotation ` . does exactly this, and then calculate the properties listed above.
108
-
109
-
110
-
111
-
112
- ------------------
113
-
114
-
115
-
116
-
117
-
7
+ ``` c++
8
+ #include " <ANYBODY_PATH_TOOLBOX>/Rotations/InstantaneousAxisOfRotation.any"
9
+ ```
118
10
11
+ Then add the ` InstantaneousAxisOfRotation ` class in one of your studies.
119
12
120
- EXAMPLE:
121
13
``` c++
122
14
#include " <ANYBODY_PATH_TOOLBOX>/Rotations/InstantaneousAxisOfRotation.any"
123
15
@@ -127,7 +19,7 @@ Main = {
127
19
// This is a simple example of using the InstantaneousAxisOfRotation class
128
20
// to the calculate and vizualize the instantaneous axis of rotation
129
21
// between Body1 and Body2
130
- InstantaneousAxisOfRotation IAOR (AnyRefFrame& Body1, AnyRefFrame& Body2 ) =
22
+ InstantaneousAxisOfRotation IAOR (AnyRefFrame& Body1, AnyRefFrame& Body2) =
131
23
{
132
24
// The sphere drawn at the mid point of the vizualized axis.
133
25
#var AnyVar SphereSize=0.02;
@@ -141,11 +33,20 @@ Main = {
141
33
};
142
34
```
143
35
36
+ ## Output
37
+
144
38
The object will IAOR object will plot the axis, and provide the following outputs:
145
39
146
- |---------------------|--------------|------------------------------------------------|
147
- | Output variable | Type | Desciption |
148
- |---------------------|--------------|------------------------------------------------|
149
- | MidPoint | AnyVec3 | The mid point on axis in global coordinates |
150
- | Direction | AnyVec3 | The direction of the axis in global coordinates|
151
- |---------------------|--------------|------------------------------------------------|
40
+ |-----------------------|--------------|------------------------------------------------|
41
+ | Output variable | Type | Desciption |
42
+ |:----------------------|--------------|:-----------------------------------------------|
43
+ | RotationAxisDirections| AnyVec3 | The mid point on axis in Body1 coordinates |
44
+ | RotationMagnitude | AnyVec3 | The direction of the axis in Body1 coordinates |
45
+ | rc_2 | AnyVec3 | Point on axis closest to Body2 |
46
+ | rc_1 | AnyVec3 | Point on axis closest to Body1 |
47
+ | MotionPitch | AnyVar | The ratio of linear motion to angular motion |
48
+ | rc_dot | AnyVec3 | The linear velocity along the axis of rotation |
49
+ | omega | AnyVec3 | Anuglar velocity vector of Body2 wrt. Body1 |
50
+ | r | AnyVec3 | Position of Body2 wrt. Body1 |
51
+ | r_dot | AnyVec3 | Linear velocity of Body2 wrt. Body1 |
52
+ |-----------------------|--------------|------------------------------------------------|
0 commit comments