Add css and js. Add lots of org mode files.

This commit is contained in:
Thomas Dehaeze 2019-03-22 12:03:59 +01:00
parent ca64e189b8
commit 2914d01e8f
54 changed files with 4756 additions and 676 deletions

145
css/htmlize.css Normal file
View File

@ -0,0 +1,145 @@
.org-bold { /* bold */ font-weight: bold; }
.org-bold-italic { /* bold-italic */ font-weight: bold; font-style: italic; }
.org-buffer-menu-buffer { /* buffer-menu-buffer */ font-weight: bold; }
.org-builtin { /* font-lock-builtin-face */ color: #7a378b; }
.org-button { /* button */ text-decoration: underline; }
.org-calendar-today { /* calendar-today */ text-decoration: underline; }
.org-change-log-acknowledgement { /* change-log-acknowledgement */ color: #b22222; }
.org-change-log-conditionals { /* change-log-conditionals */ color: #a0522d; }
.org-change-log-date { /* change-log-date */ color: #8b2252; }
.org-change-log-email { /* change-log-email */ color: #a0522d; }
.org-change-log-file { /* change-log-file */ color: #0000ff; }
.org-change-log-function { /* change-log-function */ color: #a0522d; }
.org-change-log-list { /* change-log-list */ color: #a020f0; }
.org-change-log-name { /* change-log-name */ color: #008b8b; }
.org-comint-highlight-input { /* comint-highlight-input */ font-weight: bold; }
.org-comint-highlight-prompt { /* comint-highlight-prompt */ color: #00008b; }
.org-comment { /* font-lock-comment-face */ color: #999988; font-style: italic; }
.org-comment-delimiter { /* font-lock-comment-delimiter-face */ color: #999988; font-style: italic; }
.org-completions-annotations { /* completions-annotations */ font-style: italic; }
.org-completions-common-part { /* completions-common-part */ color: #000000; background-color: #ffffff; }
.org-completions-first-difference { /* completions-first-difference */ font-weight: bold; }
.org-constant { /* font-lock-constant-face */ color: #008b8b; }
.org-diary { /* diary */ color: #ff0000; }
.org-diff-context { /* diff-context */ color: #7f7f7f; }
.org-diff-file-header { /* diff-file-header */ background-color: #b3b3b3; font-weight: bold; }
.org-diff-function { /* diff-function */ background-color: #cccccc; }
.org-diff-header { /* diff-header */ background-color: #cccccc; }
.org-diff-hunk-header { /* diff-hunk-header */ background-color: #cccccc; }
.org-diff-index { /* diff-index */ background-color: #b3b3b3; font-weight: bold; }
.org-diff-nonexistent { /* diff-nonexistent */ background-color: #b3b3b3; font-weight: bold; }
.org-diff-refine-change { /* diff-refine-change */ background-color: #d9d9d9; }
.org-dired-directory { /* dired-directory */ color: #0000ff; }
.org-dired-flagged { /* dired-flagged */ color: #ff0000; font-weight: bold; }
.org-dired-header { /* dired-header */ color: #228b22; }
.org-dired-ignored { /* dired-ignored */ color: #7f7f7f; }
.org-dired-mark { /* dired-mark */ color: #008b8b; }
.org-dired-marked { /* dired-marked */ color: #ff0000; font-weight: bold; }
.org-dired-perm-write { /* dired-perm-write */ color: #b22222; }
.org-dired-symlink { /* dired-symlink */ color: #a020f0; }
.org-dired-warning { /* dired-warning */ color: #ff0000; font-weight: bold; }
.org-doc { /* font-lock-doc-face */ color: #8b2252; }
.org-escape-glyph { /* escape-glyph */ color: #a52a2a; }
.org-file-name-shadow { /* file-name-shadow */ color: #7f7f7f; }
.org-flyspell-duplicate { /* flyspell-duplicate */ color: #cdad00; font-weight: bold; text-decoration: underline; }
.org-flyspell-incorrect { /* flyspell-incorrect */ color: #ff4500; font-weight: bold; text-decoration: underline; }
.org-fringe { /* fringe */ background-color: #f2f2f2; }
.org-function-name { /* font-lock-function-name-face */ color: teal; }
.org-header-line { /* header-line */ color: #333333; background-color: #e5e5e5; }
.org-help-argument-name { /* help-argument-name */ font-style: italic; }
.org-highlight { /* highlight */ background-color: #b4eeb4; }
.org-holiday { /* holiday */ background-color: #ffc0cb; }
.org-isearch { /* isearch */ color: #b0e2ff; background-color: #cd00cd; }
.org-isearch-fail { /* isearch-fail */ background-color: #ffc1c1; }
.org-italic { /* italic */ font-style: italic; }
.org-keyword { /* font-lock-keyword-face */ color: #0086b3; }
.org-lazy-highlight { /* lazy-highlight */ background-color: #afeeee; }
.org-link { /* link */ color: #0000ff; text-decoration: underline; }
.org-link-visited { /* link-visited */ color: #8b008b; text-decoration: underline; }
.org-log-edit-header { /* log-edit-header */ color: #a020f0; }
.org-log-edit-summary { /* log-edit-summary */ color: #0000ff; }
.org-log-edit-unknown-header { /* log-edit-unknown-header */ color: #b22222; }
.org-match { /* match */ background-color: #ffff00; }
.org-next-error { /* next-error */ background-color: #eedc82; }
.org-nobreak-space { /* nobreak-space */ color: #a52a2a; text-decoration: underline; }
.org-org-archived { /* org-archived */ color: #7f7f7f; }
.org-org-block { /* org-block */ color: #7f7f7f; }
.org-org-block-begin-line { /* org-block-begin-line */ color: #b22222; }
.org-org-block-end-line { /* org-block-end-line */ color: #b22222; }
.org-org-checkbox { /* org-checkbox */ font-weight: bold; }
.org-org-checkbox-statistics-done { /* org-checkbox-statistics-done */ color: #228b22; font-weight: bold; }
.org-org-checkbox-statistics-todo { /* org-checkbox-statistics-todo */ color: #ff0000; font-weight: bold; }
.org-org-clock-overlay { /* org-clock-overlay */ background-color: #ffff00; }
.org-org-code { /* org-code */ color: #7f7f7f; }
.org-org-column { /* org-column */ background-color: #e5e5e5; }
.org-org-column-title { /* org-column-title */ background-color: #e5e5e5; font-weight: bold; text-decoration: underline; }
.org-org-date { /* org-date */ color: #a020f0; text-decoration: underline; }
.org-org-document-info { /* org-document-info */ color: #191970; }
.org-org-document-info-keyword { /* org-document-info-keyword */ color: #7f7f7f; }
.org-org-document-title { /* org-document-title */ color: #191970; font-size: 144%; font-weight: bold; }
.org-org-done { /* org-done */ color: #228b22; font-weight: bold; }
.org-org-drawer { /* org-drawer */ color: #0000ff; }
.org-org-ellipsis { /* org-ellipsis */ color: #b8860b; text-decoration: underline; }
.org-org-footnote { /* org-footnote */ color: #a020f0; text-decoration: underline; }
.org-org-formula { /* org-formula */ color: #b22222; }
.org-org-headline-done { /* org-headline-done */ color: #bc8f8f; }
.org-org-hide { /* org-hide */ color: #ffffff; }
.org-org-latex-and-export-specials { /* org-latex-and-export-specials */ color: #8b4513; }
.org-org-level-1 { /* org-level-1 */ color: #0000ff; }
.org-org-level-2 { /* org-level-2 */ color: #a0522d; }
.org-org-level-3 { /* org-level-3 */ color: #a020f0; }
.org-org-level-4 { /* org-level-4 */ color: #b22222; }
.org-org-level-5 { /* org-level-5 */ color: #228b22; }
.org-org-level-6 { /* org-level-6 */ color: #008b8b; }
.org-org-level-7 { /* org-level-7 */ color: #7a378b; }
.org-org-level-8 { /* org-level-8 */ color: #8b2252; }
.org-org-link { /* org-link */ color: #0000ff; text-decoration: underline; }
.org-org-meta-line { /* org-meta-line */ color: #b22222; }
.org-org-mode-line-clock { /* org-mode-line-clock */ color: #000000; background-color: #bfbfbf; }
.org-org-mode-line-clock-overrun { /* org-mode-line-clock-overrun */ color: #000000; background-color: #ff0000; }
.org-org-quote { /* org-quote */ color: #7f7f7f; }
.org-org-scheduled { /* org-scheduled */ color: #006400; }
.org-org-scheduled-previously { /* org-scheduled-previously */ color: #b22222; }
.org-org-scheduled-today { /* org-scheduled-today */ color: #006400; }
.org-org-sexp-date { /* org-sexp-date */ color: #a020f0; }
.org-org-special-keyword { /* org-special-keyword */ color: #a020f0; }
.org-org-table { /* org-table */ color: #0000ff; }
.org-org-tag { /* org-tag */ font-weight: bold; }
.org-org-target { /* org-target */ text-decoration: underline; }
.org-org-time-grid { /* org-time-grid */ color: #b8860b; }
.org-org-todo { /* org-todo */ color: #ff0000; font-weight: bold; }
.org-org-upcoming-deadline { /* org-upcoming-deadline */ color: #b22222; }
.org-org-verbatim { /* org-verbatim */ color: #7f7f7f; }
.org-org-verse { /* org-verse */ color: #7f7f7f; }
.org-org-warning { /* org-warning */ color: #ff0000; font-weight: bold; }
.org-outline-1 { /* outline-1 */ color: #0000ff; }
.org-outline-2 { /* outline-2 */ color: #a0522d; }
.org-outline-3 { /* outline-3 */ color: #a020f0; }
.org-outline-4 { /* outline-4 */ color: #b22222; }
.org-outline-5 { /* outline-5 */ color: #228b22; }
.org-outline-6 { /* outline-6 */ color: #008b8b; }
.org-outline-7 { /* outline-7 */ color: #7a378b; }
.org-outline-8 { /* outline-8 */ color: #8b2252; }
.org-preprocessor { /* font-lock-preprocessor-face */ color: #7a378b; }
.org-query-replace { /* query-replace */ color: #b0e2ff; background-color: #cd00cd; }
.org-regexp-grouping-backslash { /* font-lock-regexp-grouping-backslash */ font-weight: bold; }
.org-regexp-grouping-construct { /* font-lock-regexp-grouping-construct */ font-weight: bold; }
.org-region { /* region */ background-color: #eedc82; }
.org-secondary-selection { /* secondary-selection */ background-color: #ffff00; }
.org-shadow { /* shadow */ color: #7f7f7f; }
.org-show-paren-match { /* show-paren-match */ background-color: #40e0d0; }
.org-show-paren-mismatch { /* show-paren-mismatch */ color: #ffffff; background-color: #a020f0; }
.org-string { /* font-lock-string-face */ color: #dd1144; }
.org-tool-bar { /* tool-bar */ color: #000000; background-color: #bfbfbf; }
.org-tooltip { /* tooltip */ color: #000000; background-color: #ffffe0; }
.org-trailing-whitespace { /* trailing-whitespace */ background-color: #ff0000; }
.org-type { /* font-lock-type-face */ color: #228b22; }
.org-underline { /* underline */ text-decoration: underline; }
.org-variable-name { /* font-lock-variable-name-face */ color: teal; }
.org-warning { /* font-lock-warning-face */ color: #ff0000; font-weight: bold; }
.org-widget-button { /* widget-button */ font-weight: bold; }
.org-widget-button-pressed { /* widget-button-pressed */ color: #ff0000; }
.org-widget-documentation { /* widget-documentation */ color: #006400; }
.org-widget-field { /* widget-field */ background-color: #d9d9d9; }
.org-widget-inactive { /* widget-inactive */ color: #7f7f7f; }
.org-widget-single-line-field { /* widget-single-line-field */ background-color: #d9d9d9; }

1095
css/readtheorg.css Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
figs/stewart_legs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

571
identification.html Normal file
View File

@ -0,0 +1,571 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2019-03-22 ven. 12:03 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Identification of the Stewart Platform using Simscape</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Thomas Dehaeze" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link rel="stylesheet" type="text/css" href="css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="css/readtheorg.css"/>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="js/readtheorg.js"></script>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "center",
displayIndent: "0em",
"HTML-CSS": { scale: 100,
linebreaks: { automatic: "false" },
webFont: "TeX"
},
SVG: {scale: 100,
linebreaks: { automatic: "false" },
font: "TeX"},
NativeMML: {scale: 100},
TeX: { equationNumbers: {autoNumber: "AMS"},
MultLineWidth: "85%",
TagSide: "right",
TagIndent: ".8em"
}
});
</script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
<div id="content">
<h1 class="title">Identification of the Stewart Platform using Simscape</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org0c15748">1. Identification</a></li>
<li><a href="#orgb51bebd">2. Cartesian Plot</a></li>
<li><a href="#org8822347">3. From a force to force sensor</a></li>
<li><a href="#orgb3f97c3">4. From a force applied in the leg to the displacement of the leg</a></li>
<li><a href="#org4f7f749">5. Transmissibility</a></li>
<li><a href="#orgc027ff6">6. Compliance</a></li>
<li><a href="#orgeb43267">7. Inertial</a></li>
<li><a href="#org702dc6c">8. identifyPlant</a></li>
</ul>
</div>
</div>
<div id="outline-container-org0c15748" class="outline-2">
<h2 id="org0c15748"><span class="section-number-2">1</span> Identification</h2>
<div class="outline-text-2" id="text-1">
<p>
The hexapod structure and Sample structure are initialized.
</p>
<div class="org-src-container">
<pre class="src src-matlab">initializeHexapod<span style="color: #DCDCCC;">()</span>;
initializeSample<span style="color: #DCDCCC;">()</span>;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">G = identifyPlant<span style="color: #DCDCCC;">()</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb51bebd" class="outline-2">
<h2 id="orgb51bebd"><span class="section-number-2">2</span> Cartesian Plot</h2>
<div class="outline-text-2" id="text-2">
<p>
From a force applied in the Cartesian frame to a displacement in the Cartesian frame.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
bode<span style="color: #DCDCCC;">(</span>G.G_cart<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_cart<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">3</span>, <span style="color: #BFEBBF;">3</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
hold off;
</pre>
</div>
</div>
</div>
<div id="outline-container-org8822347" class="outline-2">
<h2 id="org8822347"><span class="section-number-2">3</span> From a force to force sensor</h2>
<div class="outline-text-2" id="text-3">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">2</span>, <span style="color: #BFEBBF;">2</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">3</span>, <span style="color: #BFEBBF;">3</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">4</span>, <span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">5</span>, <span style="color: #BFEBBF;">5</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">6</span>, <span style="color: #BFEBBF;">6</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
hold off;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">2</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">3</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">5</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_forc<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">6</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
hold off;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb3f97c3" class="outline-2">
<h2 id="orgb3f97c3"><span class="section-number-2">4</span> From a force applied in the leg to the displacement of the leg</h2>
<div class="outline-text-2" id="text-4">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">2</span>, <span style="color: #BFEBBF;">2</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">3</span>, <span style="color: #BFEBBF;">3</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">4</span>, <span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">5</span>, <span style="color: #BFEBBF;">5</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">6</span>, <span style="color: #BFEBBF;">6</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
hold off;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">2</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">3</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">5</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">6</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
hold off;
</pre>
</div>
</div>
</div>
<div id="outline-container-org4f7f749" class="outline-2">
<h2 id="org4f7f749"><span class="section-number-2">5</span> Transmissibility</h2>
<div class="outline-text-2" id="text-5">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
bode<span style="color: #DCDCCC;">(</span>G.G_tran<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_tran<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">2</span>, <span style="color: #BFEBBF;">2</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_tran<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">3</span>, <span style="color: #BFEBBF;">3</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
hold off;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
bode<span style="color: #DCDCCC;">(</span>G.G_tran<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">4</span>, <span style="color: #BFEBBF;">4</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_tran<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">5</span>, <span style="color: #BFEBBF;">5</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_tran<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">6</span>, <span style="color: #BFEBBF;">6</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
hold off;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
bode<span style="color: #DCDCCC;">(</span>G.G_tran<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_tran<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">2</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_tran<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">3</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
hold off;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc027ff6" class="outline-2">
<h2 id="orgc027ff6"><span class="section-number-2">6</span> Compliance</h2>
<div class="outline-text-2" id="text-6">
<p>
From a force applied in the Cartesian frame to a relative displacement of the mobile platform with respect to the base.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
bode<span style="color: #DCDCCC;">(</span>G.G_comp<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_comp<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">2</span>, <span style="color: #BFEBBF;">2</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_comp<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">3</span>, <span style="color: #BFEBBF;">3</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
hold off;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgeb43267" class="outline-2">
<h2 id="orgeb43267"><span class="section-number-2">7</span> Inertial</h2>
<div class="outline-text-2" id="text-7">
<p>
From a force applied on the Cartesian frame to the absolute displacement of the mobile platform.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
bode<span style="color: #DCDCCC;">(</span>G.G_iner<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_iner<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">2</span>, <span style="color: #BFEBBF;">2</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
bode<span style="color: #DCDCCC;">(</span>G.G_iner<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">3</span>, <span style="color: #BFEBBF;">3</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
hold off;
</pre>
</div>
</div>
</div>
<div id="outline-container-org702dc6c" class="outline-2">
<h2 id="org702dc6c"><span class="section-number-2">8</span> identifyPlant</h2>
<div class="outline-text-2" id="text-8">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">function</span> <span style="color: #DCDCCC;">[</span><span style="color: #DFAF8F;">sys</span><span style="color: #DCDCCC;">]</span> = <span style="color: #93E0E3;">identifyPlant</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">opts_param</span><span style="color: #DCDCCC;">)</span>
</pre>
</div>
<p>
We use this code block to pass optional parameters.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7F9F7F; font-weight: bold; text-decoration: overline;">%% Default values for opts</span>
opts = struct<span style="color: #DCDCCC;">()</span>;
<span style="color: #7F9F7F; font-weight: bold; text-decoration: overline;">%% Populate opts with input parameters</span>
<span style="color: #F0DFAF; font-weight: bold;">if</span> exist<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'opts_param','var'</span><span style="color: #DCDCCC;">)</span>
<span style="color: #F0DFAF; font-weight: bold;">for</span> <span style="color: #DFAF8F;">opt</span> = <span style="color: #BFEBBF;">fieldnames</span><span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">opts_param</span><span style="color: #DCDCCC;">)</span><span style="color: #BFEBBF;">'</span>
opts.<span style="color: #DCDCCC;">(</span>opt<span style="color: #BFEBBF;">{</span><span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span> = opts_param.<span style="color: #DCDCCC;">(</span>opt<span style="color: #BFEBBF;">{</span><span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
<p>
We defined the options for the <code>linearize</code> command.
Here, we just identify the system at time \(t = 0\).
</p>
<div class="org-src-container">
<pre class="src src-matlab">options = linearizeOptions;
options.SampleTime = <span style="color: #BFEBBF;">0</span>;
</pre>
</div>
<p>
We define the name of the Simulink File used to identification.
</p>
<div class="org-src-container">
<pre class="src src-matlab">mdl = <span style="color: #CC9393;">'stewart'</span>;
</pre>
</div>
<p>
Then we defined the input/output of the transfer function we want to identify.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7F9F7F; font-weight: bold; text-decoration: overline;">%% Inputs</span>
io<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span> = linio<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>mdl, '<span style="color: #7CB8BB;">/</span>F'<span style="color: #BFEBBF;">]</span>, <span style="color: #BFEBBF;">1</span>, 'input'<span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% Cartesian forces</span>
io<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span> = linio<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>mdl, '<span style="color: #7CB8BB;">/</span>Fl'<span style="color: #BFEBBF;">]</span>, <span style="color: #BFEBBF;">1</span>, 'input'<span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% Leg forces</span>
io<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">3</span><span style="color: #DCDCCC;">)</span> = linio<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>mdl, '<span style="color: #7CB8BB;">/</span>Fd'<span style="color: #BFEBBF;">]</span>, <span style="color: #BFEBBF;">1</span>, 'input'<span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% Direct forces</span>
io<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">4</span><span style="color: #DCDCCC;">)</span> = linio<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>mdl, '<span style="color: #7CB8BB;">/</span>Dw'<span style="color: #BFEBBF;">]</span>, <span style="color: #BFEBBF;">1</span>, 'input'<span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% Base motion</span>
<span style="color: #7F9F7F; font-weight: bold; text-decoration: overline;">%% Outputs</span>
io<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">5</span><span style="color: #DCDCCC;">)</span> = linio<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>mdl, '<span style="color: #7CB8BB;">/</span>Dm'<span style="color: #BFEBBF;">]</span>, <span style="color: #BFEBBF;">1</span>, 'output'<span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% Relative Motion</span>
io<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">6</span><span style="color: #DCDCCC;">)</span> = linio<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>mdl, '<span style="color: #7CB8BB;">/</span>Dlm'<span style="color: #BFEBBF;">]</span>, <span style="color: #BFEBBF;">1</span>, 'output'<span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% Displacement of each leg</span>
io<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">7</span><span style="color: #DCDCCC;">)</span> = linio<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>mdl, '<span style="color: #7CB8BB;">/</span>Flm'<span style="color: #BFEBBF;">]</span>, <span style="color: #BFEBBF;">1</span>, 'output'<span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% Force sensor in each leg</span>
io<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">8</span><span style="color: #DCDCCC;">)</span> = linio<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>mdl, '<span style="color: #7CB8BB;">/</span>Xm'<span style="color: #BFEBBF;">]</span>, <span style="color: #BFEBBF;">1</span>, 'output'<span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% Absolute motion of platform</span>
</pre>
</div>
<p>
The linearization is run.
</p>
<div class="org-src-container">
<pre class="src src-matlab">G = linearize<span style="color: #DCDCCC;">(</span>mdl, io, <span style="color: #BFEBBF;">0</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>
<p>
We defined all the Input/Output names of the identified transfer function.
</p>
<div class="org-src-container">
<pre class="src src-matlab">G.InputName = <span style="color: #DCDCCC;">{</span><span style="color: #CC9393;">'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'</span>, <span style="text-decoration: underline;">...</span>
<span style="color: #CC9393;">'F1', 'F2', 'F3', 'F4', 'F5', 'F6'</span>, <span style="text-decoration: underline;">...</span>
<span style="color: #CC9393;">'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'</span>, <span style="text-decoration: underline;">...</span>
<span style="color: #CC9393;">'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'</span><span style="color: #DCDCCC;">}</span>;
G.OutputName = <span style="color: #DCDCCC;">{</span><span style="color: #CC9393;">'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'</span>, <span style="text-decoration: underline;">...</span>
<span style="color: #CC9393;">'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m'</span>, <span style="text-decoration: underline;">...</span>
<span style="color: #CC9393;">'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m'</span>, <span style="text-decoration: underline;">...</span>
<span style="color: #CC9393;">'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'</span><span style="color: #DCDCCC;">}</span>;
</pre>
</div>
<p>
We split the transfer function into sub transfer functions and we compute their minimum realization.
</p>
<div class="org-src-container">
<pre class="src src-matlab">sys.G_cart = minreal<span style="color: #DCDCCC;">(</span>G<span style="color: #BFEBBF;">(</span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'</span><span style="color: #D0BF8F;">}</span><span style="color: #CC9393;">, </span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'</span><span style="color: #D0BF8F;">}</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
sys.G_forc = minreal<span style="color: #DCDCCC;">(</span>G<span style="color: #BFEBBF;">(</span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m'</span><span style="color: #D0BF8F;">}</span><span style="color: #CC9393;">, </span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'F1', 'F2', 'F3', 'F4', 'F5', 'F6'</span><span style="color: #D0BF8F;">}</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
sys.G_legs = minreal<span style="color: #DCDCCC;">(</span>G<span style="color: #BFEBBF;">(</span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m'</span><span style="color: #D0BF8F;">}</span><span style="color: #CC9393;">, </span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'F1', 'F2', 'F3', 'F4', 'F5', 'F6'</span><span style="color: #D0BF8F;">}</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
sys.G_tran = minreal<span style="color: #DCDCCC;">(</span>G<span style="color: #BFEBBF;">(</span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'</span><span style="color: #D0BF8F;">}</span><span style="color: #CC9393;">, </span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'</span><span style="color: #D0BF8F;">}</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
sys.G_comp = minreal<span style="color: #DCDCCC;">(</span>G<span style="color: #BFEBBF;">(</span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'</span><span style="color: #D0BF8F;">}</span><span style="color: #CC9393;">, </span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'</span><span style="color: #D0BF8F;">}</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
sys.G_iner = minreal<span style="color: #DCDCCC;">(</span>G<span style="color: #BFEBBF;">(</span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'</span><span style="color: #D0BF8F;">}</span><span style="color: #CC9393;">, </span><span style="color: #D0BF8F;">{</span><span style="color: #CC9393;">'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'</span><span style="color: #D0BF8F;">}</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #7F9F7F;">% sys.G_all = minreal(G);</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Thomas Dehaeze</p>
<p class="date">Created: 2019-03-22 ven. 12:03</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>

242
identification.org Normal file
View File

@ -0,0 +1,242 @@
#+TITLE: Identification of the Stewart Platform using Simscape
:DRAWER:
#+STARTUP: overview
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/readtheorg.css"/>
#+HTML_HEAD: <script src="js/jquery.min.js"></script>
#+HTML_HEAD: <script src="js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="js/readtheorg.js"></script>
#+LATEX_CLASS: cleanreport
#+LaTeX_CLASS_OPTIONS: [tocnp, secbreak, minted]
#+LaTeX_HEADER: \usepackage{svg}
#+LaTeX_HEADER: \newcommand{\authorFirstName}{Thomas}
#+LaTeX_HEADER: \newcommand{\authorLastName}{Dehaeze}
#+LaTeX_HEADER: \newcommand{\authorEmail}{dehaeze.thomas@gmail.com}
#+PROPERTY: header-args:matlab :session *MATLAB*
#+PROPERTY: header-args:matlab+ :comments org
#+PROPERTY: header-args:matlab+ :exports both
#+PROPERTY: header-args:matlab+ :eval no-export
#+PROPERTY: header-args:matlab+ :output-dir figs
#+PROPERTY: header-args:matlab+ :mkdirp yes
:END:
* Identification
#+begin_src matlab :results none :exports none
<<matlab-init>>
addpath('src');
addpath('library');
#+end_src
#+begin_src matlab :results none :exports none
open stewart
#+end_src
The hexapod structure and Sample structure are initialized.
#+begin_src matlab :results none
initializeHexapod();
initializeSample();
#+end_src
#+begin_src matlab :results none
G = identifyPlant();
#+end_src
* Cartesian Plot
From a force applied in the Cartesian frame to a displacement in the Cartesian frame.
#+begin_src matlab :results none
figure;
hold on;
bode(G.G_cart(1, 1));
bode(G.G_cart(3, 3));
hold off;
#+end_src
* From a force to force sensor
#+begin_src matlab :results none
figure;
hold on;
bode(G.G_forc(1, 1));
bode(G.G_forc(2, 2));
bode(G.G_forc(3, 3));
bode(G.G_forc(4, 4));
bode(G.G_forc(5, 5));
bode(G.G_forc(6, 6));
hold off;
#+end_src
#+begin_src matlab :results none
figure;
hold on;
bode(G.G_forc(1, 1));
bode(G.G_forc(1, 2));
bode(G.G_forc(1, 3));
bode(G.G_forc(1, 4));
bode(G.G_forc(1, 5));
bode(G.G_forc(1, 6));
hold off;
#+end_src
* From a force applied in the leg to the displacement of the leg
#+begin_src matlab :results none
figure;
hold on;
bode(G.G_legs(1, 1));
bode(G.G_legs(2, 2));
bode(G.G_legs(3, 3));
bode(G.G_legs(4, 4));
bode(G.G_legs(5, 5));
bode(G.G_legs(6, 6));
hold off;
#+end_src
#+begin_src matlab :results none
figure;
hold on;
bode(G.G_legs(1, 1));
bode(G.G_legs(1, 2));
bode(G.G_legs(1, 3));
bode(G.G_legs(1, 4));
bode(G.G_legs(1, 5));
bode(G.G_legs(1, 6));
hold off;
#+end_src
* Transmissibility
#+begin_src matlab :results none
figure;
hold on;
bode(G.G_tran(1, 1));
bode(G.G_tran(2, 2));
bode(G.G_tran(3, 3));
hold off;
#+end_src
#+begin_src matlab :results none
figure;
hold on;
bode(G.G_tran(4, 4));
bode(G.G_tran(5, 5));
bode(G.G_tran(6, 6));
hold off;
#+end_src
#+begin_src matlab :results none
figure;
hold on;
bode(G.G_tran(1, 1));
bode(G.G_tran(2, 1));
bode(G.G_tran(3, 1));
hold off;
#+end_src
* Compliance
From a force applied in the Cartesian frame to a relative displacement of the mobile platform with respect to the base.
#+begin_src matlab :results none
figure;
hold on;
bode(G.G_comp(1, 1));
bode(G.G_comp(2, 2));
bode(G.G_comp(3, 3));
hold off;
#+end_src
* Inertial
From a force applied on the Cartesian frame to the absolute displacement of the mobile platform.
#+begin_src matlab :results none
figure;
hold on;
bode(G.G_iner(1, 1));
bode(G.G_iner(2, 2));
bode(G.G_iner(3, 3));
hold off;
#+end_src
* identifyPlant
:PROPERTIES:
:HEADER-ARGS:matlab+: :exports code
:HEADER-ARGS:matlab+: :comments yes
:HEADER-ARGS:matlab+: :eval no
:HEADER-ARGS:matlab+: :tangle src/identifyPlant.m
:END:
#+begin_src matlab
function [sys] = identifyPlant(opts_param)
#+end_src
We use this code block to pass optional parameters.
#+begin_src matlab
%% Default values for opts
opts = struct();
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
end
#+end_src
We defined the options for the =linearize= command.
Here, we just identify the system at time $t = 0$.
#+begin_src matlab
options = linearizeOptions;
options.SampleTime = 0;
#+end_src
We define the name of the Simulink File used to identification.
#+begin_src matlab
mdl = 'stewart';
#+end_src
Then we defined the input/output of the transfer function we want to identify.
#+begin_src matlab
%% Inputs
io(1) = linio([mdl, '/F'], 1, 'input'); % Cartesian forces
io(2) = linio([mdl, '/Fl'], 1, 'input'); % Leg forces
io(3) = linio([mdl, '/Fd'], 1, 'input'); % Direct forces
io(4) = linio([mdl, '/Dw'], 1, 'input'); % Base motion
%% Outputs
io(5) = linio([mdl, '/Dm'], 1, 'output'); % Relative Motion
io(6) = linio([mdl, '/Dlm'], 1, 'output'); % Displacement of each leg
io(7) = linio([mdl, '/Flm'], 1, 'output'); % Force sensor in each leg
io(8) = linio([mdl, '/Xm'], 1, 'output'); % Absolute motion of platform
#+end_src
The linearization is run.
#+begin_src matlab
G = linearize(mdl, io, 0);
#+end_src
We defined all the Input/Output names of the identified transfer function.
#+begin_src matlab
G.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz', ...
'F1', 'F2', 'F3', 'F4', 'F5', 'F6', ...
'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz', ...
'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'};
G.OutputName = {'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm', ...
'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m', ...
'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m', ...
'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'};
#+end_src
We split the transfer function into sub transfer functions and we compute their minimum realization.
#+begin_src matlab
sys.G_cart = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'}));
sys.G_forc = minreal(G({'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m'}, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'}));
sys.G_legs = minreal(G({'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m'}, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'}));
sys.G_tran = minreal(G({'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'}, {'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'}));
sys.G_comp = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'}));
sys.G_iner = minreal(G({'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'}, {'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'}));
% sys.G_all = minreal(G);
#+end_src
#+begin_src matlab
end
#+end_src

301
index.html Normal file
View File

@ -0,0 +1,301 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2019-03-22 ven. 12:03 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Stewart Platform Studies</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Thomas Dehaeze" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link rel="stylesheet" type="text/css" href="css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="css/readtheorg.css"/>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="js/readtheorg.js"></script>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="content">
<h1 class="title">Stewart Platform Studies</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org2b3b6a5">1. Simscape Model</a></li>
<li><a href="#org5dc817d">2. Architecture Study</a></li>
<li><a href="#orgccde31a">3. Motion Control</a></li>
</ul>
</div>
</div>
<div id="outline-container-org2b3b6a5" class="outline-2">
<h2 id="org2b3b6a5"><span class="section-number-2">1</span> Simscape Model</h2>
<div class="outline-text-2" id="text-1">
<ul class="org-ul">
<li><a href="simscape-model.html">Model of the Stewart Platform</a></li>
<li><a href="identification.html">Identification</a></li>
</ul>
</div>
</div>
<div id="outline-container-org5dc817d" class="outline-2">
<h2 id="org5dc817d"><span class="section-number-2">2</span> Architecture Study</h2>
<div class="outline-text-2" id="text-2">
<ul class="org-ul">
<li><a href="kinematic-study.html">Kinematic Study</a></li>
<li><a href="stiffness-study.html">Stiffness Matrix Study</a></li>
<li>Jacobian Study</li>
</ul>
</div>
</div>
<div id="outline-container-orgccde31a" class="outline-2">
<h2 id="orgccde31a"><span class="section-number-2">3</span> Motion Control</h2>
<div class="outline-text-2" id="text-3">
<ul class="org-ul">
<li>Active Damping</li>
<li>Inertial Control</li>
<li>Decentralized Control</li>
</ul>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Thomas Dehaeze</p>
<p class="date">Created: 2019-03-22 ven. 12:03</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>

639
index.org
View File

@ -1,4 +1,4 @@
#+TITLE: Stewart Platform with Simscape
#+TITLE: Stewart Platform Studies
:DRAWER:
#+STARTUP: overview
@ -11,6 +11,7 @@
#+LATEX_CLASS: cleanreport
#+LaTeX_CLASS_OPTIONS: [tocnp, secbreak, minted]
#+LaTeX_HEADER: \usepackage{svg}
#+LaTeX_HEADER: \newcommand{\authorFirstName}{Thomas}
#+LaTeX_HEADER: \newcommand{\authorLastName}{Dehaeze}
#+LaTeX_HEADER: \newcommand{\authorEmail}{dehaeze.thomas@gmail.com}
@ -23,626 +24,16 @@
#+PROPERTY: header-args:matlab+ :mkdirp yes
:END:
#+begin_src matlab :results none
<<matlab-init>>
addpath('src');
addpath('library');
#+end_src
#+begin_src matlab :results none
open stewart
#+end_src
#+begin_src matlab
hexapod = initializeHexapod();
#+end_src
#+RESULTS:
: org_babel_eoe
#+begin_src matlab
initializeSample();
#+end_src
#+begin_src matlab
G = identifyPlant();
#+end_src
#+RESULTS:
* Functions
:PROPERTIES:
:HEADER-ARGS:matlab+: :exports code
:HEADER-ARGS:matlab+: :comments no
:HEADER-ARGS:matlab+: :mkdir yes
:HEADER-ARGS:matlab+: :eval no
:END:
** getMaxPositions
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/getMaxPositions.m
:END:
#+begin_src matlab
function [X, Y, Z] = getMaxPositions(stewart)
Leg = stewart.Leg;
J = stewart.J;
theta = linspace(0, 2*pi, 100);
phi = linspace(-pi/2 , pi/2, 100);
dmax = zeros(length(theta), length(phi));
for i = 1:length(theta)
for j = 1:length(phi)
L = J*[cos(phi(j))*cos(theta(i)) cos(phi(j))*sin(theta(i)) sin(phi(j)) 0 0 0]';
dmax(i, j) = Leg.stroke/max(abs(L));
end
end
X = dmax.*cos(repmat(phi,length(theta),1)).*cos(repmat(theta,length(phi),1))';
Y = dmax.*cos(repmat(phi,length(theta),1)).*sin(repmat(theta,length(phi),1))';
Z = dmax.*sin(repmat(phi,length(theta),1));
end
#+end_src
** getMaxPureDisplacement
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/getMaxPureDisplacement.m
:END:
#+begin_src matlab
function [max_disp] = getMaxPureDisplacement(Leg, J)
max_disp = zeros(6, 1);
max_disp(1) = Leg.stroke/max(abs(J*[1 0 0 0 0 0]'));
max_disp(2) = Leg.stroke/max(abs(J*[0 1 0 0 0 0]'));
max_disp(3) = Leg.stroke/max(abs(J*[0 0 1 0 0 0]'));
max_disp(4) = Leg.stroke/max(abs(J*[0 0 0 1 0 0]'));
max_disp(5) = Leg.stroke/max(abs(J*[0 0 0 0 1 0]'));
max_disp(6) = Leg.stroke/max(abs(J*[0 0 0 0 0 1]'));
end
#+end_src
** getStiffnessMatrix
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/getStiffnessMatrix.m
:END:
#+begin_src matlab
function [K] = getStiffnessMatrix(k, J)
% k - leg stiffness
% J - Jacobian matrix
K = k*(J'*J);
end
#+end_src
** identifyPlant
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/identifyPlant.m
:END:
#+begin_src matlab
function [sys] = identifyPlant(opts_param)
%% Default values for opts
opts = struct();
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
end
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'stewart_identification';
%% Input/Output definition
io(1) = linio([mdl, '/F'], 1, 'input'); % Cartesian forces
io(2) = linio([mdl, '/Fl'], 1, 'input'); % Leg forces
io(3) = linio([mdl, '/Fd'], 1, 'input'); % Direct forces
io(4) = linio([mdl, '/Dw'], 1, 'input'); % Base motion
io(5) = linio([mdl, '/Dm'], 1, 'output'); % Relative Motion
io(6) = linio([mdl, '/Dlm'], 1, 'output'); % Displacement of each leg
io(7) = linio([mdl, '/Flm'], 1, 'output'); % Force sensor in each leg
io(8) = linio([mdl, '/Xm'], 1, 'output'); % Absolute motion of platform
%% Run the linearization
G = linearize(mdl, io, 0);
%% Input/Output names
G.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz', ...
'F1', 'F2', 'F3', 'F4', 'F5', 'F6', ...
'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz', ...
'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'};
G.OutputName = {'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm', ...
'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m', ...
'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m', ...
'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'};
%% Cut into sub transfer functions
sys.G_cart = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'}));
sys.G_forc = minreal(G({'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m'}, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'}));
sys.G_legs = G({'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m'}, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'});
sys.G_tran = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'}));
sys.G_comp = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'}));
sys.G_iner = minreal(G({'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'}, {'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'}));
sys.G_all = minreal(G);
end
#+end_src
** initializeHexapod
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/initializeHexapod.m
:END:
*** Function description and arguments
The =initializeHexapod= function takes one structure that contains configurations for the hexapod and returns one structure representing the hexapod.
#+begin_src matlab
function [stewart] = initializeHexapod(opts_param)
#+end_src
Default values for opts.
#+begin_src matlab
opts = struct(...
'height', 90, ... % Height of the platform [mm]
'density', 8000, ... % Density of the material used for the hexapod [kg/m3]
'k_ax', 1e8, ... % Stiffness of each actuator [N/m]
'c_ax', 100, ... % Damping of each actuator [N/(m/s)]
'stroke', 50e-6, ... % Maximum stroke of each actuator [m]
'name', 'stewart' ... % Name of the file
);
#+end_src
Populate opts with input parameters
#+begin_src matlab
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
end
#+end_src
*** Initialization of the stewart structure
We initialize the Stewart structure
#+begin_src matlab
stewart = struct();
#+end_src
And we defined its total height.
#+begin_src matlab
stewart.H = opts.height; % [mm]
#+end_src
*** Bottom Plate
#+name: fig:stewart_bottom_plate
#+caption: Schematic of the bottom plates with all the parameters
[[file:./figs/stewart_bottom_plate.png]]
The bottom plate structure is initialized.
#+begin_src matlab
BP = struct();
#+end_src
We defined its internal radius (if there is a hole in the bottom plate) and its outer radius.
#+begin_src matlab
BP.Rint = 0; % Internal Radius [mm]
BP.Rext = 150; % External Radius [mm]
#+end_src
We define its thickness.
#+begin_src matlab
BP.H = 10; % Thickness of the Bottom Plate [mm]
#+end_src
At which radius legs will be fixed and with that angle offset.
#+begin_src matlab
BP.Rleg = 100; % Radius where the legs articulations are positionned [mm]
BP.alpha = 10; % Angle Offset [deg]
#+end_src
We defined the density of the material of the bottom plate.
#+begin_src matlab
BP.density = opts.density; % Density of the material [kg/m3]
#+end_src
And its color.
#+begin_src matlab
BP.color = [0.7 0.7 0.7]; % Color [RGB]
#+end_src
Then the profile of the bottom plate is computed and will be used by Simscape
#+begin_src matlab
BP.shape = [BP.Rint BP.H; BP.Rint 0; BP.Rext 0; BP.Rext BP.H]; % [mm]
#+end_src
The structure is added to the stewart structure
#+begin_src matlab
stewart.BP = BP;
#+end_src
*** Top Plate
The top plate structure is initialized.
#+begin_src matlab
TP = struct();
#+end_src
We defined the internal and external radius of the top plate.
#+begin_src matlab
TP.Rint = 0; % [mm]
TP.Rext = 100; % [mm]
#+end_src
The thickness of the top plate.
#+begin_src matlab
TP.H = 10; % [mm]
#+end_src
At which radius and angle are fixed the legs.
#+begin_src matlab
TP.Rleg = 100; % Radius where the legs articulations are positionned [mm]
TP.alpha = 20; % Angle [deg]
TP.dalpha = 0; % Angle Offset from 0 position [deg]
#+end_src
The density of its material.
#+begin_src matlab
TP.density = opts.density; % Density of the material [kg/m3]
#+end_src
Its color.
#+begin_src matlab
TP.color = [0.7 0.7 0.7]; % Color [RGB]
#+end_src
Then the shape of the top plate is computed
#+begin_src matlab
TP.shape = [TP.Rint TP.H; TP.Rint 0; TP.Rext 0; TP.Rext TP.H];
#+end_src
The structure is added to the stewart structure
#+begin_src matlab
stewart.TP = TP;
#+end_src
*** Legs
#+name: fig:stewart_legs
#+caption: Schematic for the legs of the Stewart platform
[[file:./figs/stewart_legs.png]]
The leg structure is initialized.
#+begin_src matlab
Leg = struct();
#+end_src
The maximum Stroke of each leg is defined.
#+begin_src matlab
Leg.stroke = opts.stroke; % [m]
#+end_src
The stiffness and damping of each leg are defined
#+begin_src matlab
Leg.k_ax = opts.k_ax; % Stiffness of each leg [N/m]
Leg.c_ax = opts.c_ax; % Damping of each leg [N/(m/s)]
#+end_src
The radius of the legs are defined
#+begin_src matlab
Leg.Rtop = 10; % Radius of the cylinder of the top part of the leg[mm]
Leg.Rbot = 12; % Radius of the cylinder of the bottom part of the leg [mm]
#+end_src
The density of its material.
#+begin_src matlab
Leg.density = opts.density; % Density of the material used for the legs [kg/m3]
#+end_src
Its color.
#+begin_src matlab
Leg.color = [0.5 0.5 0.5]; % Color of the top part of the leg [RGB]
#+end_src
The radius of spheres representing the ball joints are defined.
#+begin_src matlab
Leg.R = 1.3*Leg.Rbot; % Size of the sphere at the extremity of the leg [mm]
#+end_src
The structure is added to the stewart structure
#+begin_src matlab
stewart.Leg = Leg;
#+end_src
*** Ball Joints
#+name: fig:stewart_ball_joints
#+caption: Schematic of the support for the ball joints
[[file:./figs/stewart_ball_joints.png]]
=SP= is the structure representing the support for the ball joints at the extremity of each leg.
The =SP= structure is initialized.
#+begin_src matlab
SP = struct();
#+end_src
We can define its rotational stiffness and damping. For now, we use perfect joints.
#+begin_src matlab
SP.k = 0; % [N*m/deg]
SP.c = 0; % [N*m/deg]
#+end_src
Its height is defined
#+begin_src matlab
SP.H = 15; % [mm]
#+end_src
Its radius is based on the radius on the sphere at the end of the legs.
#+begin_src matlab
SP.R = Leg.R; % [mm]
#+end_src
#+begin_src matlab
SP.section = [0 SP.H-SP.R;
0 0;
SP.R 0;
SP.R SP.H];
#+end_src
The density of its material is defined.
#+begin_src matlab
SP.density = opts.density; % [kg/m^3]
#+end_src
Its color is defined.
#+begin_src matlab
SP.color = [0.7 0.7 0.7]; % [RGB]
#+end_src
The structure is added to the Hexapod structure
#+begin_src matlab
stewart.SP = SP;
#+end_src
*** More parameters are initialized
#+begin_src matlab
stewart = initializeParameters(stewart);
#+end_src
*** Save the Stewart Structure
#+begin_src matlab
save('./mat/stewart.mat', 'stewart')
#+end_src
*** initializeParameters Function
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle no
:END:
#+begin_src matlab
function [stewart] = initializeParameters(stewart)
#+end_src
Computation of the position of the connection points on the base and moving platform
We first initialize =pos_base= corresponding to $[a_1, a_2, a_3, a_4, a_5, a_6]^T$ and =pos_top= corresponding to $[b_1, b_2, b_3, b_4, b_5, b_6]^T$.
#+begin_src matlab
stewart.pos_base = zeros(6, 3);
stewart.pos_top = zeros(6, 3);
#+end_src
We estimate the height between the ball joints of the bottom platform and of the top platform.
#+begin_src matlab
height = stewart.H - stewart.BP.H - stewart.TP.H - 2*stewart.SP.H; % [mm]
#+end_src
#+begin_src matlab
for i = 1:3
% base points
angle_m_b = 120*(i-1) - stewart.BP.alpha;
angle_p_b = 120*(i-1) + stewart.BP.alpha;
stewart.pos_base(2*i-1,:) = [stewart.BP.Rleg*cos(angle_m_b), stewart.BP.Rleg*sin(angle_m_b), 0.0];
stewart.pos_base(2*i,:) = [stewart.BP.Rleg*cos(angle_p_b), stewart.BP.Rleg*sin(angle_p_b), 0.0];
% top points
angle_m_t = 120*(i-1) - stewart.TP.alpha + stewart.TP.dalpha;
angle_p_t = 120*(i-1) + stewart.TP.alpha + stewart.TP.dalpha;
stewart.pos_top(2*i-1,:) = [stewart.TP.Rleg*cos(angle_m_t), stewart.TP.Rleg*sin(angle_m_t), height];
stewart.pos_top(2*i,:) = [stewart.TP.Rleg*cos(angle_p_t), stewart.TP.Rleg*sin(angle_p_t), height];
end
% permute pos_top points so that legs are end points of base and top points
stewart.pos_top = [stewart.pos_top(6,:); stewart.pos_top(1:5,:)]; %6th point on top connects to 1st on bottom
stewart.pos_top_tranform = stewart.pos_top - height*[zeros(6, 2),ones(6, 1)];
#+end_src
leg vectors
#+begin_src matlab
legs = stewart.pos_top - stewart.pos_base;
leg_length = zeros(6, 1);
leg_vectors = zeros(6, 3);
for i = 1:6
leg_length(i) = norm(legs(i,:));
leg_vectors(i,:) = legs(i,:) / leg_length(i);
end
stewart.Leg.lenght = 1000*leg_length(1)/1.5;
stewart.Leg.shape.bot = [0 0; ...
stewart.Leg.rad.bottom 0; ...
stewart.Leg.rad.bottom stewart.Leg.lenght; ...
stewart.Leg.rad.top stewart.Leg.lenght; ...
stewart.Leg.rad.top 0.2*stewart.Leg.lenght; ...
0 0.2*stewart.Leg.lenght];
#+end_src
Calculate revolute and cylindrical axes
#+begin_src matlab
rev1 = zeros(6, 3);
rev2 = zeros(6, 3);
cyl1 = zeros(6, 3);
for i = 1:6
rev1(i,:) = cross(leg_vectors(i,:), [0 0 1]);
rev1(i,:) = rev1(i,:) / norm(rev1(i,:));
rev2(i,:) = - cross(rev1(i,:), leg_vectors(i,:));
rev2(i,:) = rev2(i,:) / norm(rev2(i,:));
cyl1(i,:) = leg_vectors(i,:);
end
#+end_src
Coordinate systems
#+begin_src matlab
stewart.lower_leg = struct('rotation', eye(3));
stewart.upper_leg = struct('rotation', eye(3));
for i = 1:6
stewart.lower_leg(i).rotation = [rev1(i,:)', rev2(i,:)', cyl1(i,:)'];
stewart.upper_leg(i).rotation = [rev1(i,:)', rev2(i,:)', cyl1(i,:)'];
end
#+end_src
Position Matrix
#+begin_src matlab
stewart.M_pos_base = stewart.pos_base + (height+(stewart.TP.h+stewart.Leg.sphere.top+stewart.SP.h.top+stewart.jacobian)*1e-3)*[zeros(6, 2),ones(6, 1)];
#+end_src
Compute Jacobian Matrix
#+begin_src matlab
% aa = stewart.pos_top_tranform + (stewart.jacobian - stewart.TP.h - stewart.SP.height.top)*1e-3*[zeros(6, 2),ones(6, 1)];
bb = stewart.pos_top_tranform - (stewart.TP.h + stewart.SP.height.top)*1e-3*[zeros(6, 2),ones(6, 1)];
bb = bb - stewart.jacobian*1e-3*[zeros(6, 2),ones(6, 1)];
stewart.J = getJacobianMatrix(leg_vectors', bb');
stewart.K = stewart.Leg.k.ax*stewart.J'*stewart.J;
end
#+end_src
*** initializeParameters Function - BIS
#+begin_src matlab
function [stewart] = initializeParameters(stewart)
#+end_src
We first compute $[a_1, a_2, a_3, a_4, a_5, a_6]^T$ and $[b_1, b_2, b_3, b_4, b_5, b_6]^T$.
#+begin_src matlab
stewart.Aa = zeros(6, 3); % [mm]
stewart.Ab = zeros(6, 3); % [mm]
#+end_src
#+begin_src matlab
for i = 1:3
stewart.Aa(2*i-1,:) = [stewart.BP.Rleg*cos( pi/180*(120*(i-1) - stewart.BP.alpha) ), ...
stewart.BP.Rleg*sin( pi/180*(120*(i-1) - stewart.BP.alpha) ), ...
stewart.BP.H+stewart.SP.H];
stewart.Aa(2*i,:) = [stewart.BP.Rleg*cos( pi/180*(120*(i-1) + stewart.BP.alpha) ), ...
stewart.BP.Rleg*sin( pi/180*(120*(i-1) + stewart.BP.alpha) ), ...
stewart.BP.H+stewart.SP.H];
stewart.Ab(2*i-1,:) = [stewart.TP.Rleg*cos( pi/180*(120*(i-1) + stewart.TP.dalpha - stewart.TP.alpha) ), ...
stewart.TP.Rleg*sin( pi/180*(120*(i-1) + stewart.TP.dalpha - stewart.TP.alpha) ), ...
stewart.H - stewart.TP.H - stewart.SP.H];
stewart.Ab(2*i,:) = [stewart.TP.Rleg*cos( pi/180*(120*(i-1) + stewart.TP.dalpha + stewart.TP.alpha) ), ...
stewart.TP.Rleg*sin( pi/180*(120*(i-1) + stewart.TP.dalpha + stewart.TP.alpha) ), ...
stewart.H - stewart.TP.H - stewart.SP.H];
end
#+end_src
Now, we compute the leg vectors $\hat{s}_i$ and leg position $l_i$:
\[ b_i - a_i = l_i \hat{s}_i \]
We initialize $l_i$ and $\hat{s}_i$
#+begin_src matlab
leg_length = zeros(6, 1); % [mm]
leg_vectors = zeros(6, 3);
#+end_src
We compute $b_i - a_i$, and then:
\begin{align*}
l_i &= \left|b_i - a_i\right| \\
\hat{s}_i &= \frac{b_i - a_i}{l_i}
\end{align*}
#+begin_src matlab
legs = stewart.Ab - stewart.Aa;
for i = 1:6
leg_length(i) = norm(legs(i,:));
leg_vectors(i,:) = legs(i,:) / leg_length(i);
end
#+end_src
Then the shape of the bottom leg is estimated
#+begin_src matlab
stewart.Leg.lenght = leg_length(1)/1.5;
stewart.Leg.shape.bot = ...
[0 0; ...
stewart.Leg.Rbot 0; ...
stewart.Leg.Rbot stewart.Leg.lenght; ...
stewart.Leg.Rtop stewart.Leg.lenght; ...
stewart.Leg.Rtop 0.2*stewart.Leg.lenght; ...
0 0.2*stewart.Leg.lenght];
#+end_src
We compute rotation matrices to have the orientation of the legs.
The rotation matrix transforms the $z$ axis to the axis of the leg. The other axis are not important here.
#+begin_src matlab
stewart.Rm = struct('R', eye(3));
for i = 1:6
sx = cross(leg_vectors(i,:), [1 0 0]);
sx = sx/norm(sx);
sy = -cross(sx, leg_vectors(i,:));
sy = sy/norm(sy);
sz = leg_vectors(i,:);
sz = sz/norm(sz);
stewart.Rm(i).R = [sx', sy', sz'];
end
#+end_src
Compute Jacobian Matrix
#+begin_src matlab
J = zeros(6);
for i = 1:6
J(i, 1:3) = leg_vectors(i, :);
J(i, 4:6) = cross(0.001*(stewart.Ab - stewart.H*[0,0,1]), leg_vectors(i, :));
end
stewart.J = J;
#+end_src
#+begin_src matlab
stewart.K = stewart.Leg.k_ax*stewart.J'*stewart.J;
#+end_src
#+begin_src matlab
end
end
#+end_src
** initializeSample
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/initializeSample.m
:END:
#+begin_src matlab
function [] = initializeSample(opts_param)
%% Default values for opts
sample = struct( ...
'radius', 100, ... % radius of the cylinder [mm]
'height', 300, ... % height of the cylinder [mm]
'mass', 50, ... % mass of the cylinder [kg]
'measheight', 150, ... % measurement point z-offset [mm]
'offset', [0, 0, 0], ... % offset position of the sample [mm]
'color', [0.9 0.1 0.1] ...
);
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
sample.(opt{1}) = opts_param.(opt{1});
end
end
%% Save
save('./mat/sample.mat', 'sample');
end
#+end_src
* Simscape Model
- [[file:simscape-model.org][Model of the Stewart Platform]]
- [[file:identification.org][Identification]]
* Architecture Study
- [[file:kinematic-study.org][Kinematic Study]]
- [[file:stiffness-study.org][Stiffness Matrix Study]]
- Jacobian Study
* Motion Control
- Active Damping
- Inertial Control
- Decentralized Control

7
js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

4
js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
js/jquery.stickytableheaders.min.js vendored Normal file
View File

@ -0,0 +1 @@
!function(a,b){"use strict";function c(c,g){var h=this;h.$el=a(c),h.el=c,h.id=e++,h.$window=a(b),h.$document=a(document),h.$el.bind("destroyed",a.proxy(h.teardown,h)),h.$clonedHeader=null,h.$originalHeader=null,h.isSticky=!1,h.hasBeenSticky=!1,h.leftOffset=null,h.topOffset=null,h.init=function(){h.$el.each(function(){var b=a(this);b.css("padding",0),h.$originalHeader=a("thead:first",this),h.$clonedHeader=h.$originalHeader.clone(),b.trigger("clonedHeader."+d,[h.$clonedHeader]),h.$clonedHeader.addClass("tableFloatingHeader"),h.$clonedHeader.css("display","none"),h.$originalHeader.addClass("tableFloatingHeaderOriginal"),h.$originalHeader.after(h.$clonedHeader),h.$printStyle=a('<style type="text/css" media="print">.tableFloatingHeader{display:none !important;}.tableFloatingHeaderOriginal{position:static !important;}</style>'),a("head").append(h.$printStyle)}),h.setOptions(g),h.updateWidth(),h.toggleHeaders(),h.bind()},h.destroy=function(){h.$el.unbind("destroyed",h.teardown),h.teardown()},h.teardown=function(){h.isSticky&&h.$originalHeader.css("position","static"),a.removeData(h.el,"plugin_"+d),h.unbind(),h.$clonedHeader.remove(),h.$originalHeader.removeClass("tableFloatingHeaderOriginal"),h.$originalHeader.css("visibility","visible"),h.$printStyle.remove(),h.el=null,h.$el=null},h.bind=function(){h.$scrollableArea.on("scroll."+d,h.toggleHeaders),h.isWindowScrolling||(h.$window.on("scroll."+d+h.id,h.setPositionValues),h.$window.on("resize."+d+h.id,h.toggleHeaders)),h.$scrollableArea.on("resize."+d,h.toggleHeaders),h.$scrollableArea.on("resize."+d,h.updateWidth)},h.unbind=function(){h.$scrollableArea.off("."+d,h.toggleHeaders),h.isWindowScrolling||(h.$window.off("."+d+h.id,h.setPositionValues),h.$window.off("."+d+h.id,h.toggleHeaders)),h.$scrollableArea.off("."+d,h.updateWidth)},h.toggleHeaders=function(){h.$el&&h.$el.each(function(){var b,c=a(this),d=h.isWindowScrolling?isNaN(h.options.fixedOffset)?h.options.fixedOffset.outerHeight():h.options.fixedOffset:h.$scrollableArea.offset().top+(isNaN(h.options.fixedOffset)?0:h.options.fixedOffset),e=c.offset(),f=h.$scrollableArea.scrollTop()+d,g=h.$scrollableArea.scrollLeft(),i=h.isWindowScrolling?f>e.top:d>e.top,j=(h.isWindowScrolling?f:0)<e.top+c.height()-h.$clonedHeader.height()-(h.isWindowScrolling?0:d);i&&j?(b=e.left-g+h.options.leftOffset,h.$originalHeader.css({position:"fixed","margin-top":h.options.marginTop,left:b,"z-index":3}),h.leftOffset=b,h.topOffset=d,h.$clonedHeader.css("display",""),h.isSticky||(h.isSticky=!0,h.updateWidth()),h.setPositionValues()):h.isSticky&&(h.$originalHeader.css("position","static"),h.$clonedHeader.css("display","none"),h.isSticky=!1,h.resetWidth(a("td,th",h.$clonedHeader),a("td,th",h.$originalHeader)))})},h.setPositionValues=function(){var a=h.$window.scrollTop(),b=h.$window.scrollLeft();!h.isSticky||0>a||a+h.$window.height()>h.$document.height()||0>b||b+h.$window.width()>h.$document.width()||h.$originalHeader.css({top:h.topOffset-(h.isWindowScrolling?0:a),left:h.leftOffset-(h.isWindowScrolling?0:b)})},h.updateWidth=function(){if(h.isSticky){h.$originalHeaderCells||(h.$originalHeaderCells=a("th,td",h.$originalHeader)),h.$clonedHeaderCells||(h.$clonedHeaderCells=a("th,td",h.$clonedHeader));var b=h.getWidth(h.$clonedHeaderCells);h.setWidth(b,h.$clonedHeaderCells,h.$originalHeaderCells),h.$originalHeader.css("width",h.$clonedHeader.width())}},h.getWidth=function(c){var d=[];return c.each(function(c){var e,f=a(this);if("border-box"===f.css("box-sizing"))e=f[0].getBoundingClientRect().width;else{var g=a("th",h.$originalHeader);if("collapse"===g.css("border-collapse"))if(b.getComputedStyle)e=parseFloat(b.getComputedStyle(this,null).width);else{var i=parseFloat(f.css("padding-left")),j=parseFloat(f.css("padding-right")),k=parseFloat(f.css("border-width"));e=f.outerWidth()-i-j-k}else e=f.width()}d[c]=e}),d},h.setWidth=function(a,b,c){b.each(function(b){var d=a[b];c.eq(b).css({"min-width":d,"max-width":d})})},h.resetWidth=function(b,c){b.each(function(b){var d=a(this);c.eq(b).css({"min-width":d.css("min-width"),"max-width":d.css("max-width")})})},h.setOptions=function(c){h.options=a.extend({},f,c),h.$scrollableArea=a(h.options.scrollableArea),h.isWindowScrolling=h.$scrollableArea[0]===b},h.updateOptions=function(a){h.setOptions(a),h.unbind(),h.bind(),h.updateWidth(),h.toggleHeaders()},h.init()}var d="stickyTableHeaders",e=0,f={fixedOffset:0,leftOffset:0,marginTop:0,scrollableArea:b};a.fn[d]=function(b){return this.each(function(){var e=a.data(this,"plugin_"+d);e?"string"==typeof b?e[b].apply(e):e.updateOptions(b):"destroy"!==b&&a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window);

85
js/readtheorg.js Normal file
View File

@ -0,0 +1,85 @@
$(function() {
$('.note').before("<p class='admonition-title note'>Note</p>");
$('.seealso').before("<p class='admonition-title seealso'>See also</p>");
$('.warning').before("<p class='admonition-title warning'>Warning</p>");
$('.caution').before("<p class='admonition-title caution'>Caution</p>");
$('.attention').before("<p class='admonition-title attention'>Attention</p>");
$('.tip').before("<p class='admonition-title tip'>Tip</p>");
$('.important').before("<p class='admonition-title important'>Important</p>");
$('.hint').before("<p class='admonition-title hint'>Hint</p>");
$('.error').before("<p class='admonition-title error'>Error</p>");
$('.danger').before("<p class='admonition-title danger'>Danger</p>");
});
$( document ).ready(function() {
// Shift nav in mobile when clicking the menu.
$(document).on('click', "[data-toggle='wy-nav-top']", function() {
$("[data-toggle='wy-nav-shift']").toggleClass("shift");
$("[data-toggle='rst-versions']").toggleClass("shift");
});
// Close menu when you click a link.
$(document).on('click', ".wy-menu-vertical .current ul li a", function() {
$("[data-toggle='wy-nav-shift']").removeClass("shift");
$("[data-toggle='rst-versions']").toggleClass("shift");
});
$(document).on('click', "[data-toggle='rst-current-version']", function() {
$("[data-toggle='rst-versions']").toggleClass("shift-up");
});
// Make tables responsive
$("table.docutils:not(.field-list)").wrap("<div class='wy-table-responsive'></div>");
});
$( document ).ready(function() {
$('#text-table-of-contents ul').first().addClass('nav');
// ScrollSpy also requires that we use
// a Bootstrap nav component.
$('body').scrollspy({target: '#text-table-of-contents'});
// add sticky table headers
$('table').stickyTableHeaders();
// set the height of tableOfContents
var $postamble = $('#postamble');
var $tableOfContents = $('#table-of-contents');
$tableOfContents.css({paddingBottom: $postamble.outerHeight()});
// add TOC button
var toggleSidebar = $('<div id="toggle-sidebar"><a href="#table-of-contents"><h2>Table of Contents</h2></a></div>');
$('#content').prepend(toggleSidebar);
// add close button when sidebar showed in mobile screen
var closeBtn = $('<a class="close-sidebar" href="#">Close</a>');
var tocTitle = $('#table-of-contents').find('h2');
tocTitle.append(closeBtn);
});
window.SphinxRtdTheme = (function (jquery) {
var stickyNav = (function () {
var navBar,
win,
stickyNavCssClass = 'stickynav',
applyStickNav = function () {
if (navBar.height() <= win.height()) {
navBar.addClass(stickyNavCssClass);
} else {
navBar.removeClass(stickyNavCssClass);
}
},
enable = function () {
applyStickNav();
win.on('resize', applyStickNav);
},
init = function () {
navBar = jquery('nav.wy-nav-side:first');
win = jquery(window);
};
jquery(init);
return {
enable : enable
};
}());
return {
StickyNav : stickyNav
};
}($));

2
js/siunitx.js Normal file

File diff suppressed because one or more lines are too long

316
kinematic-study.html Normal file
View File

@ -0,0 +1,316 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2019-03-22 ven. 12:03 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Kinematic Study of the Stewart Platform</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Thomas Dehaeze" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="content">
<h1 class="title">Kinematic Study of the Stewart Platform</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgc1c40d5">1. Functions</a>
<ul>
<li><a href="#org3d6cf9e">1.1. getMaxPositions</a></li>
<li><a href="#orge3ee3ac">1.2. getMaxPureDisplacement</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-orgc1c40d5" class="outline-2">
<h2 id="orgc1c40d5"><span class="section-number-2">1</span> Functions</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org3d6cf9e" class="outline-3">
<h3 id="org3d6cf9e"><span class="section-number-3">1.1</span> getMaxPositions</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">function</span> <span style="color: #DCDCCC;">[</span><span style="color: #DFAF8F;">X, Y, Z</span><span style="color: #DCDCCC;">]</span> = <span style="color: #93E0E3;">getMaxPositions</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">stewart</span><span style="color: #DCDCCC;">)</span>
Leg = stewart.Leg;
J = stewart.J;
theta = linspace<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">0</span>, <span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">pi</span>, <span style="color: #BFEBBF;">100</span><span style="color: #DCDCCC;">)</span>;
phi = linspace<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">2</span> , <span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">2</span>, <span style="color: #BFEBBF;">100</span><span style="color: #DCDCCC;">)</span>;
dmax = zeros<span style="color: #DCDCCC;">(</span>length<span style="color: #BFEBBF;">(</span>theta<span style="color: #BFEBBF;">)</span>, length<span style="color: #BFEBBF;">(</span>phi<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">for</span> <span style="color: #DFAF8F;">i</span> = <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">:length</span><span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">theta</span><span style="color: #DCDCCC;">)</span>
<span style="color: #F0DFAF; font-weight: bold;">for</span> <span style="color: #DFAF8F;">j</span> = <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">:length</span><span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">phi</span><span style="color: #DCDCCC;">)</span>
L = J<span style="color: #7CB8BB;">*</span><span style="color: #DCDCCC;">[</span>cos<span style="color: #BFEBBF;">(</span>phi<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">j</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">*</span>cos<span style="color: #BFEBBF;">(</span>theta<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span> cos<span style="color: #BFEBBF;">(</span>phi<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">j</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">*</span>sin<span style="color: #BFEBBF;">(</span>theta<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span> sin<span style="color: #BFEBBF;">(</span>phi<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">j</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span><span style="color: #DCDCCC;">]</span>';
dmax<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">i</span>, <span style="color: #BFEBBF;">j</span><span style="color: #DCDCCC;">)</span> = Leg.stroke<span style="color: #7CB8BB;">/</span>max<span style="color: #DCDCCC;">(</span>abs<span style="color: #BFEBBF;">(</span>L<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
<span style="color: #F0DFAF; font-weight: bold;">end</span>
X = dmax<span style="color: #7CB8BB;">.*</span>cos<span style="color: #DCDCCC;">(</span>repmat<span style="color: #BFEBBF;">(</span>phi,length<span style="color: #D0BF8F;">(</span>theta<span style="color: #D0BF8F;">)</span>,<span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">.*</span>cos<span style="color: #DCDCCC;">(</span>repmat<span style="color: #BFEBBF;">(</span>theta,length<span style="color: #D0BF8F;">(</span>phi<span style="color: #D0BF8F;">)</span>,<span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>';
Y = dmax<span style="color: #7CB8BB;">.*</span>cos<span style="color: #DCDCCC;">(</span>repmat<span style="color: #BFEBBF;">(</span>phi,length<span style="color: #D0BF8F;">(</span>theta<span style="color: #D0BF8F;">)</span>,<span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">.*</span>sin<span style="color: #DCDCCC;">(</span>repmat<span style="color: #BFEBBF;">(</span>theta,length<span style="color: #D0BF8F;">(</span>phi<span style="color: #D0BF8F;">)</span>,<span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>';
Z = dmax<span style="color: #7CB8BB;">.*</span>sin<span style="color: #DCDCCC;">(</span>repmat<span style="color: #BFEBBF;">(</span>phi,length<span style="color: #D0BF8F;">(</span>theta<span style="color: #D0BF8F;">)</span>,<span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orge3ee3ac" class="outline-3">
<h3 id="orge3ee3ac"><span class="section-number-3">1.2</span> getMaxPureDisplacement</h3>
<div class="outline-text-3" id="text-1-2">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">function</span> <span style="color: #DCDCCC;">[</span><span style="color: #DFAF8F;">max_disp</span><span style="color: #DCDCCC;">]</span> = <span style="color: #93E0E3;">getMaxPureDisplacement</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">Leg</span>, <span style="color: #DFAF8F;">J</span><span style="color: #DCDCCC;">)</span>
max_disp = zeros<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">6</span>, <span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span>;
max_disp<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span> = Leg.stroke<span style="color: #7CB8BB;">/</span>max<span style="color: #DCDCCC;">(</span>abs<span style="color: #BFEBBF;">(</span>J<span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">[</span><span style="color: #BFEBBF;">1</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span><span style="color: #D0BF8F;">]</span>'<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
max_disp<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span> = Leg.stroke<span style="color: #7CB8BB;">/</span>max<span style="color: #DCDCCC;">(</span>abs<span style="color: #BFEBBF;">(</span>J<span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">[</span><span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">1</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span><span style="color: #D0BF8F;">]</span>'<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
max_disp<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">3</span><span style="color: #DCDCCC;">)</span> = Leg.stroke<span style="color: #7CB8BB;">/</span>max<span style="color: #DCDCCC;">(</span>abs<span style="color: #BFEBBF;">(</span>J<span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">[</span><span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">1</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span><span style="color: #D0BF8F;">]</span>'<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
max_disp<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">4</span><span style="color: #DCDCCC;">)</span> = Leg.stroke<span style="color: #7CB8BB;">/</span>max<span style="color: #DCDCCC;">(</span>abs<span style="color: #BFEBBF;">(</span>J<span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">[</span><span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">1</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span><span style="color: #D0BF8F;">]</span>'<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
max_disp<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">5</span><span style="color: #DCDCCC;">)</span> = Leg.stroke<span style="color: #7CB8BB;">/</span>max<span style="color: #DCDCCC;">(</span>abs<span style="color: #BFEBBF;">(</span>J<span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">[</span><span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">1</span> <span style="color: #BFEBBF;">0</span><span style="color: #D0BF8F;">]</span>'<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
max_disp<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">6</span><span style="color: #DCDCCC;">)</span> = Leg.stroke<span style="color: #7CB8BB;">/</span>max<span style="color: #DCDCCC;">(</span>abs<span style="color: #BFEBBF;">(</span>J<span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">[</span><span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">1</span><span style="color: #D0BF8F;">]</span>'<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Thomas Dehaeze</p>
<p class="date">Created: 2019-03-22 ven. 12:03</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>

49
kinematic-study.org Normal file
View File

@ -0,0 +1,49 @@
#+TITLE: Kinematic Study of the Stewart Platform
* Functions
:PROPERTIES:
:HEADER-ARGS:matlab+: :exports code
:HEADER-ARGS:matlab+: :comments no
:HEADER-ARGS:matlab+: :mkdir yes
:HEADER-ARGS:matlab+: :eval no
:END:
** getMaxPositions
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/getMaxPositions.m
:END:
#+begin_src matlab
function [X, Y, Z] = getMaxPositions(stewart)
Leg = stewart.Leg;
J = stewart.J;
theta = linspace(0, 2*pi, 100);
phi = linspace(-pi/2 , pi/2, 100);
dmax = zeros(length(theta), length(phi));
for i = 1:length(theta)
for j = 1:length(phi)
L = J*[cos(phi(j))*cos(theta(i)) cos(phi(j))*sin(theta(i)) sin(phi(j)) 0 0 0]';
dmax(i, j) = Leg.stroke/max(abs(L));
end
end
X = dmax.*cos(repmat(phi,length(theta),1)).*cos(repmat(theta,length(phi),1))';
Y = dmax.*cos(repmat(phi,length(theta),1)).*sin(repmat(theta,length(phi),1))';
Z = dmax.*sin(repmat(phi,length(theta),1));
end
#+end_src
** getMaxPureDisplacement
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/getMaxPureDisplacement.m
:END:
#+begin_src matlab
function [max_disp] = getMaxPureDisplacement(Leg, J)
max_disp = zeros(6, 1);
max_disp(1) = Leg.stroke/max(abs(J*[1 0 0 0 0 0]'));
max_disp(2) = Leg.stroke/max(abs(J*[0 1 0 0 0 0]'));
max_disp(3) = Leg.stroke/max(abs(J*[0 0 1 0 0 0]'));
max_disp(4) = Leg.stroke/max(abs(J*[0 0 0 1 0 0]'));
max_disp(5) = Leg.stroke/max(abs(J*[0 0 0 0 1 0]'));
max_disp(6) = Leg.stroke/max(abs(J*[0 0 0 0 0 1]'));
end
#+end_src

BIN
mat/G.mat

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

855
simscape-model.html Normal file
View File

@ -0,0 +1,855 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2019-03-22 ven. 12:03 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Stewart Platform - Simscape Model</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Thomas Dehaeze" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link rel="stylesheet" type="text/css" href="css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="css/readtheorg.css"/>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="js/readtheorg.js"></script>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "center",
displayIndent: "0em",
"HTML-CSS": { scale: 100,
linebreaks: { automatic: "false" },
webFont: "TeX"
},
SVG: {scale: 100,
linebreaks: { automatic: "false" },
font: "TeX"},
NativeMML: {scale: 100},
TeX: { equationNumbers: {autoNumber: "AMS"},
MultLineWidth: "85%",
TagSide: "right",
TagIndent: ".8em"
}
});
</script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
<div id="content">
<h1 class="title">Stewart Platform - Simscape Model</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org9a10766">1. Function description and arguments</a></li>
<li><a href="#orgb6911a1">2. Initialization of the stewart structure</a></li>
<li><a href="#org030aed6">3. Bottom Plate</a></li>
<li><a href="#orged8012a">4. Top Plate</a></li>
<li><a href="#orgc74617a">5. Legs</a></li>
<li><a href="#org7cd2aa5">6. Ball Joints</a></li>
<li><a href="#org1d76ed9">7. More parameters are initialized</a></li>
<li><a href="#orge9faa26">8. Save the Stewart Structure</a></li>
<li><a href="#orga207d03">9. initializeParameters Function</a></li>
<li><a href="#org724c1a1">10. initializeSample</a></li>
</ul>
</div>
</div>
<div id="outline-container-org9a10766" class="outline-2">
<h2 id="org9a10766"><span class="section-number-2">1</span> Function description and arguments</h2>
<div class="outline-text-2" id="text-1">
<p>
The <code>initializeHexapod</code> function takes one structure that contains configurations for the hexapod and returns one structure representing the hexapod.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">function</span> <span style="color: #DCDCCC;">[</span><span style="color: #DFAF8F;">stewart</span><span style="color: #DCDCCC;">]</span> = <span style="color: #93E0E3;">initializeHexapod</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">opts_param</span><span style="color: #DCDCCC;">)</span>
</pre>
</div>
<p>
Default values for opts.
</p>
<div class="org-src-container">
<pre class="src src-matlab">opts = struct<span style="color: #DCDCCC;">(</span><span style="text-decoration: underline;">...</span>
<span style="color: #CC9393;">'height'</span>, <span style="color: #BFEBBF;">90</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Height of the platform [mm]</span>
<span style="color: #CC9393;">'density'</span>, <span style="color: #BFEBBF;">8000</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Density of the material used for the hexapod [kg/m3]</span>
<span style="color: #CC9393;">'k_ax'</span>, <span style="color: #BFEBBF;">1e8</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Stiffness of each actuator [N/m]</span>
<span style="color: #CC9393;">'c_ax'</span>, <span style="color: #BFEBBF;">1000</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Damping of each actuator [N/(m/s)]</span>
<span style="color: #CC9393;">'stroke'</span>, <span style="color: #BFEBBF;">50e</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">6</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Maximum stroke of each actuator [m]</span>
<span style="color: #CC9393;">'name', 'stewart'</span> <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Name of the file</span>
<span style="color: #DCDCCC;">)</span>;
</pre>
</div>
<p>
Populate opts with input parameters
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">if</span> exist<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'opts_param','var'</span><span style="color: #DCDCCC;">)</span>
<span style="color: #F0DFAF; font-weight: bold;">for</span> <span style="color: #DFAF8F;">opt</span> = <span style="color: #BFEBBF;">fieldnames</span><span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">opts_param</span><span style="color: #DCDCCC;">)</span><span style="color: #BFEBBF;">'</span>
opts.<span style="color: #DCDCCC;">(</span>opt<span style="color: #BFEBBF;">{</span><span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span> = opts_param.<span style="color: #DCDCCC;">(</span>opt<span style="color: #BFEBBF;">{</span><span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb6911a1" class="outline-2">
<h2 id="orgb6911a1"><span class="section-number-2">2</span> Initialization of the stewart structure</h2>
<div class="outline-text-2" id="text-2">
<p>
We initialize the Stewart structure
</p>
<div class="org-src-container">
<pre class="src src-matlab">stewart = struct<span style="color: #DCDCCC;">()</span>;
</pre>
</div>
<p>
And we defined its total height.
</p>
<div class="org-src-container">
<pre class="src src-matlab">stewart.H = opts.height; <span style="color: #7F9F7F;">% [mm]</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org030aed6" class="outline-2">
<h2 id="org030aed6"><span class="section-number-2">3</span> Bottom Plate</h2>
<div class="outline-text-2" id="text-3">
<div id="org3d7fe71" class="figure">
<p><img src="./figs/stewart_bottom_plate.png" alt="stewart_bottom_plate.png" />
</p>
<p><span class="figure-number">Figure 1: </span>Schematic of the bottom plates with all the parameters</p>
</div>
<p>
The bottom plate structure is initialized.
</p>
<div class="org-src-container">
<pre class="src src-matlab">BP = struct<span style="color: #DCDCCC;">()</span>;
</pre>
</div>
<p>
We defined its internal radius (if there is a hole in the bottom plate) and its outer radius.
</p>
<div class="org-src-container">
<pre class="src src-matlab">BP.Rint = <span style="color: #BFEBBF;">0</span>; <span style="color: #7F9F7F;">% Internal Radius [mm]</span>
BP.Rext = <span style="color: #BFEBBF;">150</span>; <span style="color: #7F9F7F;">% External Radius [mm]</span>
</pre>
</div>
<p>
We define its thickness.
</p>
<div class="org-src-container">
<pre class="src src-matlab">BP.H = <span style="color: #BFEBBF;">10</span>; <span style="color: #7F9F7F;">% Thickness of the Bottom Plate [mm]</span>
</pre>
</div>
<p>
At which radius legs will be fixed and with that angle offset.
</p>
<div class="org-src-container">
<pre class="src src-matlab">BP.Rleg = <span style="color: #BFEBBF;">100</span>; <span style="color: #7F9F7F;">% Radius where the legs articulations are positionned [mm]</span>
BP.alpha = <span style="color: #BFEBBF;">10</span>; <span style="color: #7F9F7F;">% Angle Offset [deg]</span>
</pre>
</div>
<p>
We defined the density of the material of the bottom plate.
</p>
<div class="org-src-container">
<pre class="src src-matlab">BP.density = opts.density; <span style="color: #7F9F7F;">% Density of the material [kg/m3]</span>
</pre>
</div>
<p>
And its color.
</p>
<div class="org-src-container">
<pre class="src src-matlab">BP.color = <span style="color: #DCDCCC;">[</span><span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">7</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">7</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">7</span><span style="color: #DCDCCC;">]</span>; <span style="color: #7F9F7F;">% Color [RGB]</span>
</pre>
</div>
<p>
Then the profile of the bottom plate is computed and will be used by Simscape
</p>
<div class="org-src-container">
<pre class="src src-matlab">BP.shape = <span style="color: #DCDCCC;">[</span>BP.Rint BP.H; BP.Rint <span style="color: #BFEBBF;">0</span>; BP.Rext <span style="color: #BFEBBF;">0</span>; BP.Rext BP.H<span style="color: #DCDCCC;">]</span>; <span style="color: #7F9F7F;">% [mm]</span>
</pre>
</div>
<p>
The structure is added to the stewart structure
</p>
<div class="org-src-container">
<pre class="src src-matlab">stewart.BP = BP;
</pre>
</div>
</div>
</div>
<div id="outline-container-orged8012a" class="outline-2">
<h2 id="orged8012a"><span class="section-number-2">4</span> Top Plate</h2>
<div class="outline-text-2" id="text-4">
<p>
The top plate structure is initialized.
</p>
<div class="org-src-container">
<pre class="src src-matlab">TP = struct<span style="color: #DCDCCC;">()</span>;
</pre>
</div>
<p>
We defined the internal and external radius of the top plate.
</p>
<div class="org-src-container">
<pre class="src src-matlab">TP.Rint = <span style="color: #BFEBBF;">0</span>; <span style="color: #7F9F7F;">% [mm]</span>
TP.Rext = <span style="color: #BFEBBF;">100</span>; <span style="color: #7F9F7F;">% [mm]</span>
</pre>
</div>
<p>
The thickness of the top plate.
</p>
<div class="org-src-container">
<pre class="src src-matlab">TP.H = <span style="color: #BFEBBF;">10</span>; <span style="color: #7F9F7F;">% [mm]</span>
</pre>
</div>
<p>
At which radius and angle are fixed the legs.
</p>
<div class="org-src-container">
<pre class="src src-matlab">TP.Rleg = <span style="color: #BFEBBF;">100</span>; <span style="color: #7F9F7F;">% Radius where the legs articulations are positionned [mm]</span>
TP.alpha = <span style="color: #BFEBBF;">20</span>; <span style="color: #7F9F7F;">% Angle [deg]</span>
TP.dalpha = <span style="color: #BFEBBF;">0</span>; % Angle Offset from <span style="color: #BFEBBF;">0</span> position [deg]
</pre>
</div>
<p>
The density of its material.
</p>
<div class="org-src-container">
<pre class="src src-matlab">TP.density = opts.density; <span style="color: #7F9F7F;">% Density of the material [kg/m3]</span>
</pre>
</div>
<p>
Its color.
</p>
<div class="org-src-container">
<pre class="src src-matlab">TP.color = <span style="color: #DCDCCC;">[</span><span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">7</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">7</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">7</span><span style="color: #DCDCCC;">]</span>; <span style="color: #7F9F7F;">% Color [RGB]</span>
</pre>
</div>
<p>
Then the shape of the top plate is computed
</p>
<div class="org-src-container">
<pre class="src src-matlab">TP.shape = <span style="color: #DCDCCC;">[</span>TP.Rint TP.H; TP.Rint <span style="color: #BFEBBF;">0</span>; TP.Rext <span style="color: #BFEBBF;">0</span>; TP.Rext TP.H<span style="color: #DCDCCC;">]</span>;
</pre>
</div>
<p>
The structure is added to the stewart structure
</p>
<div class="org-src-container">
<pre class="src src-matlab">stewart.TP = TP;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc74617a" class="outline-2">
<h2 id="orgc74617a"><span class="section-number-2">5</span> Legs</h2>
<div class="outline-text-2" id="text-5">
<div id="orgc225133" class="figure">
<p><img src="./figs/stewart_legs.png" alt="stewart_legs.png" />
</p>
<p><span class="figure-number">Figure 2: </span>Schematic for the legs of the Stewart platform</p>
</div>
<p>
The leg structure is initialized.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Leg = struct<span style="color: #DCDCCC;">()</span>;
</pre>
</div>
<p>
The maximum Stroke of each leg is defined.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Leg.stroke = opts.stroke; <span style="color: #7F9F7F;">% [m]</span>
</pre>
</div>
<p>
The stiffness and damping of each leg are defined
</p>
<div class="org-src-container">
<pre class="src src-matlab">Leg.k_ax = opts.k_ax; <span style="color: #7F9F7F;">% Stiffness of each leg [N/m]</span>
Leg.c_ax = opts.c_ax; <span style="color: #7F9F7F;">% Damping of each leg [N/(m/s)]</span>
</pre>
</div>
<p>
The radius of the legs are defined
</p>
<div class="org-src-container">
<pre class="src src-matlab">Leg.Rtop = <span style="color: #BFEBBF;">10</span>; <span style="color: #7F9F7F;">% Radius of the cylinder of the top part of the leg[mm]</span>
Leg.Rbot = <span style="color: #BFEBBF;">12</span>; <span style="color: #7F9F7F;">% Radius of the cylinder of the bottom part of the leg [mm]</span>
</pre>
</div>
<p>
The density of its material.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Leg.density = opts.density; <span style="color: #7F9F7F;">% Density of the material used for the legs [kg/m3]</span>
</pre>
</div>
<p>
Its color.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Leg.color = <span style="color: #DCDCCC;">[</span><span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">5</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">5</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">5</span><span style="color: #DCDCCC;">]</span>; <span style="color: #7F9F7F;">% Color of the top part of the leg [RGB]</span>
</pre>
</div>
<p>
The radius of spheres representing the ball joints are defined.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Leg.R = <span style="color: #BFEBBF;">1</span>.<span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">*</span>Leg.Rbot; <span style="color: #7F9F7F;">% Size of the sphere at the extremity of the leg [mm]</span>
</pre>
</div>
<p>
The structure is added to the stewart structure
</p>
<div class="org-src-container">
<pre class="src src-matlab">stewart.Leg = Leg;
</pre>
</div>
</div>
</div>
<div id="outline-container-org7cd2aa5" class="outline-2">
<h2 id="org7cd2aa5"><span class="section-number-2">6</span> Ball Joints</h2>
<div class="outline-text-2" id="text-6">
<div id="org7b92b11" class="figure">
<p><img src="./figs/stewart_ball_joints.png" alt="stewart_ball_joints.png" />
</p>
<p><span class="figure-number">Figure 3: </span>Schematic of the support for the ball joints</p>
</div>
<p>
<code>SP</code> is the structure representing the support for the ball joints at the extremity of each leg.
</p>
<p>
The <code>SP</code> structure is initialized.
</p>
<div class="org-src-container">
<pre class="src src-matlab">SP = struct<span style="color: #DCDCCC;">()</span>;
</pre>
</div>
<p>
We can define its rotational stiffness and damping. For now, we use perfect joints.
</p>
<div class="org-src-container">
<pre class="src src-matlab">SP.k = <span style="color: #BFEBBF;">0</span>; <span style="color: #7F9F7F;">% [N*m/deg]</span>
SP.c = <span style="color: #BFEBBF;">0</span>; <span style="color: #7F9F7F;">% [N*m/deg]</span>
</pre>
</div>
<p>
Its height is defined
</p>
<div class="org-src-container">
<pre class="src src-matlab">SP.H = <span style="color: #BFEBBF;">15</span>; <span style="color: #7F9F7F;">% [mm]</span>
</pre>
</div>
<p>
Its radius is based on the radius on the sphere at the end of the legs.
</p>
<div class="org-src-container">
<pre class="src src-matlab">SP.R = Leg.R; <span style="color: #7F9F7F;">% [mm]</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">SP.section = <span style="color: #DCDCCC;">[</span><span style="color: #BFEBBF;">0</span> SP.H<span style="color: #7CB8BB;">-</span>SP.R;
<span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span>;
SP.R <span style="color: #BFEBBF;">0</span>;
SP.R SP.H<span style="color: #DCDCCC;">]</span>;
</pre>
</div>
<p>
The density of its material is defined.
</p>
<div class="org-src-container">
<pre class="src src-matlab">SP.density = opts.density; % [kg<span style="color: #7CB8BB;">/</span>m<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">3</span>]
</pre>
</div>
<p>
Its color is defined.
</p>
<div class="org-src-container">
<pre class="src src-matlab">SP.color = <span style="color: #DCDCCC;">[</span><span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">7</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">7</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">7</span><span style="color: #DCDCCC;">]</span>; <span style="color: #7F9F7F;">% [RGB]</span>
</pre>
</div>
<p>
The structure is added to the Hexapod structure
</p>
<div class="org-src-container">
<pre class="src src-matlab">stewart.SP = SP;
</pre>
</div>
</div>
</div>
<div id="outline-container-org1d76ed9" class="outline-2">
<h2 id="org1d76ed9"><span class="section-number-2">7</span> More parameters are initialized</h2>
<div class="outline-text-2" id="text-7">
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeParameters<span style="color: #DCDCCC;">(</span>stewart<span style="color: #DCDCCC;">)</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-orge9faa26" class="outline-2">
<h2 id="orge9faa26"><span class="section-number-2">8</span> Save the Stewart Structure</h2>
<div class="outline-text-2" id="text-8">
<div class="org-src-container">
<pre class="src src-matlab">save<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'./mat/stewart.mat', 'stewart'</span><span style="color: #DCDCCC;">)</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orga207d03" class="outline-2">
<h2 id="orga207d03"><span class="section-number-2">9</span> initializeParameters Function</h2>
<div class="outline-text-2" id="text-9">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">function</span> <span style="color: #DCDCCC;">[</span><span style="color: #DFAF8F;">stewart</span><span style="color: #DCDCCC;">]</span> = <span style="color: #93E0E3;">initializeParameters</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">stewart</span><span style="color: #DCDCCC;">)</span>
</pre>
</div>
<p>
We first compute \([a_1, a_2, a_3, a_4, a_5, a_6]^T\) and \([b_1, b_2, b_3, b_4, b_5, b_6]^T\).
</p>
<div class="org-src-container">
<pre class="src src-matlab">stewart.Aa = zeros<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">6</span>, <span style="color: #BFEBBF;">3</span><span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% [mm]</span>
stewart.Ab = zeros<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">6</span>, <span style="color: #BFEBBF;">3</span><span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% [mm]</span>
stewart.Bb = zeros<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">6</span>, <span style="color: #BFEBBF;">3</span><span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% [mm]</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">for</span> <span style="color: #DFAF8F;">i</span> = <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">:</span><span style="color: #BFEBBF;">3</span>
stewart.Aa<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">i</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span>,<span style="color: #7CB8BB;">:</span><span style="color: #DCDCCC;">)</span> = <span style="color: #DCDCCC;">[</span>stewart.BP.Rleg<span style="color: #7CB8BB;">*</span>cos<span style="color: #BFEBBF;">(</span> <span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">180</span><span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">120</span><span style="color: #7CB8BB;">*</span><span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #93E0E3;">)</span> <span style="color: #7CB8BB;">-</span> stewart.BP.alpha<span style="color: #D0BF8F;">)</span> <span style="color: #BFEBBF;">)</span>, <span style="text-decoration: underline;">...</span>
stewart.BP.Rleg<span style="color: #7CB8BB;">*</span>sin<span style="color: #BFEBBF;">(</span> <span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">180</span><span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">120</span><span style="color: #7CB8BB;">*</span><span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #93E0E3;">)</span> <span style="color: #7CB8BB;">-</span> stewart.BP.alpha<span style="color: #D0BF8F;">)</span> <span style="color: #BFEBBF;">)</span>, <span style="text-decoration: underline;">...</span>
stewart.BP.H<span style="color: #7CB8BB;">+</span>stewart.SP.H<span style="color: #DCDCCC;">]</span>;
stewart.Aa<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">i</span>,<span style="color: #7CB8BB;">:</span><span style="color: #DCDCCC;">)</span> = <span style="color: #DCDCCC;">[</span>stewart.BP.Rleg<span style="color: #7CB8BB;">*</span>cos<span style="color: #BFEBBF;">(</span> <span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">180</span><span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">120</span><span style="color: #7CB8BB;">*</span><span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #93E0E3;">)</span> <span style="color: #7CB8BB;">+</span> stewart.BP.alpha<span style="color: #D0BF8F;">)</span> <span style="color: #BFEBBF;">)</span>, <span style="text-decoration: underline;">...</span>
stewart.BP.Rleg<span style="color: #7CB8BB;">*</span>sin<span style="color: #BFEBBF;">(</span> <span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">180</span><span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">120</span><span style="color: #7CB8BB;">*</span><span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #93E0E3;">)</span> <span style="color: #7CB8BB;">+</span> stewart.BP.alpha<span style="color: #D0BF8F;">)</span> <span style="color: #BFEBBF;">)</span>, <span style="text-decoration: underline;">...</span>
stewart.BP.H<span style="color: #7CB8BB;">+</span>stewart.SP.H<span style="color: #DCDCCC;">]</span>;
stewart.Ab<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">i</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span>,<span style="color: #7CB8BB;">:</span><span style="color: #DCDCCC;">)</span> = <span style="color: #DCDCCC;">[</span>stewart.TP.Rleg<span style="color: #7CB8BB;">*</span>cos<span style="color: #BFEBBF;">(</span> <span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">180</span><span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">120</span><span style="color: #7CB8BB;">*</span><span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #93E0E3;">)</span> <span style="color: #7CB8BB;">+</span> stewart.TP.dalpha <span style="color: #7CB8BB;">-</span> stewart.TP.alpha<span style="color: #D0BF8F;">)</span> <span style="color: #BFEBBF;">)</span>, <span style="text-decoration: underline;">...</span>
stewart.TP.Rleg<span style="color: #7CB8BB;">*</span>sin<span style="color: #BFEBBF;">(</span> <span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">180</span><span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">120</span><span style="color: #7CB8BB;">*</span><span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #93E0E3;">)</span> <span style="color: #7CB8BB;">+</span> stewart.TP.dalpha <span style="color: #7CB8BB;">-</span> stewart.TP.alpha<span style="color: #D0BF8F;">)</span> <span style="color: #BFEBBF;">)</span>, <span style="text-decoration: underline;">...</span>
stewart.H <span style="color: #7CB8BB;">-</span> stewart.TP.H <span style="color: #7CB8BB;">-</span> stewart.SP.H<span style="color: #DCDCCC;">]</span>;
stewart.Ab<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">i</span>,<span style="color: #7CB8BB;">:</span><span style="color: #DCDCCC;">)</span> = <span style="color: #DCDCCC;">[</span>stewart.TP.Rleg<span style="color: #7CB8BB;">*</span>cos<span style="color: #BFEBBF;">(</span> <span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">180</span><span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">120</span><span style="color: #7CB8BB;">*</span><span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #93E0E3;">)</span> <span style="color: #7CB8BB;">+</span> stewart.TP.dalpha <span style="color: #7CB8BB;">+</span> stewart.TP.alpha<span style="color: #D0BF8F;">)</span> <span style="color: #BFEBBF;">)</span>, <span style="text-decoration: underline;">...</span>
stewart.TP.Rleg<span style="color: #7CB8BB;">*</span>sin<span style="color: #BFEBBF;">(</span> <span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">180</span><span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">120</span><span style="color: #7CB8BB;">*</span><span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #93E0E3;">)</span> <span style="color: #7CB8BB;">+</span> stewart.TP.dalpha <span style="color: #7CB8BB;">+</span> stewart.TP.alpha<span style="color: #D0BF8F;">)</span> <span style="color: #BFEBBF;">)</span>, <span style="text-decoration: underline;">...</span>
stewart.H <span style="color: #7CB8BB;">-</span> stewart.TP.H <span style="color: #7CB8BB;">-</span> stewart.SP.H<span style="color: #DCDCCC;">]</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
stewart.Bb = stewart.Ab <span style="color: #7CB8BB;">-</span> stewart.H<span style="color: #7CB8BB;">*</span><span style="color: #DCDCCC;">[</span><span style="color: #BFEBBF;">0</span>,<span style="color: #BFEBBF;">0</span>,<span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">]</span>;
</pre>
</div>
<p>
Now, we compute the leg vectors \(\hat{s}_i\) and leg position \(l_i\):
\[ b_i - a_i = l_i \hat{s}_i \]
</p>
<p>
We initialize \(l_i\) and \(\hat{s}_i\)
</p>
<div class="org-src-container">
<pre class="src src-matlab">leg_length = zeros<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">6</span>, <span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% [mm]</span>
leg_vectors = zeros<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">6</span>, <span style="color: #BFEBBF;">3</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>
<p>
We compute \(b_i - a_i\), and then:
</p>
\begin{align*}
l_i &= \left|b_i - a_i\right| \\
\hat{s}_i &= \frac{b_i - a_i}{l_i}
\end{align*}
<div class="org-src-container">
<pre class="src src-matlab">legs = stewart.Ab <span style="color: #7CB8BB;">-</span> stewart.Aa;
<span style="color: #F0DFAF; font-weight: bold;">for</span> <span style="color: #DFAF8F;">i</span> = <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">:</span><span style="color: #BFEBBF;">6</span>
leg_length<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #DCDCCC;">)</span> = norm<span style="color: #DCDCCC;">(</span>legs<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">i</span>,<span style="color: #7CB8BB;">:</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
leg_vectors<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">i</span>,<span style="color: #7CB8BB;">:</span><span style="color: #DCDCCC;">)</span> = legs<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">i</span>,<span style="color: #7CB8BB;">:</span><span style="color: #DCDCCC;">)</span> <span style="color: #7CB8BB;">/</span> leg_length<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
<p>
Then the shape of the bottom leg is estimated
</p>
<div class="org-src-container">
<pre class="src src-matlab">stewart.Leg.lenght = leg_length<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">1</span>.<span style="color: #BFEBBF;">5</span>;
stewart.Leg.shape.bot = <span style="text-decoration: underline;">...</span>
<span style="color: #DCDCCC;">[</span><span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span>; <span style="text-decoration: underline;">...</span>
stewart.Leg.Rbot <span style="color: #BFEBBF;">0</span>; <span style="text-decoration: underline;">...</span>
stewart.Leg.Rbot stewart.Leg.lenght; <span style="text-decoration: underline;">...</span>
stewart.Leg.Rtop stewart.Leg.lenght; <span style="text-decoration: underline;">...</span>
stewart.Leg.Rtop <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">*</span>stewart.Leg.lenght; <span style="text-decoration: underline;">...</span>
<span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">*</span>stewart.Leg.lenght<span style="color: #DCDCCC;">]</span>;
</pre>
</div>
<p>
We compute rotation matrices to have the orientation of the legs.
The rotation matrix transforms the \(z\) axis to the axis of the leg. The other axis are not important here.
</p>
<div class="org-src-container">
<pre class="src src-matlab">stewart.Rm = struct<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'R'</span>, eye<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">3</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">for</span> <span style="color: #DFAF8F;">i</span> = <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">:</span><span style="color: #BFEBBF;">6</span>
sx = cross<span style="color: #DCDCCC;">(</span>leg_vectors<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">i</span>,<span style="color: #7CB8BB;">:</span><span style="color: #BFEBBF;">)</span>, <span style="color: #BFEBBF;">[</span><span style="color: #BFEBBF;">1</span> <span style="color: #BFEBBF;">0</span> <span style="color: #BFEBBF;">0</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span>;
sx = sx<span style="color: #7CB8BB;">/</span>norm<span style="color: #DCDCCC;">(</span>sx<span style="color: #DCDCCC;">)</span>;
sy = <span style="color: #7CB8BB;">-</span>cross<span style="color: #DCDCCC;">(</span>sx, leg_vectors<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">i</span>,<span style="color: #7CB8BB;">:</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
sy = sy<span style="color: #7CB8BB;">/</span>norm<span style="color: #DCDCCC;">(</span>sy<span style="color: #DCDCCC;">)</span>;
sz = leg_vectors<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">i</span>,<span style="color: #7CB8BB;">:</span><span style="color: #DCDCCC;">)</span>;
sz = sz<span style="color: #7CB8BB;">/</span>norm<span style="color: #DCDCCC;">(</span>sz<span style="color: #DCDCCC;">)</span>;
stewart.Rm<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">i</span><span style="color: #DCDCCC;">)</span>.R = <span style="color: #DCDCCC;">[</span>sx', sy', sz'<span style="color: #DCDCCC;">]</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
<p>
Compute Jacobian Matrix
</p>
<div class="org-src-container">
<pre class="src src-matlab">J = zeros<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">6</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">for</span> <span style="color: #DFAF8F;">i</span> = <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">:</span><span style="color: #BFEBBF;">6</span>
J<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">i</span>, <span style="color: #BFEBBF;">1</span><span style="color: #7CB8BB;">:</span><span style="color: #BFEBBF;">3</span><span style="color: #DCDCCC;">)</span> = leg_vectors<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">i</span>, <span style="color: #7CB8BB;">:</span><span style="color: #DCDCCC;">)</span>;
J<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">i</span>, <span style="color: #BFEBBF;">4</span><span style="color: #7CB8BB;">:</span><span style="color: #BFEBBF;">6</span><span style="color: #DCDCCC;">)</span> = cross<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">001</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">(</span>stewart.Ab<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">i</span>, <span style="color: #7CB8BB;">:</span><span style="color: #D0BF8F;">)</span><span style="color: #7CB8BB;">-</span> stewart.H<span style="color: #7CB8BB;">*</span><span style="color: #D0BF8F;">[</span><span style="color: #BFEBBF;">0</span>,<span style="color: #BFEBBF;">0</span>,<span style="color: #BFEBBF;">1</span><span style="color: #D0BF8F;">]</span><span style="color: #BFEBBF;">)</span>, leg_vectors<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">i</span>, <span style="color: #7CB8BB;">:</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
stewart.J = J;
stewart.Jinv = inv<span style="color: #DCDCCC;">(</span>J<span style="color: #DCDCCC;">)</span>;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">stewart.K = stewart.Leg.k_ax<span style="color: #7CB8BB;">*</span>stewart.J'<span style="color: #7CB8BB;">*</span>stewart.J;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"> <span style="color: #F0DFAF; font-weight: bold;">end</span>
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org724c1a1" class="outline-2">
<h2 id="org724c1a1"><span class="section-number-2">10</span> initializeSample</h2>
<div class="outline-text-2" id="text-10">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">function</span> <span style="color: #DCDCCC;">[]</span> = <span style="color: #93E0E3;">initializeSample</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">opts_param</span><span style="color: #DCDCCC;">)</span>
<span style="color: #7F9F7F; font-weight: bold; text-decoration: overline;">%% Default values for opts</span>
sample = struct<span style="color: #DCDCCC;">(</span> <span style="text-decoration: underline;">...</span>
<span style="color: #CC9393;">'radius'</span>, <span style="color: #BFEBBF;">100</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% radius of the cylinder [mm]</span>
<span style="color: #CC9393;">'height'</span>, <span style="color: #BFEBBF;">100</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% height of the cylinder [mm]</span>
<span style="color: #CC9393;">'mass'</span>, <span style="color: #BFEBBF;">10</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% mass of the cylinder [kg]</span>
<span style="color: #CC9393;">'measheight'</span>, <span style="color: #BFEBBF;">50</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% measurement point z-offset [mm]</span>
<span style="color: #CC9393;">'offset'</span>, <span style="color: #BFEBBF;">[</span><span style="color: #BFEBBF;">0</span>, <span style="color: #BFEBBF;">0</span>, <span style="color: #BFEBBF;">0</span><span style="color: #BFEBBF;">]</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% offset position of the sample [mm]</span>
<span style="color: #CC9393;">'color'</span>, <span style="color: #BFEBBF;">[</span><span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">9</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">1</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">]</span> <span style="text-decoration: underline;">...</span>
<span style="color: #DCDCCC;">)</span>;
<span style="color: #7F9F7F; font-weight: bold; text-decoration: overline;">%% Populate opts with input parameters</span>
<span style="color: #F0DFAF; font-weight: bold;">if</span> exist<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'opts_param','var'</span><span style="color: #DCDCCC;">)</span>
<span style="color: #F0DFAF; font-weight: bold;">for</span> <span style="color: #DFAF8F;">opt</span> = <span style="color: #BFEBBF;">fieldnames</span><span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">opts_param</span><span style="color: #DCDCCC;">)</span><span style="color: #BFEBBF;">'</span>
sample.<span style="color: #DCDCCC;">(</span>opt<span style="color: #BFEBBF;">{</span><span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span> = opts_param.<span style="color: #DCDCCC;">(</span>opt<span style="color: #BFEBBF;">{</span><span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
<span style="color: #F0DFAF; font-weight: bold;">end</span>
<span style="color: #7F9F7F; font-weight: bold; text-decoration: overline;">%% Save</span>
save<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'./mat/sample.mat', 'sample'</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Thomas Dehaeze</p>
<p class="date">Created: 2019-03-22 ven. 12:03</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>

503
simscape-model.org Normal file
View File

@ -0,0 +1,503 @@
#+TITLE: Stewart Platform - Simscape Model
:DRAWER:
#+STARTUP: overview
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/readtheorg.css"/>
#+HTML_HEAD: <script src="js/jquery.min.js"></script>
#+HTML_HEAD: <script src="js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="js/readtheorg.js"></script>
#+LATEX_CLASS: cleanreport
#+LaTeX_CLASS_OPTIONS: [tocnp, secbreak, minted]
#+LaTeX_HEADER: \usepackage{svg}
#+LaTeX_HEADER: \newcommand{\authorFirstName}{Thomas}
#+LaTeX_HEADER: \newcommand{\authorLastName}{Dehaeze}
#+LaTeX_HEADER: \newcommand{\authorEmail}{dehaeze.thomas@gmail.com}
#+PROPERTY: header-args:matlab :session *MATLAB*
#+PROPERTY: header-args:matlab+ :comments no
#+PROPERTY: header-args:matlab+ :exports bode
#+PROPERTY: header-args:matlab+ :eval no
#+PROPERTY: header-args:matlab+ :output-dir figs
#+PROPERTY: header-args:matlab+ :mkdirp yes
#+PROPERTY: header-args:matlab+ :tangle src/initializeHexapod.m
:END:
* Function description and arguments
The =initializeHexapod= function takes one structure that contains configurations for the hexapod and returns one structure representing the hexapod.
#+begin_src matlab
function [stewart] = initializeHexapod(opts_param)
#+end_src
Default values for opts.
#+begin_src matlab
opts = struct(...
'height', 90, ... % Height of the platform [mm]
'density', 8000, ... % Density of the material used for the hexapod [kg/m3]
'k_ax', 1e8, ... % Stiffness of each actuator [N/m]
'c_ax', 1000, ... % Damping of each actuator [N/(m/s)]
'stroke', 50e-6, ... % Maximum stroke of each actuator [m]
'name', 'stewart' ... % Name of the file
);
#+end_src
Populate opts with input parameters
#+begin_src matlab
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
end
#+end_src
* Initialization of the stewart structure
We initialize the Stewart structure
#+begin_src matlab
stewart = struct();
#+end_src
And we defined its total height.
#+begin_src matlab
stewart.H = opts.height; % [mm]
#+end_src
* Bottom Plate
#+name: fig:stewart_bottom_plate
#+caption: Schematic of the bottom plates with all the parameters
[[file:./figs/stewart_bottom_plate.png]]
The bottom plate structure is initialized.
#+begin_src matlab
BP = struct();
#+end_src
We defined its internal radius (if there is a hole in the bottom plate) and its outer radius.
#+begin_src matlab
BP.Rint = 0; % Internal Radius [mm]
BP.Rext = 150; % External Radius [mm]
#+end_src
We define its thickness.
#+begin_src matlab
BP.H = 10; % Thickness of the Bottom Plate [mm]
#+end_src
At which radius legs will be fixed and with that angle offset.
#+begin_src matlab
BP.Rleg = 100; % Radius where the legs articulations are positionned [mm]
BP.alpha = 10; % Angle Offset [deg]
#+end_src
We defined the density of the material of the bottom plate.
#+begin_src matlab
BP.density = opts.density; % Density of the material [kg/m3]
#+end_src
And its color.
#+begin_src matlab
BP.color = [0.7 0.7 0.7]; % Color [RGB]
#+end_src
Then the profile of the bottom plate is computed and will be used by Simscape
#+begin_src matlab
BP.shape = [BP.Rint BP.H; BP.Rint 0; BP.Rext 0; BP.Rext BP.H]; % [mm]
#+end_src
The structure is added to the stewart structure
#+begin_src matlab
stewart.BP = BP;
#+end_src
* Top Plate
The top plate structure is initialized.
#+begin_src matlab
TP = struct();
#+end_src
We defined the internal and external radius of the top plate.
#+begin_src matlab
TP.Rint = 0; % [mm]
TP.Rext = 100; % [mm]
#+end_src
The thickness of the top plate.
#+begin_src matlab
TP.H = 10; % [mm]
#+end_src
At which radius and angle are fixed the legs.
#+begin_src matlab
TP.Rleg = 100; % Radius where the legs articulations are positionned [mm]
TP.alpha = 20; % Angle [deg]
TP.dalpha = 0; % Angle Offset from 0 position [deg]
#+end_src
The density of its material.
#+begin_src matlab
TP.density = opts.density; % Density of the material [kg/m3]
#+end_src
Its color.
#+begin_src matlab
TP.color = [0.7 0.7 0.7]; % Color [RGB]
#+end_src
Then the shape of the top plate is computed
#+begin_src matlab
TP.shape = [TP.Rint TP.H; TP.Rint 0; TP.Rext 0; TP.Rext TP.H];
#+end_src
The structure is added to the stewart structure
#+begin_src matlab
stewart.TP = TP;
#+end_src
* Legs
#+name: fig:stewart_legs
#+caption: Schematic for the legs of the Stewart platform
[[file:./figs/stewart_legs.png]]
The leg structure is initialized.
#+begin_src matlab
Leg = struct();
#+end_src
The maximum Stroke of each leg is defined.
#+begin_src matlab
Leg.stroke = opts.stroke; % [m]
#+end_src
The stiffness and damping of each leg are defined
#+begin_src matlab
Leg.k_ax = opts.k_ax; % Stiffness of each leg [N/m]
Leg.c_ax = opts.c_ax; % Damping of each leg [N/(m/s)]
#+end_src
The radius of the legs are defined
#+begin_src matlab
Leg.Rtop = 10; % Radius of the cylinder of the top part of the leg[mm]
Leg.Rbot = 12; % Radius of the cylinder of the bottom part of the leg [mm]
#+end_src
The density of its material.
#+begin_src matlab
Leg.density = opts.density; % Density of the material used for the legs [kg/m3]
#+end_src
Its color.
#+begin_src matlab
Leg.color = [0.5 0.5 0.5]; % Color of the top part of the leg [RGB]
#+end_src
The radius of spheres representing the ball joints are defined.
#+begin_src matlab
Leg.R = 1.3*Leg.Rbot; % Size of the sphere at the extremity of the leg [mm]
#+end_src
The structure is added to the stewart structure
#+begin_src matlab
stewart.Leg = Leg;
#+end_src
* Ball Joints
#+name: fig:stewart_ball_joints
#+caption: Schematic of the support for the ball joints
[[file:./figs/stewart_ball_joints.png]]
=SP= is the structure representing the support for the ball joints at the extremity of each leg.
The =SP= structure is initialized.
#+begin_src matlab
SP = struct();
#+end_src
We can define its rotational stiffness and damping. For now, we use perfect joints.
#+begin_src matlab
SP.k = 0; % [N*m/deg]
SP.c = 0; % [N*m/deg]
#+end_src
Its height is defined
#+begin_src matlab
SP.H = 15; % [mm]
#+end_src
Its radius is based on the radius on the sphere at the end of the legs.
#+begin_src matlab
SP.R = Leg.R; % [mm]
#+end_src
#+begin_src matlab
SP.section = [0 SP.H-SP.R;
0 0;
SP.R 0;
SP.R SP.H];
#+end_src
The density of its material is defined.
#+begin_src matlab
SP.density = opts.density; % [kg/m^3]
#+end_src
Its color is defined.
#+begin_src matlab
SP.color = [0.7 0.7 0.7]; % [RGB]
#+end_src
The structure is added to the Hexapod structure
#+begin_src matlab
stewart.SP = SP;
#+end_src
* More parameters are initialized
#+begin_src matlab
stewart = initializeParameters(stewart);
#+end_src
* Save the Stewart Structure
#+begin_src matlab
save('./mat/stewart.mat', 'stewart')
#+end_src
* initializeParameters Function :noexport:
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle no
:END:
#+begin_src matlab
function [stewart] = initializeParameters(stewart)
#+end_src
Computation of the position of the connection points on the base and moving platform
We first initialize =pos_base= corresponding to $[a_1, a_2, a_3, a_4, a_5, a_6]^T$ and =pos_top= corresponding to $[b_1, b_2, b_3, b_4, b_5, b_6]^T$.
#+begin_src matlab
stewart.pos_base = zeros(6, 3);
stewart.pos_top = zeros(6, 3);
#+end_src
We estimate the height between the ball joints of the bottom platform and of the top platform.
#+begin_src matlab
height = stewart.H - stewart.BP.H - stewart.TP.H - 2*stewart.SP.H; % [mm]
#+end_src
#+begin_src matlab
for i = 1:3
% base points
angle_m_b = 120*(i-1) - stewart.BP.alpha;
angle_p_b = 120*(i-1) + stewart.BP.alpha;
stewart.pos_base(2*i-1,:) = [stewart.BP.Rleg*cos(angle_m_b), stewart.BP.Rleg*sin(angle_m_b), 0.0];
stewart.pos_base(2*i,:) = [stewart.BP.Rleg*cos(angle_p_b), stewart.BP.Rleg*sin(angle_p_b), 0.0];
% top points
angle_m_t = 120*(i-1) - stewart.TP.alpha + stewart.TP.dalpha;
angle_p_t = 120*(i-1) + stewart.TP.alpha + stewart.TP.dalpha;
stewart.pos_top(2*i-1,:) = [stewart.TP.Rleg*cos(angle_m_t), stewart.TP.Rleg*sin(angle_m_t), height];
stewart.pos_top(2*i,:) = [stewart.TP.Rleg*cos(angle_p_t), stewart.TP.Rleg*sin(angle_p_t), height];
end
% permute pos_top points so that legs are end points of base and top points
stewart.pos_top = [stewart.pos_top(6,:); stewart.pos_top(1:5,:)]; %6th point on top connects to 1st on bottom
stewart.pos_top_tranform = stewart.pos_top - height*[zeros(6, 2),ones(6, 1)];
#+end_src
leg vectors
#+begin_src matlab
legs = stewart.pos_top - stewart.pos_base;
leg_length = zeros(6, 1);
leg_vectors = zeros(6, 3);
for i = 1:6
leg_length(i) = norm(legs(i,:));
leg_vectors(i,:) = legs(i,:) / leg_length(i);
end
stewart.Leg.lenght = 1000*leg_length(1)/1.5;
stewart.Leg.shape.bot = [0 0; ...
stewart.Leg.rad.bottom 0; ...
stewart.Leg.rad.bottom stewart.Leg.lenght; ...
stewart.Leg.rad.top stewart.Leg.lenght; ...
stewart.Leg.rad.top 0.2*stewart.Leg.lenght; ...
0 0.2*stewart.Leg.lenght];
#+end_src
Calculate revolute and cylindrical axes
#+begin_src matlab
rev1 = zeros(6, 3);
rev2 = zeros(6, 3);
cyl1 = zeros(6, 3);
for i = 1:6
rev1(i,:) = cross(leg_vectors(i,:), [0 0 1]);
rev1(i,:) = rev1(i,:) / norm(rev1(i,:));
rev2(i,:) = - cross(rev1(i,:), leg_vectors(i,:));
rev2(i,:) = rev2(i,:) / norm(rev2(i,:));
cyl1(i,:) = leg_vectors(i,:);
end
#+end_src
Coordinate systems
#+begin_src matlab
stewart.lower_leg = struct('rotation', eye(3));
stewart.upper_leg = struct('rotation', eye(3));
for i = 1:6
stewart.lower_leg(i).rotation = [rev1(i,:)', rev2(i,:)', cyl1(i,:)'];
stewart.upper_leg(i).rotation = [rev1(i,:)', rev2(i,:)', cyl1(i,:)'];
end
#+end_src
Position Matrix
#+begin_src matlab
stewart.M_pos_base = stewart.pos_base + (height+(stewart.TP.h+stewart.Leg.sphere.top+stewart.SP.h.top+stewart.jacobian)*1e-3)*[zeros(6, 2),ones(6, 1)];
#+end_src
Compute Jacobian Matrix
#+begin_src matlab
% aa = stewart.pos_top_tranform + (stewart.jacobian - stewart.TP.h - stewart.SP.height.top)*1e-3*[zeros(6, 2),ones(6, 1)];
bb = stewart.pos_top_tranform - (stewart.TP.h + stewart.SP.height.top)*1e-3*[zeros(6, 2),ones(6, 1)];
bb = bb - stewart.jacobian*1e-3*[zeros(6, 2),ones(6, 1)];
stewart.J = getJacobianMatrix(leg_vectors', bb');
stewart.K = stewart.Leg.k.ax*stewart.J'*stewart.J;
end
#+end_src
* initializeParameters Function
#+begin_src matlab
function [stewart] = initializeParameters(stewart)
#+end_src
We first compute $[a_1, a_2, a_3, a_4, a_5, a_6]^T$ and $[b_1, b_2, b_3, b_4, b_5, b_6]^T$.
#+begin_src matlab
stewart.Aa = zeros(6, 3); % [mm]
stewart.Ab = zeros(6, 3); % [mm]
stewart.Bb = zeros(6, 3); % [mm]
#+end_src
#+begin_src matlab
for i = 1:3
stewart.Aa(2*i-1,:) = [stewart.BP.Rleg*cos( pi/180*(120*(i-1) - stewart.BP.alpha) ), ...
stewart.BP.Rleg*sin( pi/180*(120*(i-1) - stewart.BP.alpha) ), ...
stewart.BP.H+stewart.SP.H];
stewart.Aa(2*i,:) = [stewart.BP.Rleg*cos( pi/180*(120*(i-1) + stewart.BP.alpha) ), ...
stewart.BP.Rleg*sin( pi/180*(120*(i-1) + stewart.BP.alpha) ), ...
stewart.BP.H+stewart.SP.H];
stewart.Ab(2*i-1,:) = [stewart.TP.Rleg*cos( pi/180*(120*(i-1) + stewart.TP.dalpha - stewart.TP.alpha) ), ...
stewart.TP.Rleg*sin( pi/180*(120*(i-1) + stewart.TP.dalpha - stewart.TP.alpha) ), ...
stewart.H - stewart.TP.H - stewart.SP.H];
stewart.Ab(2*i,:) = [stewart.TP.Rleg*cos( pi/180*(120*(i-1) + stewart.TP.dalpha + stewart.TP.alpha) ), ...
stewart.TP.Rleg*sin( pi/180*(120*(i-1) + stewart.TP.dalpha + stewart.TP.alpha) ), ...
stewart.H - stewart.TP.H - stewart.SP.H];
end
stewart.Bb = stewart.Ab - stewart.H*[0,0,1];
#+end_src
Now, we compute the leg vectors $\hat{s}_i$ and leg position $l_i$:
\[ b_i - a_i = l_i \hat{s}_i \]
We initialize $l_i$ and $\hat{s}_i$
#+begin_src matlab
leg_length = zeros(6, 1); % [mm]
leg_vectors = zeros(6, 3);
#+end_src
We compute $b_i - a_i$, and then:
\begin{align*}
l_i &= \left|b_i - a_i\right| \\
\hat{s}_i &= \frac{b_i - a_i}{l_i}
\end{align*}
#+begin_src matlab
legs = stewart.Ab - stewart.Aa;
for i = 1:6
leg_length(i) = norm(legs(i,:));
leg_vectors(i,:) = legs(i,:) / leg_length(i);
end
#+end_src
Then the shape of the bottom leg is estimated
#+begin_src matlab
stewart.Leg.lenght = leg_length(1)/1.5;
stewart.Leg.shape.bot = ...
[0 0; ...
stewart.Leg.Rbot 0; ...
stewart.Leg.Rbot stewart.Leg.lenght; ...
stewart.Leg.Rtop stewart.Leg.lenght; ...
stewart.Leg.Rtop 0.2*stewart.Leg.lenght; ...
0 0.2*stewart.Leg.lenght];
#+end_src
We compute rotation matrices to have the orientation of the legs.
The rotation matrix transforms the $z$ axis to the axis of the leg. The other axis are not important here.
#+begin_src matlab
stewart.Rm = struct('R', eye(3));
for i = 1:6
sx = cross(leg_vectors(i,:), [1 0 0]);
sx = sx/norm(sx);
sy = -cross(sx, leg_vectors(i,:));
sy = sy/norm(sy);
sz = leg_vectors(i,:);
sz = sz/norm(sz);
stewart.Rm(i).R = [sx', sy', sz'];
end
#+end_src
Compute Jacobian Matrix
#+begin_src matlab
J = zeros(6);
for i = 1:6
J(i, 1:3) = leg_vectors(i, :);
J(i, 4:6) = cross(0.001*(stewart.Ab(i, :)- stewart.H*[0,0,1]), leg_vectors(i, :));
end
stewart.J = J;
stewart.Jinv = inv(J);
#+end_src
#+begin_src matlab
stewart.K = stewart.Leg.k_ax*stewart.J'*stewart.J;
#+end_src
#+begin_src matlab
end
end
#+end_src
* initializeSample
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/initializeSample.m
:END:
#+begin_src matlab
function [] = initializeSample(opts_param)
%% Default values for opts
sample = struct( ...
'radius', 100, ... % radius of the cylinder [mm]
'height', 100, ... % height of the cylinder [mm]
'mass', 10, ... % mass of the cylinder [kg]
'measheight', 50, ... % measurement point z-offset [mm]
'offset', [0, 0, 0], ... % offset position of the sample [mm]
'color', [0.9 0.1 0.1] ...
);
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
sample.(opt{1}) = opts_param.(opt{1});
end
end
%% Save
save('./mat/sample.mat', 'sample');
end
#+end_src

View File

@ -1,51 +1,67 @@
% [[file:~/MEGA/These/Matlab/Simscape/stewart-simscape/identification.org::*identifyPlant][identifyPlant:1]]
function [sys] = identifyPlant(opts_param)
% identifyPlant:1 ends here
% [[file:~/MEGA/These/Matlab/Simscape/stewart-simscape/identification.org::*identifyPlant][identifyPlant:2]]
%% Default values for opts
opts = struct();
opts = struct();
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'stewart_identification';
%% Input/Output definition
io(1) = linio([mdl, '/F'], 1, 'input'); % Cartesian forces
io(2) = linio([mdl, '/Fl'], 1, 'input'); % Leg forces
io(3) = linio([mdl, '/Fd'], 1, 'input'); % Direct forces
io(4) = linio([mdl, '/Dw'], 1, 'input'); % Base motion
io(5) = linio([mdl, '/Dm'], 1, 'output'); % Relative Motion
io(6) = linio([mdl, '/Dlm'], 1, 'output'); % Displacement of each leg
io(7) = linio([mdl, '/Flm'], 1, 'output'); % Force sensor in each leg
io(8) = linio([mdl, '/Xm'], 1, 'output'); % Absolute motion of platform
%% Run the linearization
G = linearize(mdl, io, 0);
%% Input/Output names
G.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz', ...
'F1', 'F2', 'F3', 'F4', 'F5', 'F6', ...
'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz', ...
'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'};
G.OutputName = {'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm', ...
'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m', ...
'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m', ...
'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'};
%% Cut into sub transfer functions
sys.G_cart = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'}));
sys.G_forc = minreal(G({'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m'}, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'}));
sys.G_legs = G({'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m'}, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'});
sys.G_tran = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'}));
sys.G_comp = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'}));
sys.G_iner = minreal(G({'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'}, {'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'}));
sys.G_all = minreal(G);
end
% identifyPlant:2 ends here
% [[file:~/MEGA/These/Matlab/Simscape/stewart-simscape/identification.org::*identifyPlant][identifyPlant:3]]
options = linearizeOptions;
options.SampleTime = 0;
% identifyPlant:3 ends here
% [[file:~/MEGA/These/Matlab/Simscape/stewart-simscape/identification.org::*identifyPlant][identifyPlant:4]]
mdl = 'stewart';
% identifyPlant:4 ends here
% [[file:~/MEGA/These/Matlab/Simscape/stewart-simscape/identification.org::*identifyPlant][identifyPlant:5]]
%% Inputs
io(1) = linio([mdl, '/F'], 1, 'input'); % Cartesian forces
io(2) = linio([mdl, '/Fl'], 1, 'input'); % Leg forces
io(3) = linio([mdl, '/Fd'], 1, 'input'); % Direct forces
io(4) = linio([mdl, '/Dw'], 1, 'input'); % Base motion
%% Outputs
io(5) = linio([mdl, '/Dm'], 1, 'output'); % Relative Motion
io(6) = linio([mdl, '/Dlm'], 1, 'output'); % Displacement of each leg
io(7) = linio([mdl, '/Flm'], 1, 'output'); % Force sensor in each leg
io(8) = linio([mdl, '/Xm'], 1, 'output'); % Absolute motion of platform
% identifyPlant:5 ends here
% [[file:~/MEGA/These/Matlab/Simscape/stewart-simscape/identification.org::*identifyPlant][identifyPlant:6]]
G = linearize(mdl, io, 0);
% identifyPlant:6 ends here
% [[file:~/MEGA/These/Matlab/Simscape/stewart-simscape/identification.org::*identifyPlant][identifyPlant:7]]
G.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz', ...
'F1', 'F2', 'F3', 'F4', 'F5', 'F6', ...
'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz', ...
'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'};
G.OutputName = {'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm', ...
'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m', ...
'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m', ...
'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'};
% identifyPlant:7 ends here
% [[file:~/MEGA/These/Matlab/Simscape/stewart-simscape/identification.org::*identifyPlant][identifyPlant:8]]
sys.G_cart = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'}));
sys.G_forc = minreal(G({'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m'}, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'}));
sys.G_legs = minreal(G({'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m'}, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'}));
sys.G_tran = minreal(G({'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'}, {'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'}));
sys.G_comp = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'}));
sys.G_iner = minreal(G({'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'}, {'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'}));
% sys.G_all = minreal(G);
% identifyPlant:8 ends here
% [[file:~/MEGA/These/Matlab/Simscape/stewart-simscape/identification.org::*identifyPlant][identifyPlant:9]]
end
% identifyPlant:9 ends here

View File

@ -1,86 +1,228 @@
% Function description and arguments
% The =initializeHexapod= function takes one structure that contains configurations for the hexapod and returns one structure representing the hexapod.
function [stewart] = initializeHexapod(opts_param)
% Default values for opts.
opts = struct(...
'height', 90, ... % Height of the platform [mm]
'density', 8000, ... % Density of the material used for the hexapod [kg/m3]
'k_ax', 1e8, ... % Stiffness of each actuator [N/m]
'c_ax', 100, ... % Damping of each actuator [N/(m/s)]
'c_ax', 1000, ... % Damping of each actuator [N/(m/s)]
'stroke', 50e-6, ... % Maximum stroke of each actuator [m]
'name', 'stewart' ... % Name of the file
);
% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
end
% Initialization of the stewart structure
% We initialize the Stewart structure
stewart = struct();
% And we defined its total height.
stewart.H = opts.height; % [mm]
% Bottom Plate
% #+name: fig:stewart_bottom_plate
% #+caption: Schematic of the bottom plates with all the parameters
% [[file:./figs/stewart_bottom_plate.png]]
% The bottom plate structure is initialized.
BP = struct();
% We defined its internal radius (if there is a hole in the bottom plate) and its outer radius.
BP.Rint = 0; % Internal Radius [mm]
BP.Rext = 150; % External Radius [mm]
% We define its thickness.
BP.H = 10; % Thickness of the Bottom Plate [mm]
% At which radius legs will be fixed and with that angle offset.
BP.Rleg = 100; % Radius where the legs articulations are positionned [mm]
BP.alpha = 10; % Angle Offset [deg]
% We defined the density of the material of the bottom plate.
BP.density = opts.density; % Density of the material [kg/m3]
% And its color.
BP.color = [0.7 0.7 0.7]; % Color [RGB]
% Then the profile of the bottom plate is computed and will be used by Simscape
BP.shape = [BP.Rint BP.H; BP.Rint 0; BP.Rext 0; BP.Rext BP.H]; % [mm]
% The structure is added to the stewart structure
stewart.BP = BP;
% Top Plate
% The top plate structure is initialized.
TP = struct();
% We defined the internal and external radius of the top plate.
TP.Rint = 0; % [mm]
TP.Rext = 100; % [mm]
% The thickness of the top plate.
TP.H = 10; % [mm]
% At which radius and angle are fixed the legs.
TP.Rleg = 100; % Radius where the legs articulations are positionned [mm]
TP.alpha = 20; % Angle [deg]
TP.dalpha = 0; % Angle Offset from 0 position [deg]
% The density of its material.
TP.density = opts.density; % Density of the material [kg/m3]
% Its color.
TP.color = [0.7 0.7 0.7]; % Color [RGB]
% Then the shape of the top plate is computed
TP.shape = [TP.Rint TP.H; TP.Rint 0; TP.Rext 0; TP.Rext TP.H];
% The structure is added to the stewart structure
stewart.TP = TP;
% Legs
% #+name: fig:stewart_legs
% #+caption: Schematic for the legs of the Stewart platform
% [[file:./figs/stewart_legs.png]]
% The leg structure is initialized.
Leg = struct();
% The maximum Stroke of each leg is defined.
Leg.stroke = opts.stroke; % [m]
% The stiffness and damping of each leg are defined
Leg.k_ax = opts.k_ax; % Stiffness of each leg [N/m]
Leg.c_ax = opts.c_ax; % Damping of each leg [N/(m/s)]
% The radius of the legs are defined
Leg.Rtop = 10; % Radius of the cylinder of the top part of the leg[mm]
Leg.Rbot = 12; % Radius of the cylinder of the bottom part of the leg [mm]
% The density of its material.
Leg.density = opts.density; % Density of the material used for the legs [kg/m3]
% Its color.
Leg.color = [0.5 0.5 0.5]; % Color of the top part of the leg [RGB]
% The radius of spheres representing the ball joints are defined.
Leg.R = 1.3*Leg.Rbot; % Size of the sphere at the extremity of the leg [mm]
% The structure is added to the stewart structure
stewart.Leg = Leg;
% Ball Joints
% #+name: fig:stewart_ball_joints
% #+caption: Schematic of the support for the ball joints
% [[file:./figs/stewart_ball_joints.png]]
% =SP= is the structure representing the support for the ball joints at the extremity of each leg.
% The =SP= structure is initialized.
SP = struct();
% We can define its rotational stiffness and damping. For now, we use perfect joints.
SP.k = 0; % [N*m/deg]
SP.c = 0; % [N*m/deg]
% Its height is defined
SP.H = 15; % [mm]
% Its radius is based on the radius on the sphere at the end of the legs.
SP.R = Leg.R; % [mm]
SP.section = [0 SP.H-SP.R;
@ -88,18 +230,40 @@ SP.section = [0 SP.H-SP.R;
SP.R 0;
SP.R SP.H];
% The density of its material is defined.
SP.density = opts.density; % [kg/m^3]
% Its color is defined.
SP.color = [0.7 0.7 0.7]; % [RGB]
% The structure is added to the Hexapod structure
stewart.SP = SP;
% More parameters are initialized
stewart = initializeParameters(stewart);
% Save the Stewart Structure
save('./mat/stewart.mat', 'stewart')
% initializeParameters Function
function [stewart] = initializeParameters(stewart)
% We first compute $[a_1, a_2, a_3, a_4, a_5, a_6]^T$ and $[b_1, b_2, b_3, b_4, b_5, b_6]^T$.
stewart.Aa = zeros(6, 3); % [mm]
stewart.Ab = zeros(6, 3); % [mm]
stewart.Bb = zeros(6, 3); % [mm]
@ -119,12 +283,27 @@ for i = 1:3
stewart.TP.Rleg*sin( pi/180*(120*(i-1) + stewart.TP.dalpha + stewart.TP.alpha) ), ...
stewart.H - stewart.TP.H - stewart.SP.H];
end
stewart.Bb = stewart.Ab - stewart.H*[0,0,1];
% Now, we compute the leg vectors $\hat{s}_i$ and leg position $l_i$:
% \[ b_i - a_i = l_i \hat{s}_i \]
% We initialize $l_i$ and $\hat{s}_i$
leg_length = zeros(6, 1); % [mm]
leg_vectors = zeros(6, 3);
% We compute $b_i - a_i$, and then:
% \begin{align*}
% l_i &= \left|b_i - a_i\right| \\
% \hat{s}_i &= \frac{b_i - a_i}{l_i}
% \end{align*}
legs = stewart.Ab - stewart.Aa;
for i = 1:6
@ -132,6 +311,10 @@ for i = 1:6
leg_vectors(i,:) = legs(i,:) / leg_length(i);
end
% Then the shape of the bottom leg is estimated
stewart.Leg.lenght = leg_length(1)/1.5;
stewart.Leg.shape.bot = ...
[0 0; ...
@ -141,6 +324,11 @@ stewart.Leg.shape.bot = ...
stewart.Leg.Rtop 0.2*stewart.Leg.lenght; ...
0 0.2*stewart.Leg.lenght];
% We compute rotation matrices to have the orientation of the legs.
% The rotation matrix transforms the $z$ axis to the axis of the leg. The other axis are not important here.
stewart.Rm = struct('R', eye(3));
for i = 1:6
@ -156,14 +344,19 @@ for i = 1:6
stewart.Rm(i).R = [sx', sy', sz'];
end
% Compute Jacobian Matrix
J = zeros(6);
for i = 1:6
J(i, 1:3) = leg_vectors(i, :);
J(i, 4:6) = cross(0.001*stewart.Bb(i, :), leg_vectors(i, :));
J(i, 4:6) = cross(0.001*(stewart.Ab(i, :)- stewart.H*[0,0,1]), leg_vectors(i, :));
end
stewart.J = J;
stewart.Jinv = inv(J);
stewart.K = stewart.Leg.k_ax*stewart.J'*stewart.J;

View File

@ -2,9 +2,9 @@ function [] = initializeSample(opts_param)
%% Default values for opts
sample = struct( ...
'radius', 100, ... % radius of the cylinder [mm]
'height', 300, ... % height of the cylinder [mm]
'mass', 50, ... % mass of the cylinder [kg]
'measheight', 150, ... % measurement point z-offset [mm]
'height', 100, ... % height of the cylinder [mm]
'mass', 10, ... % mass of the cylinder [kg]
'measheight', 50, ... % measurement point z-offset [mm]
'offset', [0, 0, 0], ... % offset position of the sample [mm]
'color', [0.9 0.1 0.1] ...
);

Binary file not shown.

284
stiffness-study.html Normal file
View File

@ -0,0 +1,284 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2019-03-22 ven. 12:03 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Stiffness of the Stewart Platform</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Thomas Dehaeze" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="content">
<h1 class="title">Stiffness of the Stewart Platform</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org178badc">1. Functions</a>
<ul>
<li><a href="#org31327cd">1.1. getStiffnessMatrix</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org178badc" class="outline-2">
<h2 id="org178badc"><span class="section-number-2">1</span> Functions</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org31327cd" class="outline-3">
<h3 id="org31327cd"><span class="section-number-3">1.1</span> getStiffnessMatrix</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">function</span> <span style="color: #DCDCCC;">[</span><span style="color: #DFAF8F;">K</span><span style="color: #DCDCCC;">]</span> = <span style="color: #93E0E3;">getStiffnessMatrix</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">k</span>, <span style="color: #DFAF8F;">J</span><span style="color: #DCDCCC;">)</span>
<span style="color: #7F9F7F;">% k - leg stiffness</span>
<span style="color: #7F9F7F;">% J - Jacobian matrix</span>
K = k<span style="color: #7CB8BB;">*</span><span style="color: #DCDCCC;">(</span>J'<span style="color: #7CB8BB;">*</span>J<span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Thomas Dehaeze</p>
<p class="date">Created: 2019-03-22 ven. 12:03</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>

20
stiffness-study.org Normal file
View File

@ -0,0 +1,20 @@
#+TITLE: Stiffness of the Stewart Platform
* Functions
:PROPERTIES:
:HEADER-ARGS:matlab+: :exports code
:HEADER-ARGS:matlab+: :comments no
:HEADER-ARGS:matlab+: :mkdir yes
:HEADER-ARGS:matlab+: :eval no
:END:
** getStiffnessMatrix
:PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/getStiffnessMatrix.m
:END:
#+begin_src matlab
function [K] = getStiffnessMatrix(k, J)
% k - leg stiffness
% J - Jacobian matrix
K = k*(J'*J);
end
#+end_src