stewart-simscape/docs/simscape-model.html

636 lines
27 KiB
HTML

<?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 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" />
<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>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<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>
<ul>
<li><a href="#orgf4bef70">6.1. Payload</a>
<ul>
<li><a href="#org920bdd0">Function description</a></li>
<li><a href="#orgbc7950f">Optional Parameters</a></li>
<li><a href="#org4ef4a9f">Add Payload Type</a></li>
<li><a href="#org3243d76">Add Stiffness, Damping and Mass properties of the Payload</a></li>
</ul>
</li>
<li><a href="#orgd9e12ef">6.2. Ground</a>
<ul>
<li><a href="#orgc300ecf">Function description</a></li>
<li><a href="#org1ee272a">Optional Parameters</a></li>
<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>
</ul>
</li>
<li><a href="#org6d3b61e">7. Initialize Disturbances</a>
<ul>
<li><a href="#orgf124972">Function Declaration and Documentation</a></li>
<li><a href="#org668f4bb">Optional Parameters</a></li>
<li><a href="#org0f7e4dd">Structure initialization</a></li>
<li><a href="#org1a28fcd">Ground Motion</a></li>
<li><a href="#org90b72d6">Direct Forces</a></li>
</ul>
</li>
<li><a href="#org93f2d30">8. Initialize References</a>
<ul>
<li><a href="#org81500bb">Function Declaration and Documentation</a></li>
<li><a href="#org05322ee">Optional Parameters</a></li>
<li><a href="#org6f05adc">8.1. Compute the corresponding strut length</a></li>
<li><a href="#orgda73a50">References</a></li>
</ul>
</li>
</ul>
</div>
</div>
<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">
<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>
</ul>
<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>
<div class="outline-text-2" id="text-1">
<p>
<a id="orge8daba9"></a>
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>
</div>
<div id="outline-container-org677dd01" class="outline-2">
<h2 id="org677dd01"><span class="section-number-2">2</span> Simulation Configuration - Configuration reference</h2>
<div class="outline-text-2" id="text-2">
<p>
<a id="org11ed7ef"></a>
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.
</p>
<p>
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>).
</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>
It is however possible to modify specific parameters just for one simulation using the <code>set_param</code> command:
</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>
<div id="outline-container-orge89e3e7" class="outline-2">
<h2 id="orge89e3e7"><span class="section-number-2">3</span> Subsystem Reference</h2>
<div class="outline-text-2" id="text-3">
<p>
<a id="org1a0307c"></a>
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>
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.
This subsystem is then referenced in other simulink models for various purposes (control, analysis, simulation, &#x2026;).
</p>
<div id="org18dcfb1" class="figure">
<p><img src="figs/simscape_stewart_platform.png" alt="simscape_stewart_platform.png" />
</p>
<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>
</div>
</div>
</div>
<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>
<div class="outline-text-2" id="text-4">
<p>
<a id="org5fac181"></a>
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>
<p>
As always, the parameters that define the geometry are taken from the <code>stewart</code> structure.
</p>
<div id="org7b43415" class="figure">
<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>
</div>
<div id="org7ed0d98" class="figure">
<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>
</div>
<div id="outline-container-orgbec2976" class="outline-2">
<h2 id="orgbec2976"><span class="section-number-2">5</span> Subsystem - Struts</h2>
<div class="outline-text-2" id="text-5">
<p>
<a id="org793a5c7"></a>
For the Stewart platform, the 6 struts are identical.
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>.
</p>
<p>
This strut has the following structure:
</p>
<ul class="org-ul">
<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>
</ul>
<p>
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>
<div id="org96a73eb" class="figure">
<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>
<div id="outline-container-org806ecc3" class="outline-2">
<h2 id="org806ecc3"><span class="section-number-2">6</span> Other Elements</h2>
<div class="outline-text-2" id="text-6">
</div>
<div id="outline-container-orgf4bef70" class="outline-3">
<h3 id="orgf4bef70"><span class="section-number-3">6.1</span> Payload</h3>
<div class="outline-text-3" id="text-6-1">
<p>
<a id="orgdd9802d"></a>
</p>
<p>
This Matlab function is accessible <a href="../src/initializePayload.m">here</a>.
</p>
</div>
<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">
<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>
<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">
<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>
<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">
<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>
</div>
<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">
<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-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>
<a id="org140423a"></a>
</p>
<p>
This Matlab function is accessible <a href="../src/initializeGround.m">here</a>.
</p>
</div>
<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">
<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>
<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">
<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">'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)
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<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">
<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-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">
<pre class="src src-matlab">ground.K = args.K;
ground.C = args.C;
</pre>
</div>
</div>
</div>
<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">
<pre class="src src-matlab">ground.rot_point = args.rot_point;
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="outline-container-org6d3b61e" class="outline-2">
<h2 id="org6d3b61e"><span class="section-number-2">7</span> Initialize Disturbances</h2>
<div class="outline-text-2" id="text-7">
<p>
<a id="org5c942ea"></a>
</p>
</div>
<div id="outline-container-orgf124972" class="outline-3">
<h3 id="orgf124972">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-orgf124972">
<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-org668f4bb" class="outline-3">
<h3 id="org668f4bb">Optional Parameters</h3>
<div class="outline-text-3" id="text-org668f4bb">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">arguments</span>
<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
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org0f7e4dd" class="outline-3">
<h3 id="org0f7e4dd">Structure initialization</h3>
<div class="outline-text-3" id="text-org0f7e4dd">
<div class="org-src-container">
<pre class="src src-matlab">disturbances = struct();
</pre>
</div>
</div>
</div>
<div id="outline-container-org1a28fcd" class="outline-3">
<h3 id="org1a28fcd">Ground Motion</h3>
<div class="outline-text-3" id="text-org1a28fcd">
<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-org90b72d6" class="outline-3">
<h3 id="org90b72d6">Direct Forces</h3>
<div class="outline-text-3" id="text-org90b72d6">
<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-org93f2d30" class="outline-2">
<h2 id="org93f2d30"><span class="section-number-2">8</span> Initialize References</h2>
<div class="outline-text-2" id="text-8">
<p>
<a id="orge24eeb5"></a>
</p>
</div>
<div id="outline-container-org81500bb" class="outline-3">
<h3 id="org81500bb">Function Declaration and Documentation</h3>
<div class="outline-text-3" id="text-org81500bb">
<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-org05322ee" class="outline-3">
<h3 id="org05322ee">Optional Parameters</h3>
<div class="outline-text-3" id="text-org05322ee">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">arguments</span>
<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)
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<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>
<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-orgda73a50" class="outline-3">
<h3 id="orgda73a50">References</h3>
<div class="outline-text-3" id="text-orgda73a50">
<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>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2021-01-08 ven. 15:52</p>
</div>
</body>
</html>