Skip to content

Commit a35d9f4

Browse files
committed
system-design/problem.md: bug fixes and gimbal locks
1 parent 0ef5bfe commit a35d9f4

1 file changed

Lines changed: 27 additions & 50 deletions

File tree

system-design/problem.md

Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ $$
102102
$$
103103

104104

105-
* The rotated vector around the X-axis with Z-convention expressed in direction cosines; could be further rewritten using matrix algebra into a **matrix product of a rotation matrix and the vector column matrix**; where $R_x$ is the rotation matrix around X-Axis with Z-convetion:
105+
The rotated vector around the X-axis with Z-convention expressed in direction cosines; could be further rewritten using matrix algebra into a **matrix product of a rotation matrix and the vector column matrix**; where $R_x$ is the rotation matrix around X-Axis with Z-convetion:
106106

107107
$$
108108
\vec{V}^{'} = R_x(\pm \hat{\Phi_R}) \times \vec{V} \\
@@ -113,42 +113,23 @@ $$
113113
\end{pmatrix}
114114
\times
115115
\begin{pmatrix}
116-
\|\vec{V}\|\cos(\phi_{(\vec{V}, \vec{V}_x)}) \\
117-
\|\vec{V}_{yz}\|\sin(\phi_{(\vec{V}_{yz}, \vec{V}_z)}) \\
118-
\|\vec{V}_{yz}\|\cos(\phi_{(\vec{V}_{yz}, \vec{V}_z)})
116+
\|\vec{V}\|.\cos(\phi_{(\vec{V}, \vec{V}_x)}) \\
117+
\|\vec{V}_{yz}\|.\sin(\phi_{(\vec{V}_{yz}, \vec{V}_z)}) \\
118+
\|\vec{V}_{yz}\|.\cos(\phi_{(\vec{V}_{yz}, \vec{V}_z)})
119119
\end{pmatrix}
120120
$$
121121

122-
$$
123-
= \begin{pmatrix}
124-
1 & 0 & 0 \\
125-
0 & \cos(\phi_{R}) & \pm \sin(\phi_{R}) \\
126-
0 & \mp \sin(\Phi_R) & \cos(\phi_{R})
127-
\end{pmatrix}
128-
\times
129-
\begin{pmatrix}
130-
\cos(\phi_{(\vec{V}, \vec{V}_x)}) \\
131-
\sin(\phi_{(\vec{V}_{yz}, \vec{V}_z)}) \\
132-
\cos(\phi_{(\vec{V}_{yz}, \vec{V}_z)})
133-
\end{pmatrix}
134-
\times
135-
\begin{pmatrix}
136-
\|\vec{V}\| \\
137-
\|\vec{V}_{yz}\| \\
138-
\|\vec{V}_{yz}\|
139-
\end{pmatrix}^\top
140-
$$
122+
Therefore, the rest of rotation operations could be expressed using rotation matrices as follows:
141123

142-
* Therefore, the rest of rotation operations could be expressed using rotation matrices as follows:
143-
* Rotation around Y-axis (**X-convention**):
124+
* Rotation around Y-axis (**X-convention**):
144125

145126
$$
146127
\vec{V}^{'} = R_y(\pm \hat{\Phi_R}) \times \vec{V} \\
147128
= \begin{pmatrix}
148-
\|\vec{V}_{xz}\|(\cos(\phi_{R})\cos(\phi_{(\vec{V}_{xz}, \vec{V}_x)}) \mp
129+
\|\vec{V}_{xz}\|.(\cos(\phi_{R})\cos(\phi_{(\vec{V}_{xz}, \vec{V}_x)}) \mp
149130
\sin(\phi_{R})\sin(\phi_{(\vec{V}_{xz}, \vec{V}_x)})) \\
150-
\|\vec{V}\|\cos(\phi_{(\vec{V}, \vec{V}_y)}) \\
151-
\|\vec{V}_{xz}\|(\pm \sin(\phi_{R})\cos(\phi_{(\vec{V}_{xz}, \vec{V}_x)}) + \cos(\phi_{R})\sin(\phi_{(\vec{V}_{xz}, \vec{V}_x)}))
131+
\|\vec{V}\|.\cos(\phi_{(\vec{V}, \vec{V}_y)}) \\
132+
\|\vec{V}_{xz}\|.(\pm \sin(\phi_{R})\cos(\phi_{(\vec{V}_{xz}, \vec{V}_x)}) + \cos(\phi_{R})\sin(\phi_{(\vec{V}_{xz}, \vec{V}_x)}))
152133
\end{pmatrix}
153134
$$
154135

@@ -160,27 +141,21 @@ $$
160141
\end{pmatrix}
161142
\times
162143
\begin{pmatrix}
163-
\cos(\phi_{(\vec{V}_{xz}, \vec{V}_x)}) \\
164-
\cos(\phi_{(\vec{V}, \vec{V}_y)}) \\
165-
\sin(\phi_{(\vec{V}_{xz}, \vec{V}_x)})
144+
\|\vec{V}_{xz}\|.\cos(\phi_{(\vec{V}_{xz}, \vec{V}_x)}) \\
145+
\|\vec{V}\|.\cos(\phi_{(\vec{V}, \vec{V}_y)}) \\
146+
\|\vec{V}_{xz}\|.\sin(\phi_{(\vec{V}_{xz}, \vec{V}_x)})
166147
\end{pmatrix}
167-
\times
168-
\begin{pmatrix}
169-
\|\vec{V}_{xz}\| \\
170-
\|\vec{V}\| \\
171-
\|\vec{V}_{xz}\|
172-
\end{pmatrix}^\top
173148
$$
174149

175-
* Rotation around Z-axis (**X-Convention**) using direction cosines:
150+
* Rotation around Z-axis (**X-Convention**) using direction cosines:
176151

177152
$$
178153
\vec{V}^{'} = R_z(\pm \hat{\Phi_R}) \times \vec{V} \\
179154
= \begin{pmatrix}
180-
\|\vec{V}_{xy}\|(\cos(\phi_{R})\cos(\phi_{(\vec{V}_{xy}, \vec{V}_x)}) \mp
155+
\|\vec{V}_{xy}\|.(\cos(\phi_{R})\cos(\phi_{(\vec{V}_{xy}, \vec{V}_x)}) \mp
181156
\sin(\phi_{R})\sin(\phi_{(\vec{V}_{xy}, \vec{V}_x)})) \\
182-
\|\vec{V}_{xy}\|(\pm \sin(\phi_{R})\cos(\phi_{(\vec{V}_{xy}, \vec{V}_x)}) + \cos(\phi_{R})\sin(\phi_{(\vec{V}_{xy}, \vec{V}_x)})) \\
183-
\|\vec{V}\|\cos(\phi_{(\vec{V}, \vec{V}_z)})
157+
\|\vec{V}_{xy}\|.(\pm \sin(\phi_{R})\cos(\phi_{(\vec{V}_{xy}, \vec{V}_x)}) + \cos(\phi_{R})\sin(\phi_{(\vec{V}_{xy}, \vec{V}_x)})) \\
158+
\|\vec{V}\|.\cos(\phi_{(\vec{V}, \vec{V}_z)})
184159
\end{pmatrix}
185160
$$
186161

@@ -192,16 +167,10 @@ $$
192167
\end{pmatrix}
193168
\times
194169
\begin{pmatrix}
195-
\cos(\phi_{(\vec{V}_{xy}, \vec{V}_x)}) \\
196-
\sin(\phi_{(\vec{V}_{xy}, \vec{V}_x)}) \\
197-
\cos(\phi_{(\vec{V}, \vec{V}_z)}) \\
170+
\|\vec{V}_{xy}\|.\cos(\phi_{(\vec{V}_{xy}, \vec{V}_x)}) \\
171+
\|\vec{V}_{xy}\|.\sin(\phi_{(\vec{V}_{xy}, \vec{V}_x)}) \\
172+
\|\vec{V}\|.\cos(\phi_{(\vec{V}, \vec{V}_z)}) \\
198173
\end{pmatrix}
199-
\times
200-
\begin{pmatrix}
201-
\|\vec{V}_{xy}\| \\
202-
\|\vec{V}_{xy}\| \\
203-
\|\vec{V}\|
204-
\end{pmatrix}^\top
205174
$$
206175

207176
* A set of rotations could be achieved by multiplying the rotation matrices to get the final rotation matrix, and then multiply it with the vector coordinates.
@@ -215,6 +184,14 @@ $$
215184
216185
* Mathematical Modelling: Errors of Rotation and Error Handling Techniques.
217186

187+
**Gimbal Locks**: is a state of orientation in $R^3$ spaces created by rotating around an arbitrary by angle of $\frac{\pi}{2}$ (e.g., $R_x(\frac{\pi}{2})$ ) which results in a loss of a degree of freedom, in which two rotation matrices before and after performing this erroneous operation align in that coordinate system (e.g., $R_y(\hat{\beta})$ and $R_z(\hat{\gamma})$ ); under the conditions that one of them precedes the erroneous rotation, and the other proceeds them, and both the axes of the rotation matrices are orthogonal (i.e., $V_x = V_y \times V_z$ ).
188+
189+
**Unlocking Gimbals**: there are various unlocking algorithm; one common algorithm is to **dynamically remap** rotation matrices of the two orthogonal axes, the other algorithm entails using **clamp functions** to prevent the literal value of $\frac{\pi}{2}$; the clamp functions increment or decrement the value of the angle by a very small amount approaching Zero; so it entails finding the angle in terms of the $\lim_{x=0}(\theta + x)$.
190+
191+
> [!IMPORTANT]
192+
> Error Handling techniques (Anti-failure Measures) for Gimbal Locks:
193+
> (1) **Dynamic Remapping of rotation matrices** for the orthogonal axes that their cross product is the vector for which the erroneous rotation was performed about.
194+
> (2) **Clamping of the angle value using limits of the angle**.
218195
219196
* Mathematical-Physical Model of angular (or rotational) motion in R(2) and R(3) vectorspaces:
220197
(WIP)

0 commit comments

Comments
 (0)