-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added script to generate the constants table.
- Loading branch information
1 parent
ee2d09e
commit 9e8d442
Showing
3 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
\begin{bmatrix} | ||
0 \\ | ||
0 \\ | ||
0 \\ | ||
0 | ||
\end{bmatrix} | ||
= | ||
\begin{bmatrix} | ||
\omega_{a} - \dot{\theta}_{a}\\ | ||
\omega_{h} - \dot{\theta}_{h}\\ | ||
d_{L} g m_{L} \operatorname{sin}\left(\theta_{a}\right) + d_{L} m_{L} a \operatorname{cos}\left(\theta_{a}\right) + d_{T} g m_{T} \operatorname{sin}\left(\theta_{a} + \theta_{h}\right) + d_{T} l_{L} m_{T} \left(\omega_{a} + \omega_{h}\right)^{2} \operatorname{sin}\left(\theta_{h}\right) - d_{T} l_{L} m_{T} \omega^{2}_{a} \operatorname{sin}\left(\theta_{h}\right) + d_{T} m_{T} a \operatorname{cos}\left(\theta_{a} + \theta_{h}\right) + g l_{L} m_{T} \operatorname{sin}\left(\theta_{a}\right) + l_{L} m_{T} a \operatorname{cos}\left(\theta_{a}\right) - \left(I_{T} + d_{T} m_{T} \left(d_{T} + l_{L} \operatorname{cos}\left(\theta_{h}\right)\right)\right) \dot{\omega}_{h} - \left(I_{L} + I_{T} + d_{L}^{2} m_{L} + m_{T} \left(d_{T}^{2} + 2 d_{T} l_{L} \operatorname{cos}\left(\theta_{h}\right) + l_{L}^{2}\right)\right) \dot{\omega}_{a} + T_{h}\\ | ||
d_{T} g m_{T} \operatorname{sin}\left(\theta_{a} + \theta_{h}\right) - d_{T} l_{L} m_{T} \omega^{2}_{a} \operatorname{sin}\left(\theta_{h}\right) + d_{T} m_{T} a \operatorname{cos}\left(\theta_{a} + \theta_{h}\right) - \left(I_{T} + d_{T}^{2} m_{T}\right) \dot{\omega}_{h} - \left(I_{T} + d_{T} m_{T} \left(d_{T} + l_{L} \operatorname{cos}\left(\theta_{h}\right)\right)\right) \dot{\omega}_{a} + T_{a} | ||
\end{bmatrix} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
|
||
import sympy as sm | ||
from sympy.physics.vector import vlatex | ||
|
||
from model import QuietStandingModel | ||
import utils | ||
|
||
paths = utils.config_paths() | ||
|
||
m = QuietStandingModel() | ||
m.derive() | ||
|
||
# Generate the equations of motion: fr + fr* | ||
fr_plus_frstar = sm.trigsimp(m.fr_plus_frstar) | ||
|
||
template = \ | ||
r"""\begin{{bmatrix}} | ||
0 \\ | ||
0 \\ | ||
0 \\ | ||
0 | ||
\end{{bmatrix}} | ||
= | ||
\begin{{bmatrix}} | ||
{rows} | ||
\end{{bmatrix}}""" | ||
|
||
rows = [] | ||
for row in m.kin_diff_eqs + tuple(fr_plus_frstar): | ||
rows.append(vlatex(row)) | ||
|
||
with open(os.path.join(paths['project_root'], 'eoms.tex'), 'w') as f: | ||
f.write(template.format(rows='\\\\\n'.join(rows))) | ||
|
||
# Generate a table for the open loop model constants. This should have three | ||
# columns: latex variable name, value, units | ||
|
||
units = {'d': r'\si{\meter}', | ||
'l': r'\si{\meter}', | ||
'm': r'\si{\kilogram}', | ||
'I': r'\si{\kilogram\meter\squared}', | ||
'g': r'\si{\meter\per\second\squared}'} | ||
|
||
template = \ | ||
r""" | ||
\begin{{tabular}}{{llll}} | ||
\toprule | ||
Variable & Description & Value & Units \\ | ||
\midrule | ||
{rows} | ||
\bottomrule | ||
\end{{tabular}}""" | ||
|
||
rows = [] | ||
for var, val in m.open_loop_par_map.items(): | ||
|
||
row_tmp = r'${}$ & {} & {:1.3f} & {} \\' | ||
rows.append(row_tmp.format(vlatex(var), 'booger', val, units[str(var)[0]])) | ||
|
||
with open(os.path.join(paths['tables_dir'], 'constants-table.tex'), 'w') as f: | ||
f.write(template.format(rows='\n'.join(rows))) | ||
|
||
# Generate a table of the known gains. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
\begin{tabular}{llll} | ||
\toprule | ||
Variable & Description & Value & Units \\ | ||
\midrule | ||
$l_{L}$ & booger & 0.878 & \si{\meter} \\ | ||
$d_{L}$ & booger & 0.572 & \si{\meter} \\ | ||
$d_{T}$ & booger & 0.314 & \si{\meter} \\ | ||
$m_{L}$ & booger & 32.126 & \si{\kilogram} \\ | ||
$m_{T}$ & booger & 48.831 & \si{\kilogram} \\ | ||
$I_{L}$ & booger & 1.799 & \si{\kilogram\meter\squared} \\ | ||
$I_{T}$ & booger & 2.481 & \si{\kilogram\meter\squared} \\ | ||
$g$ & booger & 9.810 & \si{\meter\per\second\squared} \\ | ||
\bottomrule | ||
\end{tabular} |