Skip to content

Commit ba6f88d

Browse files
Merge pull request #49 from HanaeRateau/pr_algosimagestokatex
Adds algorithms md files with katex and deletes images
2 parents 3649aea + 051599a commit ba6f88d

10 files changed

Lines changed: 92 additions & 28 deletions

File tree

data/algorithms/algorithm1.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
$$
2+
\begin{array}{ll}
3+
\textbf{Algorithm 1 } \text{Statics of the continuum legs} \\
4+
\hline
5+
1:\ \text{Initialize } \mathbf{q}^0 \\
6+
2:\ \text{Define a tolerance } \epsilon \\
7+
3:\ i \leftarrow 0 \\
8+
4:\ \textbf{while } \|\mathbf{q}^i - \mathbf{q}^{i-1}\| > \epsilon \textbf{ do} \\
9+
5:\ \quad \text{Find the residual:} \\
10+
\qquad\qquad \mathbf{F}(\mathbf{q}^{i-1}) + \mathbf{Mg} + \mathbf{F}_{ext} = \mathbf{b} & (3)\\
11+
6:\ \quad \text{Approximate } \mathbf{F}(\mathbf{q}^i) \text{ by a linearization around } \mathbf{q}^{i-1}\text{:} \\
12+
\qquad\qquad \mathbf{F}(\mathbf{q}^i) \approx \mathbf{F}(\mathbf{q}^{i-1}) + \underbrace{\dfrac{\partial \mathbf{F}(\mathbf{q}^{i-1})}{\partial \mathbf{q}}}_{-\mathbf{A}} d\mathbf{q} & (4)\\
13+
7:\ \quad \text{Solve the following system:} \\
14+
\qquad\qquad \mathbf{A}\, d\mathbf{q} = \mathbf{b} & (5)\\
15+
8:\ \quad \text{Update } \mathbf{q}^i \text{ (with } 0 < \alpha < 1\text{):} \\
16+
\qquad\qquad \mathbf{q}^i = \mathbf{q}^{i-1} + \alpha\, d\mathbf{q} & (6)\\
17+
9:\ \quad i \leftarrow i + 1 \\
18+
10:\ \textbf{end while} \\
19+
11:\ \textbf{Convergence reached: } \mathbf{q}^i \\
20+
\hline
21+
\end{array}
22+
$$
23+
{width=65%, .center}

data/algorithms/algorithm2.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
$$
2+
\begin{array}{ll}
3+
\textbf{Algorithm 2 } \text{Kinematics of the parallel continuum robot computation } f(\textcolor{red}{\mathbf{u}_a}) = \textcolor{green}{\mathbf{y}_e} \\[0.5em]
4+
\hline \\[-0.5em]
5+
1:\ \text{Initialize } \mathbf{q}^0 = [\mathbf{q}_1^0;\ \mathbf{q}_2^0;\ \mathbf{q}_3^0;\ \mathbf{q}_4^0] \\
6+
2:\ \text{Step 2 and 3 of Algorithm 1} \\
7+
3:\ \textbf{while } \|\mathbf{q}^i - \mathbf{q}^{i-1}\| > \epsilon \textbf{ do} \\
8+
4:\ \quad \text{Find the residual:} \\[0.5em]
9+
\qquad\qquad \left\{
10+
\begin{array}{l}
11+
\mathbf{F}_1(\mathbf{q}_1^{i-1}) + \mathbf{M}_1\mathbf{g} + \mathbf{F}_{ext} = \mathbf{b}_1 \\
12+
\vdots \\
13+
\mathbf{F}_4(\mathbf{q}_4^{i-1}) + \mathbf{M}_4\mathbf{g} + \mathbf{F}_{ext} = \mathbf{b}_4
14+
\end{array}
15+
\right. & (14) \\[1em]
16+
5:\ \quad \text{Compute } \mathbf{A}_1(\mathbf{q}_1^{i-1}),\ \ldots,\ \mathbf{A}_4(\mathbf{q}_4^{i-1}) \text{ by linearizing } \mathbf{F}_j\ (j \in [1,4]) \\
17+
\qquad\ \quad \text{and use the coupling method to obtain } \mathbf{A} \text{ and } \mathbf{b}. \text{ Then solve:} \\[0.5em]
18+
\qquad\qquad \left\{
19+
\begin{array}{l}
20+
\mathbf{A}\, d\mathbf{q} = \mathbf{b} + \mathbf{H}_\mathrm{a}^T \boldsymbol{\lambda}_\mathrm{a} \\
21+
\text{subject to}\\
22+
\boldsymbol{\delta}_\mathrm{a}(\mathbf{q}^{i-1}) + \mathbf{H}_\mathrm{a}\, d\mathbf{q} = \textcolor{red}{\mathbf{u}_a}
23+
\end{array}
24+
\right. & (15) \\[1em]
25+
6:\ \quad \text{Step 8 and 9 of Algorithm 1} \\
26+
7:\ \textbf{end while} \\
27+
8:\ \textbf{return: } \textcolor{green}{\mathbf{y}_e} = \boldsymbol{\delta}_\mathrm{e}(\mathbf{q}^{i-1}) + \mathbf{H}_\mathrm{e}\, d\mathbf{q}\\
28+
\hline
29+
\end{array}
30+
$$
31+
{width=55%, .center}

data/algorithms/algorithm3.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
$$
2+
\begin{array}{ll}
3+
\textbf{Algorithm 3 } \text{Inverse Kinematics obtained by optimization } \textcolor{red}{\mathbf{u}_a} = f^{-1}(\textcolor{green}{\mathbf{y}_e}) \\
4+
\hline
5+
1:\ \text{Initialize } \mathbf{q}^0 = [\mathbf{q}_1^0; \mathbf{q}_2^0] \\
6+
2:\ \text{Step 2 and 3 of Algorithm 1} \\
7+
3:\ \textbf{while } \|\mathbf{q}^i - \mathbf{q}^{i-1}\| > \epsilon \textbf{ do} \\
8+
4:\ \quad \text{Find the residual (like Algorithme 2):} \\
9+
\qquad\qquad \mathbf{F}(\mathbf{q}^{i-1}) + \mathbf{Mg} + \mathbf{F}_{ext} = \mathbf{b} & (19)\\
10+
5:\ \quad \text{Compute } \mathbf{A} \text{ and } \mathbf{b} \text{ and solve} \\
11+
\qquad\qquad \left\{ \begin{array}{l} \mathbf{A}\,d\mathbf{q} = \mathbf{b} + \mathbf{H}_a^T \boldsymbol{\lambda}_a \\ \text{subject to} \\ \displaystyle\min_{\boldsymbol{\lambda}_a} \tfrac{1}{2}(\boldsymbol{\delta}_e(\mathbf{q}_{i-1}) + \mathbf{H}_e d\mathbf{q}) - \textcolor{green}{\mathbf{y}_e})^2 \end{array} \right. & (20) \\
12+
6:\ \quad \text{Step 8 and 9 of Algorithm 1} \\
13+
7:\ \textbf{end while} \\
14+
8:\ \textbf{return: } \textcolor{red}{\mathbf{u}_a} = \boldsymbol{\delta}_a(\mathbf{q}^{i-1}) + \mathbf{H}_a\,d\mathbf{q} \\
15+
\hline
16+
\end{array}
17+
$$

data/images/lab1-algorithm1.png

-80.7 KB
Binary file not shown.

data/images/lab2-algorithm2.png

-141 KB
Binary file not shown.

data/images/lab2-algorithm3.png

-78.9 KB
Binary file not shown.

labs/lab_inversekinematics/sections/2_kinematics.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ Lagrange multiplier $\boldsymbol{\lambda}_{\mathrm{a}}$. Furthermore, the motor
1818
$\boldsymbol{\delta}_{\mathrm{a}}$, is a function of the robot's position $\mathbf{q}$
1919
(which is a concatenation of the leg positions: $\mathbf{q}_1, ..., \mathbf{q}_4$).
2020

21-
![](assets/data/images/lab2-algorithm2.png){width=65%, .center}
21+
22+
#include(assets/data/algorithms/algorithm2.md)
23+
24+
::: spoiler Algorithm 1: Statics of the continuum legs
25+
26+
#include(assets/data/algorithms/algorithm1.md)
27+
28+
:::
29+
30+
<br/>
2231

2332
To compute Equation 15 (in the algorithm above), it is more efficient to proceed with an indirect solution.
2433
We will decompose the movement at each time step by separating the contributions from the force $\mathbf{b}$, which is

labs/lab_inversekinematics/sections/3_inversekinematics.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ There are several challenges in solving this inverse problem:
1010

1111
To handle these challenges, we typically employ QP optimization techniques.
1212

13-
![](assets/data/images/lab2-algorithm3.png){width=65%, .center}
13+
#include(assets/data/algorithms/algorithm3.md){width=65%, .center}
14+
15+
::: spoiler Algorithm 1: Statics of the continuum legs
16+
17+
#include(assets/data/algorithms/algorithm1.md)
18+
19+
:::
20+
21+
<br/>
1422

1523
With the indirect solving, the optimization presented in equation 20 (in the algorithm above) can be rewriten:
1624

labs/lab_models/sections/1_staticanalysis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $$
3030

3131
In practice $\mathbf{F}(\mathbf{q})$ being non-linear, the computation of the equilibrium position is obtained by iterative resolution (see algorithm 1 below).
3232

33-
![](assets/data/images/lab1-algorithm1.png){width=65%, .center}
33+
#include(assets/data/algorithms/algorithm1.md)
3434

3535
To model the various legs and their deformations, we propose three types of modeling of these internal forces:
3636

labs/labsConfig.json

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1 @@
1-
{
2-
"labs": [
3-
{
4-
"name": "introduction"
5-
},
6-
{
7-
"name": "lab_models"
8-
},
9-
{
10-
"name": "lab_inversekinematics"
11-
},
12-
{
13-
"name": "project_pickandplace"
14-
},
15-
{
16-
"name": "lab_design"
17-
},
18-
{
19-
"name": "lab_closedloop"
20-
},
21-
{
22-
"name": "sandbox"
23-
}
24-
]
25-
}
1+
{"labs":[{"name":"introduction"},{"name":"lab_models"},{"name":"lab_inversekinematics"},{"name":"project_pickandplace"},{"name":"lab_design"},{"name":"lab_closedloop"},{"name":"sandbox"}]}

0 commit comments

Comments
 (0)