9.1.5.9. Exercise: Expressing a series of frames#
In Fig. 9.6, the position of the elbow in global coordinates is \((0.34, 0.371, 0)\). Therefore, the frame the expresses the position and incline of the forearm is:
\[\begin{split}
~^\text{global}_\text{forearm}T = \begin{bmatrix}
\cos(\theta) & -\sin(\theta) & 0 & 0.34 \\
\sin(\theta) & \cos(\theta) & 0 & 0.371 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}
\end{split}\]
Using Kinetics Toolkit’s conventions, create a NumPy array that expresses the series of frames for a movement consisting of three inclines: 0°, 15° and 25°.
Show code cell content
import numpy as np
frames = np.array(
[
[
[np.cos(0.0), -np.sin(0.0), 0.0, 0.34],
[np.sin(0.0), np.cos(0.0), 0.0, 0.371],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0],
],
[
[np.cos(np.deg2rad(15.0)), -np.sin(np.deg2rad(15.0)), 0.0, 0.34],
[np.sin(np.deg2rad(15.0)), np.cos(np.deg2rad(15.0)), 0.0, 0.371],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0],
],
[
[np.cos(np.deg2rad(25.0)), -np.sin(np.deg2rad(25.0)), 0.0, 0.34],
[np.sin(np.deg2rad(25.0)), np.cos(np.deg2rad(25.0)), 0.0, 0.371],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0],
],
]
)
frames
array([[[ 1. , -0. , 0. , 0.34 ],
[ 0. , 1. , 0. , 0.371 ],
[ 0. , 0. , 1. , 0. ],
[ 0. , 0. , 0. , 1. ]],
[[ 0.96592583, -0.25881905, 0. , 0.34 ],
[ 0.25881905, 0.96592583, 0. , 0.371 ],
[ 0. , 0. , 1. , 0. ],
[ 0. , 0. , 0. , 1. ]],
[[ 0.90630779, -0.42261826, 0. , 0.34 ],
[ 0.42261826, 0.90630779, 0. , 0.371 ],
[ 0. , 0. , 1. , 0. ],
[ 0. , 0. , 0. , 1. ]]])