stewart-simscape/docs/simscape-model.html

636 lines
27 KiB
HTML
Raw Permalink Normal View History

<?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>
2021-01-08 15:54:58 +01:00
<!-- 2021-01-08 ven. 15:52 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Stewart Platform - Simscape Model</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
2021-01-08 15:34:53 +01:00
<link rel="stylesheet" type="text/css" href="https://research.tdehaeze.xyz/css/style.css"/>
<script type="text/javascript" src="https://research.tdehaeze.xyz/js/script.js"></script>
<script>
MathJax = {
svg: {
scale: 1,
fontCache: "global"
},
tex: {
tags: "ams",
multlineWidth: "%MULTLINEWIDTH",
tagSide: "right",
macros: {bm: ["\\boldsymbol{#1}",1],},
tagIndent: ".8em"
}
};
</script>
<script id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.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>
2021-01-08 15:34:53 +01:00
<li><a href="#org79eeba1">1. Parameters used for the Simscape Model</a></li>
<li><a href="#org677dd01">2. Simulation Configuration - Configuration reference</a></li>
<li><a href="#orge89e3e7">3. Subsystem Reference</a></li>
<li><a href="#org5f42d80">4. Subsystem - Fixed base and Mobile Platform</a></li>
<li><a href="#orgbec2976">5. Subsystem - Struts</a></li>
<li><a href="#org806ecc3">6. Other Elements</a>
2020-01-29 12:02:22 +01:00
<ul>
2021-01-08 15:34:53 +01:00
<li><a href="#orgf4bef70">6.1. Payload</a>
2020-01-29 12:02:22 +01:00
<ul>
2021-01-08 15:54:58 +01:00
<li><a href="#org920bdd0">Function description</a></li>
<li><a href="#orgbc7950f">Optional Parameters</a></li>
2021-01-08 15:34:53 +01:00
<li><a href="#org4ef4a9f">Add Payload Type</a></li>
<li><a href="#org3243d76">Add Stiffness, Damping and Mass properties of the Payload</a></li>
2020-01-29 12:02:22 +01:00
</ul>
</li>
2021-01-08 15:34:53 +01:00
<li><a href="#orgd9e12ef">6.2. Ground</a>
2020-01-28 17:37:55 +01:00
<ul>
2021-01-08 15:54:58 +01:00
<li><a href="#orgc300ecf">Function description</a></li>
<li><a href="#org1ee272a">Optional Parameters</a></li>
2021-01-08 15:34:53 +01:00
<li><a href="#org2d22970">Add Ground Type</a></li>
<li><a href="#orgf76def4">Add Stiffness and Damping properties of the Ground</a></li>
<li><a href="#orgdb67a68">Rotation Point</a></li>
</ul>
</li>
2020-01-28 17:37:55 +01:00
</ul>
</li>
2021-01-08 15:34:53 +01:00
<li><a href="#org6d3b61e">7. Initialize Disturbances</a>
2020-03-11 19:00:22 +01:00
<ul>
2021-01-08 15:54:58 +01:00
<li><a href="#orgf124972">Function Declaration and Documentation</a></li>
<li><a href="#org668f4bb">Optional Parameters</a></li>
2021-01-08 15:34:53 +01:00
<li><a href="#org0f7e4dd">Structure initialization</a></li>
<li><a href="#org1a28fcd">Ground Motion</a></li>
<li><a href="#org90b72d6">Direct Forces</a></li>
2020-03-11 19:00:22 +01:00
</ul>
</li>
2021-01-08 15:34:53 +01:00
<li><a href="#org93f2d30">8. Initialize References</a>
2020-03-11 19:00:22 +01:00
<ul>
2021-01-08 15:54:58 +01:00
<li><a href="#org81500bb">Function Declaration and Documentation</a></li>
<li><a href="#org05322ee">Optional Parameters</a></li>
2021-01-08 15:34:53 +01:00
<li><a href="#org6f05adc">8.1. Compute the corresponding strut length</a></li>
<li><a href="#orgda73a50">References</a></li>
2020-03-11 19:00:22 +01:00
</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">
2021-01-08 15:34:53 +01:00
<li>section <a href="#orge8daba9">1</a>: is explained how the parameters of the Stewart platform are set for the Simscape model</li>
<li>section <a href="#org11ed7ef">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="#org1a0307c">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="#org5fac181">4</a>: The simscape model for the fixed base and mobile platform are described in this section.</li>
<li>section <a href="#org793a5c7">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>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org79eeba1" class="outline-2">
<h2 id="org79eeba1"><span class="section-number-2">1</span> Parameters used for the Simscape Model</h2>
2020-02-11 15:50:52 +01:00
<div class="outline-text-2" id="text-1">
2020-01-29 12:02:22 +01:00
<p>
2021-01-08 15:34:53 +01:00
<a id="orge8daba9"></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>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org677dd01" class="outline-2">
<h2 id="org677dd01"><span class="section-number-2">2</span> Simulation Configuration - Configuration reference</h2>
2020-02-11 15:50:52 +01:00
<div class="outline-text-2" id="text-2">
2020-01-28 17:37:55 +01:00
<p>
2021-01-08 15:34:53 +01:00
<a id="org11ed7ef"></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">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab">load(<span class="org-string">'mat/conf_simscape.mat'</span>);
2020-01-28 17:37:55 +01:00
</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">
2021-01-08 15:54:58 +01:00
<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);
2020-01-28 17:37:55 +01:00
</pre>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-orge89e3e7" class="outline-2">
<h2 id="orge89e3e7"><span class="section-number-2">3</span> Subsystem Reference</h2>
2020-02-11 15:50:52 +01:00
<div class="outline-text-2" id="text-3">
2020-01-28 17:37:55 +01:00
<p>
2021-01-08 15:34:53 +01:00
<a id="org1a0307c"></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>
2021-01-08 15:34:53 +01:00
These subsystems are referenced from another subsystem called <code>Stewart_Platform.slx</code> shown in figure <a href="#org18dcfb1">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>
2021-01-08 15:34:53 +01:00
<div id="org18dcfb1" 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>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org5f42d80" class="outline-2">
<h2 id="org5f42d80"><span class="section-number-2">4</span> Subsystem - Fixed base and Mobile Platform</h2>
2020-02-11 15:50:52 +01:00
<div class="outline-text-2" id="text-4">
2020-01-29 12:02:22 +01:00
<p>
2021-01-08 15:34:53 +01:00
<a id="org5fac181"></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>
2021-01-08 15:34:53 +01:00
<div id="org7b43415" 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
2021-01-08 15:34:53 +01:00
<div id="org7ed0d98" 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>
2021-01-08 15:34:53 +01:00
<div id="outline-container-orgbec2976" class="outline-2">
<h2 id="orgbec2976"><span class="section-number-2">5</span> Subsystem - Struts</h2>
2020-02-11 15:50:52 +01:00
<div class="outline-text-2" id="text-5">
2020-01-29 12:02:22 +01:00
<p>
2021-01-08 15:34:53 +01:00
<a id="org793a5c7"></a>
2020-01-29 12:02:22 +01:00
For the Stewart platform, the 6 struts are identical.
2021-01-08 15:34:53 +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="#org96a73eb">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>
2021-01-08 15:34:53 +01:00
<div id="org96a73eb" 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>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org806ecc3" class="outline-2">
<h2 id="org806ecc3"><span class="section-number-2">6</span> Other Elements</h2>
2020-02-11 15:50:52 +01:00
<div class="outline-text-2" id="text-6">
2020-02-11 15:27:39 +01:00
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-orgf4bef70" class="outline-3">
<h3 id="orgf4bef70"><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>
2021-01-08 15:34:53 +01:00
<a id="orgdd9802d"></a>
</p>
<p>
This Matlab function is accessible <a href="../src/initializePayload.m">here</a>.
</p>
</div>
2021-01-08 15:54:58 +01:00
<div id="outline-container-org920bdd0" class="outline-4">
<h4 id="org920bdd0">Function description</h4>
<div class="outline-text-4" id="text-org920bdd0">
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<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>
2021-01-08 15:54:58 +01:00
<div id="outline-container-orgbc7950f" class="outline-4">
<h4 id="orgbc7950f">Optional Parameters</h4>
<div class="outline-text-4" id="text-orgbc7950f">
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab"><span class="org-keyword">arguments</span>
<span class="org-variable-name">args</span>.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>
<span class="org-variable-name">args</span>.K (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e8<span class="org-type">*</span>ones(6,1)
<span class="org-variable-name">args</span>.C (6,1) double {mustBeNumeric, mustBeNonnegative} = 1e1<span class="org-type">*</span>ones(6,1)
<span class="org-variable-name">args</span>.h (1,1) double {mustBeNumeric, mustBeNonnegative} = 100e<span class="org-type">-</span>3
<span class="org-variable-name">args</span>.m (1,1) double {mustBeNumeric, mustBeNonnegative} = 10
<span class="org-variable-name">args</span>.I (3,3) double {mustBeNumeric, mustBeNonnegative} = 1<span class="org-type">*</span>eye(3)
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org4ef4a9f" class="outline-4">
<h4 id="org4ef4a9f">Add Payload Type</h4>
<div class="outline-text-4" id="text-org4ef4a9f">
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<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>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org3243d76" class="outline-4">
<h4 id="org3243d76">Add Stiffness, Damping and Mass properties of the Payload</h4>
<div class="outline-text-4" id="text-org3243d76">
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab">payload.K = args.K;
payload.C = args.C;
payload.m = args.m;
payload.I = args.I;
2021-01-08 15:54:58 +01:00
payload.h = args.h;
</pre>
</div>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-orgd9e12ef" class="outline-3">
<h3 id="orgd9e12ef"><span class="section-number-3">6.2</span> Ground</h3>
<div class="outline-text-3" id="text-6-2">
<p>
2021-01-08 15:34:53 +01:00
<a id="org140423a"></a>
</p>
<p>
This Matlab function is accessible <a href="../src/initializeGround.m">here</a>.
</p>
</div>
2021-01-08 15:54:58 +01:00
<div id="outline-container-orgc300ecf" class="outline-4">
<h4 id="orgc300ecf">Function description</h4>
<div class="outline-text-4" id="text-orgc300ecf">
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<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>
2021-01-08 15:54:58 +01:00
<div id="outline-container-org1ee272a" class="outline-4">
<h4 id="org1ee272a">Optional Parameters</h4>
<div class="outline-text-4" id="text-org1ee272a">
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab"><span class="org-keyword">arguments</span>
2021-01-08 15:34:53 +01:00
<span class="org-variable-name">args</span>.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>
<span class="org-variable-name">args</span>.rot_point (3,1) double {mustBeNumeric} = zeros(3,1)
<span class="org-variable-name">args</span>.K (3,1) double {mustBeNumeric, mustBeNonnegative} = 1e8<span class="org-type">*</span>ones(3,1)
<span class="org-variable-name">args</span>.C (3,1) double {mustBeNumeric, mustBeNonnegative} = 1e1<span class="org-type">*</span>ones(3,1)
2021-01-08 15:54:58 +01:00
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org2d22970" class="outline-4">
<h4 id="org2d22970">Add Ground Type</h4>
<div class="outline-text-4" id="text-org2d22970">
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<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>
2021-01-08 15:34:53 +01:00
<div id="outline-container-orgf76def4" class="outline-4">
<h4 id="orgf76def4">Add Stiffness and Damping properties of the Ground</h4>
<div class="outline-text-4" id="text-orgf76def4">
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab">ground.K = args.K;
ground.C = args.C;
</pre>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-orgdb67a68" class="outline-4">
<h4 id="orgdb67a68">Rotation Point</h4>
<div class="outline-text-4" id="text-orgdb67a68">
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab">ground.rot_point = args.rot_point;
</pre>
</div>
</div>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org6d3b61e" class="outline-2">
<h2 id="org6d3b61e"><span class="section-number-2">7</span> Initialize Disturbances</h2>
2020-03-11 19:00:22 +01:00
<div class="outline-text-2" id="text-7">
<p>
2021-01-08 15:34:53 +01:00
<a id="org5c942ea"></a>
2020-03-11 19:00:22 +01:00
</p>
</div>
2021-01-08 15:54:58 +01:00
<div id="outline-container-orgf124972" class="outline-3">
<h3 id="orgf124972">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-orgf124972">
2020-03-11 19:00:22 +01:00
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<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>
2020-03-11 19:00:22 +01:00
</pre>
</div>
</div>
</div>
2021-01-08 15:54:58 +01:00
<div id="outline-container-org668f4bb" class="outline-3">
<h3 id="org668f4bb">Optional Parameters</h3>
<div class="outline-text-3" id="text-org668f4bb">
2020-03-11 19:00:22 +01:00
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab"><span class="org-keyword">arguments</span>
2021-01-08 15:34:53 +01:00
<span class="org-variable-name">args</span>.Fd double {mustBeNumeric, mustBeReal} = zeros(6,1)
<span class="org-variable-name">args</span>.Fd_t double {mustBeNumeric, mustBeReal} = 0
<span class="org-variable-name">args</span>.Dw double {mustBeNumeric, mustBeReal} = zeros(6,1)
<span class="org-variable-name">args</span>.Dw_t double {mustBeNumeric, mustBeReal} = 0
2021-01-08 15:54:58 +01:00
<span class="org-keyword">end</span>
2020-03-11 19:00:22 +01:00
</pre>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org0f7e4dd" class="outline-3">
<h3 id="org0f7e4dd">Structure initialization</h3>
<div class="outline-text-3" id="text-org0f7e4dd">
2020-03-11 19:00:22 +01:00
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab">disturbances = struct();
2020-03-11 19:00:22 +01:00
</pre>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org1a28fcd" class="outline-3">
<h3 id="org1a28fcd">Ground Motion</h3>
<div class="outline-text-3" id="text-org1a28fcd">
2020-03-11 19:00:22 +01:00
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab">disturbances.Dw = timeseries([args.Dw], args.Dw_t);
2020-03-11 19:00:22 +01:00
</pre>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org90b72d6" class="outline-3">
<h3 id="org90b72d6">Direct Forces</h3>
<div class="outline-text-3" id="text-org90b72d6">
2020-03-11 19:00:22 +01:00
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab">disturbances.Fd = timeseries([args.Fd], args.Fd_t);
2020-03-11 19:00:22 +01:00
</pre>
</div>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org93f2d30" class="outline-2">
<h2 id="org93f2d30"><span class="section-number-2">8</span> Initialize References</h2>
2020-03-11 19:00:22 +01:00
<div class="outline-text-2" id="text-8">
<p>
2021-01-08 15:34:53 +01:00
<a id="orge24eeb5"></a>
2020-03-11 19:00:22 +01:00
</p>
</div>
2021-01-08 15:54:58 +01:00
<div id="outline-container-org81500bb" class="outline-3">
<h3 id="org81500bb">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-org81500bb">
2020-03-11 19:00:22 +01:00
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<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>
2020-03-11 19:00:22 +01:00
</pre>
</div>
</div>
</div>
2021-01-08 15:54:58 +01:00
<div id="outline-container-org05322ee" class="outline-3">
<h3 id="org05322ee">Optional Parameters</h3>
<div class="outline-text-3" id="text-org05322ee">
2020-03-11 19:00:22 +01:00
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab"><span class="org-keyword">arguments</span>
2021-01-08 15:34:53 +01:00
<span class="org-variable-name">stewart</span>
<span class="org-variable-name">args</span>.t double {mustBeNumeric, mustBeReal} = 0
<span class="org-variable-name">args</span>.r double {mustBeNumeric, mustBeReal} = zeros(6, 1)
2021-01-08 15:54:58 +01:00
<span class="org-keyword">end</span>
2020-03-11 19:00:22 +01:00
</pre>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-org6f05adc" class="outline-3">
<h3 id="org6f05adc"><span class="section-number-3">8.1</span> Compute the corresponding strut length</h3>
2020-03-11 19:00:22 +01:00
<div class="outline-text-3" id="text-8-1">
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab">rL = zeros(6, length(args.t));
2021-01-08 15:34:53 +01:00
2021-01-08 15:54:58 +01:00
<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>
2021-01-08 15:34:53 +01:00
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;
2021-01-08 15:54:58 +01:00
<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> ...
2021-01-08 15:34:53 +01:00
[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>))];
2021-01-08 15:54:58 +01:00
[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>
2020-03-11 19:00:22 +01:00
</pre>
</div>
</div>
</div>
2021-01-08 15:34:53 +01:00
<div id="outline-container-orgda73a50" class="outline-3">
<h3 id="orgda73a50">References</h3>
<div class="outline-text-3" id="text-orgda73a50">
2020-03-11 19:00:22 +01:00
<div class="org-src-container">
2021-01-08 15:54:58 +01:00
<pre class="src src-matlab">references.r = timeseries(args.r, args.t);
references.rL = timeseries(rL, args.t);
2020-03-11 19:00:22 +01:00
</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>
2021-01-08 15:54:58 +01:00
<p class="date">Created: 2021-01-08 ven. 15:52</p>
</div>
</body>
</html>