You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`build_html.sh`| Build script for `jupyter-book`|
@@ -52,6 +53,26 @@ x = np.array([1, 2, 3])
52
53
- LaTeX equations use inline `$...$` or display `$$...$$` syntax with the `dollarmath` MyST extension enabled in `conf.py`.
53
54
- Custom macros (`\myvec`, `\mymatrix`, `\quat`, `\dual`) are defined in `myst.yml` under `project.math`.
54
55
56
+
### `%%capture` magic
57
+
58
+
**`%%capture` magic IS supported** in MyST text notebooks. MyST uses a Jupyter Server with an IPython kernel to execute code cells ([Execute Notebooks at Build Time](https://mystmd.org/guide/execute-notebooks)). The `%%capture` magic is a built-in IPython cell magic ([Built-in magic commands — IPython](https://ipython.readthedocs.io/en/stable/interactive/magics.html)) and works correctly during MyST execution. Use `%%capture` on `%pip install` cells to suppress output.
59
+
60
+
### Downloadable `.ipynb` from `.md` notebooks
61
+
62
+
The `basic_lessons/``.md` files are the canonical source. `.ipynb` files are generated at build time so visitors can download them:
63
+
64
+
1.**CI pipeline** (`.github/workflows/notebook_to_html.yml`) runs `jupytext --from md:myst --to notebook` before the MyST build, converting each `basic_lessons/*.md` → `basic_lessons/*.ipynb`.
65
+
2.**`myst.yml` TOC** references the generated `.ipynb` for the lesson section — MyST renders these identically to the `.md` but provides native "Download notebook" buttons.
66
+
3.**`basic_lessons/.gitignore`** excludes `.ipynb` so only `.md` is tracked in git.
Copy file name to clipboardExpand all lines: basic_lessons/lesson3_tutorial.md
+52-4Lines changed: 52 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,21 +4,69 @@ kernelspec:
4
4
display_name: 'Python 3'
5
5
---
6
6
7
-
# Prerequisites
7
+
# L3 Forward Kinematics
8
+
9
+
*License: CC-BY-NC-SA 4.0*
10
+
11
+
*Author: Murilo M. Marinho (murilo.marinho@manchester.ac.uk)*
12
+
13
+
## Prerequisites for the learner
14
+
The user of this notebook is expected to have prior knowledge in
15
+
- All the content and prerequisites of lessons 1 and 2.
16
+
17
+
## I found an issue
18
+
Thank you! Please report it at https://github.com/MarinhoLab/OpenExecutableBooksRobotics/issues
19
+
20
+
## Package installation
8
21
9
22
````{code-cell}
23
+
%%capture
10
24
%pip install numpy
11
-
%pip install numpy --break-system-packages
12
25
````
13
26
14
-
# Imports
27
+
##Imports
15
28
16
29
````{code-cell}
17
30
import numpy as np
18
31
from math import pi, sin, cos
19
32
````
20
33
21
-
# Forward Kinematics Model (FKM)The forward kinematics model of a rigid serial-link manipulator is obtained through a sequence of transformations.The only real challenge in obtaining the FKM is understanding from a diagram, or a real robot, what transformations represent the robot and in what order they happen.Anyway, we can start with an example. As always, remember that angles are in radians and lengths are in meters.Consider the 2-DoF planar robot shown in the figure. It is classed as an RR robot, because the two joints are revolute.Let $q_0\triangleq q_0(t) \in \mathbb{R}$ and $q_1\triangleq q_1(t) \in \mathbb{R}$ compose its configuration space. In addition, let $l_{0} \in \mathbb{R}$ and $l_{1} \in \mathbb{R}$ be the geometric parameters, which are quantities that cannot be controlled.The configuration space is what is used in practice to control the robot. You as the system designer will send configuration space values $q_0$ and $q_1$, or other signals related to those, to command the robot. You will make it move to perform a relevant task and hopefully earn your next month's salary. The parameters $l_{0}$ and $l_{1}$ are constant in time and represent time-invariant geometrical aspects of the robot, such as link lengths, that you cannot control.As a representative task for robotic manipulators, let us use the configuration space and geometric parameters to calculate the pose of the frame of the tip of the robot. This is represented mathematically as follows.$$\mymatrix{H}^{0}_{2}( q_0, l_{0},q_1,l_{1}) \in SE(2).$$The equation for the end-effector (tip) pose is what is called the forward kinematics model (FKM). We need this frequently when using a robotic manipulator because the end effector is likely to be its most useful part. For instance, it could be a gripper that is used to pick and place objects. To pick or place an object, the robot needs to move somewhere.The first step towards moving somewhere is knowing where you are. Thence, the first step towards controlling a robotic manipulator's end effector pose in any meaningful way is to obtain its FKM.## Understanding the problemThe FKM is a mathematical description of the robot. Before we attempt any programming, we have to mathematically describe the sequential transformations that represent the robot being modelled.As shown in the figure, there are four transformations for this robot, taking us from the base, $\mathcal{F}_0$, to the end-effector, $\mathcal{F}_2$. The sequence can be summarised as follows.1. A rotation of $q_0$ about the current frame, from $\mathcal{F}_0$ to $\mathcal{F}_{0'}$.2. A translation of $l_0$ along the $x$-axis of the current frame, from $\mathcal{F}_{0'}$ to $\mathcal{F}_{1}$.3. A rotation of $q_1$ about the current frame, from $\mathcal{F}_{1}$ to $\mathcal{F}_{1'}$.4. A translation of $l_1$ along the $x$-axis of the current frame, from $\mathcal{F}_{1'}$ to $\mathcal{F}_{2}$.### 1. From $\mathcal{F}_0$ to $\mathcal{F}_{0'}$We start with the rotation that can be described by the following homogeneous transformation matrix.$$\myvec H_{0'}^{0}\left(q_0\right) =\begin{bmatrix} \cos(q_0) & -\sin(q_0) & 0\\\sin(q_0) & \cos(q_0) & 0\\0 & 0 & 1\end{bmatrix}.$$Programmatically, supposing that $q_0 = \frac{\pi}{4}$, we arrive at the following piece of code.
34
+
# Forward Kinematics Model (FKM)
35
+
36
+
The forward kinematics model of a rigid serial-link manipulator is obtained through a sequence of transformations.
37
+
The only real challenge in obtaining the FKM is understanding from a diagram, or a real robot, what transformations represent the robot and in what order they happen.
38
+
Anyway, we can start with an example. As always, remember that angles are in radians and lengths are in meters.
39
+
40
+

41
+
42
+
Consider the 2-DoF planar robot shown in the figure. It is classed as an RR robot, because the two joints are revolute.
43
+
Let $q_0\triangleq q_0(t) \in \mathbb{R}$ and $q_1\triangleq q_1(t) \in \mathbb{R}$ compose its configuration space. In addition, let $l_{0} \in \mathbb{R}$ and $l_{1} \in \mathbb{R}$ be the geometric parameters, which are quantities that cannot be controlled.
44
+
The configuration space is what is used in practice to control the robot. You as the system designer will send configuration space values $q_0$ and $q_1$, or other signals related to those, to command the robot. You will make it move to perform a relevant task and hopefully earn your next month's salary. The parameters $l_{0}$ and $l_{1}$ are constant in time and represent time-invariant geometrical aspects of the robot, such as link lengths, that you cannot control.
45
+
46
+
As a representative task for robotic manipulators, let us use the configuration space and geometric parameters to calculate the pose of the frame of the tip of the robot. This is represented mathematically as follows.
The equation for the end-effector (tip) pose is what is called the forward kinematics model (FKM). We need this frequently when using a robotic manipulator because the end effector is likely to be its most useful part. For instance, it could be a gripper that is used to pick and place objects. To pick or place an object, the robot needs to move somewhere.
51
+
The first step towards moving somewhere is knowing where you are. Thence, the first step towards controlling a robotic manipulator's end effector pose in any meaningful way is to obtain its FKM.
52
+
53
+
## Understanding the problem
54
+
55
+
The FKM is a mathematical description of the robot. Before we attempt any programming, we have to mathematically describe the sequential transformations that represent the robot being modelled.
56
+
As shown in the figure, there are four transformations for this robot, taking us from the base, $\mathcal{F}_0$, to the end-effector, $\mathcal{F}_2$. The sequence can be summarised as follows.
57
+
58
+
1. A rotation of $q_0$ about the current frame, from $\mathcal{F}_0$ to $\mathcal{F}_{0'}$.
59
+
2. A translation of $l_0$ along the $x$-axis of the current frame, from $\mathcal{F}_{0'}$ to $\mathcal{F}_{1}$.
60
+
3. A rotation of $q_1$ about the current frame, from $\mathcal{F}_{1}$ to $\mathcal{F}_{1'}$.
61
+
4. A translation of $l_1$ along the $x$-axis of the current frame, from $\mathcal{F}_{1'}$ to $\mathcal{F}_{2}$.
62
+
63
+
### 1. From $\mathcal{F}_0$ to $\mathcal{F}_{0'}$
64
+
65
+
We start with the rotation that can be described by the following homogeneous transformation matrix.
0 commit comments