stewart-simscape/docs/simscape-model.html

843 lines
34 KiB
HTML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<?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>
2020-03-11 19:00:22 +01:00
<!-- 2020-03-11 mer. 18:59 -->
<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="Dehaeze Thomas" />
<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 src="./js/jquery.stickytableheaders.min.js"></script>
<script src="./js/readtheorg.js"></script>
<script type="text/javascript">
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
<!--/*--><![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;
}
/*]]>*///-->
// @license-end
</script>
2020-02-11 15:27:39 +01:00
<script>
MathJax = {
tex: { macros: {
bm: ["\\boldsymbol{#1}",1],
}
}
};
</script>
<script type="text/javascript"
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Stewart Platform - Simscape Model</h1>
2020-01-28 17:37:55 +01:00
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
2020-02-11 15:50:52 +01:00
<li><a href="#orgc6e0b93">1. Parameters used for the Simscape Model</a></li>
<li><a href="#org66977e8">2. Simulation Configuration - Configuration reference</a></li>
<li><a href="#orgb2362eb">3. Subsystem Reference</a></li>
<li><a href="#orgdfad86d">4. Subsystem - Fixed base and Mobile Platform</a></li>
2020-03-11 19:00:22 +01:00
<li><a href="#org9d4af75">5. Subsystem - Struts</a></li>
2020-02-11 15:50:52 +01:00
<li><a href="#org7e2c432">6. Other Elements</a>
2020-01-29 12:02:22 +01:00
<ul>
<li><a href="#org3535b6d">6.1. Payload</a>
2020-01-29 12:02:22 +01:00
<ul>
2020-03-11 19:00:22 +01:00
<li><a href="#org1211163">Function description</a></li>
<li><a href="#org0d8dc7e">Optional Parameters</a></li>
<li><a href="#orgeeb8d35">Add Payload Type</a></li>
<li><a href="#org6d52ffc">Add Stiffness, Damping and Mass properties of the Payload</a></li>
2020-01-29 12:02:22 +01:00
</ul>
</li>
<li><a href="#orgaaed406">6.2. Ground</a>
2020-01-28 17:37:55 +01:00
<ul>
2020-03-11 19:00:22 +01:00
<li><a href="#org0bee981">Function description</a></li>
<li><a href="#orgeaeb9aa">Optional Parameters</a></li>
<li><a href="#orgef7035d">Add Ground Type</a></li>
<li><a href="#org95633e8">Add Stiffness and Damping properties of the Ground</a></li>
<li><a href="#org14ff2fc">Rotation Point</a></li>
</ul>
</li>
2020-01-28 17:37:55 +01:00
</ul>
</li>
2020-03-11 19:00:22 +01:00
<li><a href="#orgae6907a">7. Initialize Disturbances</a>
<ul>
<li><a href="#org0eae33e">Function Declaration and Documentation</a></li>
<li><a href="#orge03b19d">Optional Parameters</a></li>
<li><a href="#org30dc07c">Structure initialization</a></li>
<li><a href="#org0755155">Ground Motion</a></li>
<li><a href="#org7617a55">Direct Forces</a></li>
</ul>
</li>
<li><a href="#orgd45a07f">8. Initialize References</a>
<ul>
<li><a href="#org7f187c4">Function Declaration and Documentation</a></li>
<li><a href="#org28b782e">Optional Parameters</a></li>
<li><a href="#orgc274320">8.1. Compute the corresponding strut length</a></li>
<li><a href="#org36ac3fa">References</a></li>
</ul>
</li>
2020-01-28 17:37:55 +01:00
</ul>
</div>
</div>
2020-01-29 12:02:22 +01:00
<p>
In this document is explained how the Simscape model of the Stewart Platform is implemented.
</p>
<p>
It is divided in the following sections:
</p>
<ul class="org-ul">
2020-02-11 15:50:52 +01:00
<li>section <a href="#org8d965c3">1</a>: is explained how the parameters of the Stewart platform are set for the Simscape model</li>
<li>section <a href="#org354bfdb">2</a>: the Simulink configuration (solver, simulation time, &#x2026;) is shared among all the Simulink files. It is explain how this is done.</li>
<li>section <a href="#org66bbae2">3</a>: All the elements (platforms, struts, sensors, &#x2026;) are saved in separate files and imported in Simulink files using &ldquo;subsystem referenced&rdquo;.</li>
<li>section <a href="#orga4915c4">4</a>: The simscape model for the fixed base and mobile platform are described in this section.</li>
<li>section <a href="#orgdb5206f">5</a>: The simscape model for the Stewart platform struts is described in this section.</li>
2020-01-29 12:02:22 +01:00
</ul>
2020-02-11 15:27:39 +01:00
<div id="outline-container-orgc6e0b93" class="outline-2">
2020-02-11 15:50:52 +01:00
<h2 id="orgc6e0b93"><span class="section-number-2">1</span> Parameters used for the Simscape Model</h2>
<div class="outline-text-2" id="text-1">
2020-01-29 12:02:22 +01:00
<p>
2020-02-11 15:27:39 +01:00
<a id="org8d965c3"></a>
2020-01-29 12:02:22 +01:00
The Simscape Model of the Stewart Platform is working with the <code>stewart</code> structure generated using the functions described <a href="stewart-architecture.html">here</a>.
</p>
<p>
All the geometry and inertia of the mechanical elements are defined in the <code>stewart</code> structure.
</p>
<p>
By updating the <code>stewart</code> structure in the workspace, the Simscape model will be automatically updated.
</p>
<p>
Thus, nothing should be changed by hand inside the Simscape model.
</p>
<p>
The main advantage to have all the parameters defined in one structure (and not hard-coded in some simulink blocs) it that we can easily change the Stewart architecture/parameters in a Matlab script to perform some parametric study for instance.
</p>
</div>
2020-01-28 17:37:55 +01:00
</div>
2020-02-11 15:27:39 +01:00
<div id="outline-container-org66977e8" class="outline-2">
2020-02-11 15:50:52 +01:00
<h2 id="org66977e8"><span class="section-number-2">2</span> Simulation Configuration - Configuration reference</h2>
<div class="outline-text-2" id="text-2">
2020-01-28 17:37:55 +01:00
<p>
2020-02-11 15:27:39 +01:00
<a id="org354bfdb"></a>
2020-01-29 12:02:22 +01:00
As multiple simulink files will be used for simulation and tests, it is very useful to determine good simulation configuration that will be <b>shared</b> among all the simulink files.
2020-01-28 17:37:55 +01:00
</p>
<p>
2020-01-29 12:02:22 +01:00
This is done using something called &ldquo;<b>Configuration Reference</b>&rdquo; (<a href="https://fr.mathworks.com/help/simulink/ug/more-about-configuration-references.html">documentation</a>).
2020-01-28 17:37:55 +01:00
</p>
<p>
Basically, the configuration is stored in a mat file <code>conf_simscape.mat</code> and then loaded in the workspace for it to be accessible to all the simulink models.
It is automatically loaded when the Simulink project is open. It can be loaded manually with the command:
</p>
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'mat/conf_simscape.mat'</span>);
</pre>
</div>
<p>
2020-01-29 12:02:22 +01:00
It is however possible to modify specific parameters just for one simulation using the <code>set_param</code> command:
2020-01-28 17:37:55 +01:00
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-simulink-keyword">set_param</span>(<span class="org-variable-name">conf_simscape</span>, <span class="org-string">'StopTime'</span>, 1);
</pre>
</div>
</div>
</div>
2020-02-11 15:27:39 +01:00
<div id="outline-container-orgb2362eb" class="outline-2">
2020-02-11 15:50:52 +01:00
<h2 id="orgb2362eb"><span class="section-number-2">3</span> Subsystem Reference</h2>
<div class="outline-text-2" id="text-3">
2020-01-28 17:37:55 +01:00
<p>
2020-02-11 15:27:39 +01:00
<a id="org66bbae2"></a>
2020-01-28 17:37:55 +01:00
Several Stewart platform models are used, for instance one is use to study the dynamics while the other is used to apply active damping techniques.
</p>
<p>
However, all the Simscape models share some subsystems using the <b>Subsystem Reference</b> Simulink block (<a href="https://fr.mathworks.com/help/simulink/ug/referenced-subsystem-1.html">documentation</a>).
</p>
<p>
These shared subsystems are:
</p>
<ul class="org-ul">
<li><code>Fixed_Based.slx</code> - Fixed base of the Stewart Platform</li>
<li><code>Mobile_Platform.slx</code> - Mobile platform of the Stewart Platform</li>
<li><code>stewart_strut.slx</code> - One strut containing two spherical/universal joints, the actuator as well as the included sensors. A parameter <code>i</code> is initialized to determine what it the &ldquo;number&rdquo; of the strut.</li>
</ul>
<p>
2020-02-11 15:27:39 +01:00
These subsystems are referenced from another subsystem called <code>Stewart_Platform.slx</code> shown in figure <a href="#orgf687c71">1</a>, that basically connect them correctly.
2020-01-29 12:02:22 +01:00
This subsystem is then referenced in other simulink models for various purposes (control, analysis, simulation, &#x2026;).
</p>
2020-02-11 15:27:39 +01:00
<div id="orgf687c71" class="figure">
2020-01-29 12:02:22 +01:00
<p><img src="figs/simscape_stewart_platform.png" alt="simscape_stewart_platform.png" />
2020-01-28 17:37:55 +01:00
</p>
2020-01-29 12:02:22 +01:00
<p><span class="figure-number">Figure 1: </span>Simscape Subsystem of the Stewart platform. Encapsulate the Subsystems corresponding to the fixed base, mobile platform and all the struts.</p>
2020-01-28 17:37:55 +01:00
</div>
</div>
2020-01-29 12:02:22 +01:00
</div>
2020-02-11 15:27:39 +01:00
<div id="outline-container-orgdfad86d" class="outline-2">
2020-02-11 15:50:52 +01:00
<h2 id="orgdfad86d"><span class="section-number-2">4</span> Subsystem - Fixed base and Mobile Platform</h2>
<div class="outline-text-2" id="text-4">
2020-01-29 12:02:22 +01:00
<p>
2020-02-11 15:27:39 +01:00
<a id="orga4915c4"></a>
2020-01-29 12:02:22 +01:00
Both the fixed base and the mobile platform simscape models share many similarities.
</p>
<p>
Their are both composed of:
</p>
<ul class="org-ul">
<li>a solid body representing the platform</li>
<li>6 rigid transform blocks to go from the frame \(\{F\}\) (resp. \(\{M\}\)) to the location of the joints.
These rigid transform are using \({}^F\bm{a}_i\) (resp. \({}^M\bm{b}_i\)) for the position of the joint and \({}^F\bm{R}_{a_i}\) (resp. \({}^M\bm{R}_{b_i}\)) for the orientation of the joint.</li>
</ul>
2020-01-28 17:37:55 +01:00
2020-01-29 12:02:22 +01:00
<p>
As always, the parameters that define the geometry are taken from the <code>stewart</code> structure.
</p>
2020-02-11 15:27:39 +01:00
<div id="org858f0b4" class="figure">
2020-01-29 12:02:22 +01:00
<p><img src="figs/simscape_fixed_base.png" alt="simscape_fixed_base.png" width="1000px" />
</p>
<p><span class="figure-number">Figure 2: </span>Simscape Model of the Fixed base</p>
2020-01-28 17:37:55 +01:00
</div>
2020-01-29 12:02:22 +01:00
2020-02-11 15:27:39 +01:00
<div id="org4b31aa3" class="figure">
2020-01-29 12:02:22 +01:00
<p><img src="figs/simscape_mobile_platform.png" alt="simscape_mobile_platform.png" width="800px" />
</p>
<p><span class="figure-number">Figure 3: </span>Simscape Model of the Mobile platform</p>
</div>
</div>
2020-01-28 17:37:55 +01:00
</div>
2020-02-11 15:27:39 +01:00
<div id="outline-container-org9d4af75" class="outline-2">
2020-02-11 15:50:52 +01:00
<h2 id="org9d4af75"><span class="section-number-2">5</span> Subsystem - Struts</h2>
<div class="outline-text-2" id="text-5">
2020-01-29 12:02:22 +01:00
<p>
2020-02-11 15:27:39 +01:00
<a id="orgdb5206f"></a>
2020-01-29 12:02:22 +01:00
For the Stewart platform, the 6 struts are identical.
2020-02-11 15:27:39 +01:00
Thus, all the struts used in the Stewart platform are referring to the same subsystem called <code>stewart_strut.slx</code> and shown in Figure <a href="#org1dc8fce">4</a>.
2020-01-29 12:02:22 +01:00
</p>
<p>
2020-03-11 19:00:22 +01:00
This strut has the following structure:
2020-01-29 12:02:22 +01:00
</p>
<ul class="org-ul">
2020-03-11 19:00:22 +01:00
<li><b>Universal Joint</b> connected on the Fixed base</li>
<li><b>Prismatic Joint</b> for the actuator</li>
<li><b>Spherical Joint</b> connected on the Mobile platform</li>
2020-01-29 12:02:22 +01:00
</ul>
2020-01-28 17:37:55 +01:00
<p>
2020-01-29 12:02:22 +01:00
This configuration is called <b>UPS</b>.
</p>
<p>
The other common configuration <b>SPS</b> has the disadvantage of having additional passive degrees-of-freedom corresponding to the rotation of the strut around its main axis.
This is why the <b>UPS</b> configuration is used, but other configuration can be easily implemented.
</p>
2020-02-11 15:27:39 +01:00
<div id="org1dc8fce" class="figure">
2020-01-29 12:02:22 +01:00
<p><img src="figs/simscape_strut.png" alt="simscape_strut.png" width="800px" />
</p>
<p><span class="figure-number">Figure 4: </span>Simscape model of the Stewart platform&rsquo;s strut</p>
</div>
<p>
Several sensors are included in the strut that may or may not be used for control:
</p>
<ul class="org-ul">
<li>Relative Displacement sensor: gives the relative displacement of the strut.</li>
<li>Force sensor: measure the total force applied by the force actuator, the stiffness and damping forces in the direction of the strut.</li>
<li>Inertial sensor: measure the absolute motion (velocity) of the top part of the strut in the direction of the strut.</li>
</ul>
<p>
There is two main types of inertial sensor that can be used to measure the absolute motion of the top part of the strut in the direction of the strut:
</p>
<ul class="org-ul">
<li>a geophone that measures the absolute velocity above some frequency</li>
<li>an accelerometer that measures the absolute acceleration below some frequency</li>
</ul>
<p>
Both inertial sensors are described bellow.
</p>
</div>
</div>
2020-02-11 15:27:39 +01:00
<div id="outline-container-org7e2c432" class="outline-2">
2020-02-11 15:50:52 +01:00
<h2 id="org7e2c432"><span class="section-number-2">6</span> Other Elements</h2>
<div class="outline-text-2" id="text-6">
2020-02-11 15:27:39 +01:00
</div>
<div id="outline-container-org3535b6d" class="outline-3">
<h3 id="org3535b6d"><span class="section-number-3">6.1</span> Payload</h3>
2020-02-11 15:50:52 +01:00
<div class="outline-text-3" id="text-6-1">
<p>
<a id="org3a56808"></a>
</p>
<p>
This Matlab function is accessible <a href="../src/initializePayload.m">here</a>.
</p>
</div>
2020-03-11 19:00:22 +01:00
<div id="outline-container-org1211163" class="outline-4">
<h4 id="org1211163">Function description</h4>
<div class="outline-text-4" id="text-org1211163">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name">[payload]</span> = <span class="org-function-name">initializePayload</span>(<span class="org-variable-name">args</span>)
<span class="org-comment">% initializePayload - Initialize the Payload that can then be used for simulations and analysis</span>
<span class="org-comment">%</span>
<span class="org-comment">% Syntax: [payload] = initializePayload(args)</span>
<span class="org-comment">%</span>
<span class="org-comment">% Inputs:</span>
<span class="org-comment">% - args - Structure with the following fields:</span>
<span class="org-comment">% - type - 'none', 'rigid', 'flexible', 'cartesian'</span>
<span class="org-comment">% - h [1x1] - Height of the CoM of the payload w.r.t {M} [m]</span>
<span class="org-comment">% This also the position where K and C are defined</span>
<span class="org-comment">% - K [6x1] - Stiffness of the Payload [N/m, N/rad]</span>
<span class="org-comment">% - C [6x1] - Damping of the Payload [N/(m/s), N/(rad/s)]</span>
<span class="org-comment">% - m [1x1] - Mass of the Payload [kg]</span>
<span class="org-comment">% - I [3x3] - Inertia matrix for the Payload [kg*m2]</span>
<span class="org-comment">%</span>
<span class="org-comment">% Outputs:</span>
<span class="org-comment">% - payload - Struture with the following properties:</span>
<span class="org-comment">% - type - 1 (none), 2 (rigid), 3 (flexible)</span>
<span class="org-comment">% - h [1x1] - Height of the CoM of the payload w.r.t {M} [m]</span>
<span class="org-comment">% - K [6x1] - Stiffness of the Payload [N/m, N/rad]</span>
<span class="org-comment">% - C [6x1] - Stiffness of the Payload [N/(m/s), N/(rad/s)]</span>
<span class="org-comment">% - m [1x1] - Mass of the Payload [kg]</span>
<span class="org-comment">% - I [3x3] - Inertia matrix for the Payload [kg*m2]</span>
</pre>
</div>
</div>
</div>
2020-03-11 19:00:22 +01:00
<div id="outline-container-org0d8dc7e" class="outline-4">
<h4 id="org0d8dc7e">Optional Parameters</h4>
<div class="outline-text-4" id="text-org0d8dc7e">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{<span class="org-string">'none'</span>, <span class="org-string">'rigid'</span>, <span class="org-string">'flexible'</span>, <span class="org-string">'cartesian'</span>})} = <span class="org-string">'none'</span>
args.K (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e8<span class="org-type">*</span>ones(6,1)
args.C (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e1<span class="org-type">*</span>ones(6,1)
args.h (1,1) double {mustBeNumeric, mustBeNonnegative} = 100e<span class="org-type">-</span>3
args.m (1,1) double {mustBeNumeric, mustBeNonnegative} = 10
args.I (3,3) double {mustBeNumeric, mustBeNonnegative} = 1<span class="org-type">*</span>eye(3)
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgeeb8d35" class="outline-4">
<h4 id="orgeeb8d35">Add Payload Type</h4>
<div class="outline-text-4" id="text-orgeeb8d35">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">switch</span> <span class="org-constant">args.type</span>
<span class="org-keyword">case</span> <span class="org-string">'none'</span>
payload.type = 1;
<span class="org-keyword">case</span> <span class="org-string">'rigid'</span>
payload.type = 2;
<span class="org-keyword">case</span> <span class="org-string">'flexible'</span>
payload.type = 3;
<span class="org-keyword">case</span> <span class="org-string">'cartesian'</span>
payload.type = 4;
<span class="org-keyword">end</span>
</pre>
</div>
</div>
2020-01-29 12:02:22 +01:00
</div>
<div id="outline-container-org6d52ffc" class="outline-4">
<h4 id="org6d52ffc">Add Stiffness, Damping and Mass properties of the Payload</h4>
<div class="outline-text-4" id="text-org6d52ffc">
<div class="org-src-container">
<pre class="src src-matlab">payload.K = args.K;
payload.C = args.C;
payload.m = args.m;
payload.I = args.I;
payload.h = args.h;
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgaaed406" class="outline-3">
<h3 id="orgaaed406"><span class="section-number-3">6.2</span> Ground</h3>
<div class="outline-text-3" id="text-6-2">
<p>
<a id="orge64ba82"></a>
</p>
<p>
This Matlab function is accessible <a href="../src/initializeGround.m">here</a>.
</p>
</div>
2020-03-11 19:00:22 +01:00
<div id="outline-container-org0bee981" class="outline-4">
<h4 id="org0bee981">Function description</h4>
<div class="outline-text-4" id="text-org0bee981">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name">[ground]</span> = <span class="org-function-name">initializeGround</span>(<span class="org-variable-name">args</span>)
<span class="org-comment">% initializeGround - Initialize the Ground that can then be used for simulations and analysis</span>
<span class="org-comment">%</span>
<span class="org-comment">% Syntax: [ground] = initializeGround(args)</span>
<span class="org-comment">%</span>
<span class="org-comment">% Inputs:</span>
<span class="org-comment">% - args - Structure with the following fields:</span>
<span class="org-comment">% - type - 'none', 'solid', 'flexible'</span>
<span class="org-comment">% - rot_point [3x1] - Rotation point for the ground motion [m]</span>
<span class="org-comment">% - K [3x1] - Translation Stiffness of the Ground [N/m]</span>
<span class="org-comment">% - C [3x1] - Translation Damping of the Ground [N/(m/s)]</span>
<span class="org-comment">%</span>
<span class="org-comment">% Outputs:</span>
<span class="org-comment">% - ground - Struture with the following properties:</span>
<span class="org-comment">% - type - 1 (none), 2 (rigid), 3 (flexible)</span>
<span class="org-comment">% - K [3x1] - Translation Stiffness of the Ground [N/m]</span>
<span class="org-comment">% - C [3x1] - Translation Damping of the Ground [N/(m/s)]</span>
</pre>
</div>
</div>
</div>
2020-03-11 19:00:22 +01:00
<div id="outline-container-orgeaeb9aa" class="outline-4">
<h4 id="orgeaeb9aa">Optional Parameters</h4>
<div class="outline-text-4" id="text-orgeaeb9aa">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.type char {mustBeMember(args.type,{<span class="org-string">'none'</span>, <span class="org-string">'rigid'</span>, <span class="org-string">'flexible'</span>})} = <span class="org-string">'none'</span>
args.rot_point (3,1) double {mustBeNumeric} = zeros(3,1)
args.K (3,1) double {mustBeNumeric, mustBeNonnegative} = 1e8<span class="org-type">*</span>ones(3,1)
args.C (3,1) double {mustBeNumeric, mustBeNonnegative} = 1e1<span class="org-type">*</span>ones(3,1)
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgef7035d" class="outline-4">
<h4 id="orgef7035d">Add Ground Type</h4>
<div class="outline-text-4" id="text-orgef7035d">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">switch</span> <span class="org-constant">args.type</span>
<span class="org-keyword">case</span> <span class="org-string">'none'</span>
ground.type = 1;
<span class="org-keyword">case</span> <span class="org-string">'rigid'</span>
ground.type = 2;
<span class="org-keyword">case</span> <span class="org-string">'flexible'</span>
ground.type = 3;
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org95633e8" class="outline-4">
<h4 id="org95633e8">Add Stiffness and Damping properties of the Ground</h4>
<div class="outline-text-4" id="text-org95633e8">
<div class="org-src-container">
<pre class="src src-matlab">ground.K = args.K;
ground.C = args.C;
</pre>
</div>
</div>
</div>
<div id="outline-container-org14ff2fc" class="outline-4">
<h4 id="org14ff2fc">Rotation Point</h4>
<div class="outline-text-4" id="text-org14ff2fc">
<div class="org-src-container">
<pre class="src src-matlab">ground.rot_point = args.rot_point;
</pre>
</div>
</div>
</div>
</div>
</div>
2020-03-11 19:00:22 +01:00
<div id="outline-container-orgae6907a" class="outline-2">
<h2 id="orgae6907a"><span class="section-number-2">7</span> Initialize Disturbances</h2>
<div class="outline-text-2" id="text-7">
<p>
<a id="org96254bf"></a>
</p>
</div>
<div id="outline-container-org0eae33e" class="outline-3">
<h3 id="org0eae33e">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-org0eae33e">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name">[disturbances]</span> = <span class="org-function-name">initializeDisturbances</span>(<span class="org-variable-name">args</span>)
<span class="org-comment">% initializeDisturbances - Initialize the disturbances</span>
<span class="org-comment">%</span>
<span class="org-comment">% Syntax: [disturbances] = initializeDisturbances(args)</span>
<span class="org-comment">%</span>
<span class="org-comment">% Inputs:</span>
<span class="org-comment">% - args -</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orge03b19d" class="outline-3">
<h3 id="orge03b19d">Optional Parameters</h3>
<div class="outline-text-3" id="text-orge03b19d">
<div class="org-src-container">
<pre class="src src-matlab">arguments
args.Fd double {mustBeNumeric, mustBeReal} = zeros(6,1)
args.Fd_t double {mustBeNumeric, mustBeReal} = 0
args.Dw double {mustBeNumeric, mustBeReal} = zeros(6,1)
args.Dw_t double {mustBeNumeric, mustBeReal} = 0
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org30dc07c" class="outline-3">
<h3 id="org30dc07c">Structure initialization</h3>
<div class="outline-text-3" id="text-org30dc07c">
<div class="org-src-container">
<pre class="src src-matlab">disturbances = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org0755155" class="outline-3">
<h3 id="org0755155">Ground Motion</h3>
<div class="outline-text-3" id="text-org0755155">
<div class="org-src-container">
<pre class="src src-matlab">disturbances.Dw = timeseries([args.Dw], args.Dw_t);
</pre>
</div>
</div>
</div>
<div id="outline-container-org7617a55" class="outline-3">
<h3 id="org7617a55">Direct Forces</h3>
<div class="outline-text-3" id="text-org7617a55">
<div class="org-src-container">
<pre class="src src-matlab">disturbances.Fd = timeseries([args.Fd], args.Fd_t);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgd45a07f" class="outline-2">
<h2 id="orgd45a07f"><span class="section-number-2">8</span> Initialize References</h2>
<div class="outline-text-2" id="text-8">
<p>
<a id="org7e762f4"></a>
</p>
</div>
<div id="outline-container-org7f187c4" class="outline-3">
<h3 id="org7f187c4">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-org7f187c4">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name">[references]</span> = <span class="org-function-name">initializeReferences</span>(<span class="org-variable-name">stewart</span>, <span class="org-variable-name">args</span>)
<span class="org-comment">% initializeReferences - Initialize the references</span>
<span class="org-comment">%</span>
<span class="org-comment">% Syntax: [references] = initializeReferences(args)</span>
<span class="org-comment">%</span>
<span class="org-comment">% Inputs:</span>
<span class="org-comment">% - args -</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org28b782e" class="outline-3">
<h3 id="org28b782e">Optional Parameters</h3>
<div class="outline-text-3" id="text-org28b782e">
<div class="org-src-container">
<pre class="src src-matlab">arguments
stewart
args.t double {mustBeNumeric, mustBeReal} = 0
args.r double {mustBeNumeric, mustBeReal} = zeros(6, 1)
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc274320" class="outline-3">
<h3 id="orgc274320"><span class="section-number-3">8.1</span> Compute the corresponding strut length</h3>
<div class="outline-text-3" id="text-8-1">
<div class="org-src-container">
<pre class="src src-matlab">rL = zeros(6, length(args.t));
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-constant">i</span></span> = <span class="org-constant">1:length(args.t)</span>
R = [cos(args.r(6,<span class="org-constant">i</span>)) <span class="org-type">-</span>sin(args.r(6,<span class="org-constant">i</span>)) 0;
sin(args.r(6,<span class="org-constant">i</span>)) cos(args.r(6,<span class="org-constant">i</span>)) 0;
0 0 1] <span class="org-type">*</span> ...
[cos(args.r(5,<span class="org-constant">i</span>)) 0 sin(args.r(5,<span class="org-constant">i</span>));
0 1 0;
<span class="org-type">-</span>sin(args.r(5,<span class="org-constant">i</span>)) 0 cos(args.r(5,<span class="org-constant">i</span>))] <span class="org-type">*</span> ...
[1 0 0;
0 cos(args.r(4,<span class="org-constant">i</span>)) <span class="org-type">-</span>sin(args.r(4,<span class="org-constant">i</span>));
0 sin(args.r(4,<span class="org-constant">i</span>)) cos(args.r(4,<span class="org-constant">i</span>))];
[Li, dLi] = inverseKinematics(stewart, <span class="org-string">'AP'</span>, [args.r(1,<span class="org-constant">i</span>); args.r(2,<span class="org-constant">i</span>); args.r(3,<span class="org-constant">i</span>)], <span class="org-string">'ARB'</span>, R);
rL(<span class="org-type">:</span>, <span class="org-constant">i</span>) = dLi;
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org36ac3fa" class="outline-3">
<h3 id="org36ac3fa">References</h3>
<div class="outline-text-3" id="text-org36ac3fa">
<div class="org-src-container">
<pre class="src src-matlab">references.r = timeseries(args.r, args.t);
references.rL = timeseries(rL, args.t);
</pre>
</div>
</div>
</div>
</div>
2020-01-29 12:02:22 +01:00
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
2020-03-11 19:00:22 +01:00
<p class="date">Created: 2020-03-11 mer. 18:59</p>
</div>
</body>
</html>