Rework - New simscape file

This commit is contained in:
Thomas Dehaeze 2020-02-13 15:19:30 +01:00
parent 2122ecbf74
commit fee3dd4ca3
2 changed files with 308 additions and 385 deletions

View File

@ -4,7 +4,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head> <head>
<!-- 2020-02-11 mar. 17:52 --> <!-- 2020-02-13 jeu. 15:19 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Stewart Platform - Dynamics Study</title> <title>Stewart Platform - Dynamics Study</title>
@ -268,51 +268,53 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2> <h2>Table of Contents</h2>
<div id="text-table-of-contents"> <div id="text-table-of-contents">
<ul> <ul>
<li><a href="#orgdae5fe1">1. Some tests</a> <li><a href="#orgc59e712">1. Compare external forces and forces applied by the actuators</a>
<ul> <ul>
<li><a href="#orga032902">1.1. Simscape Model</a></li> <li><a href="#org4509b7d">1.1. Comparison with fixed support</a></li>
<li><a href="#orgdbd3cde">1.2. test</a></li> <li><a href="#org8662186">1.2. Comparison with a flexible support</a></li>
<li><a href="#orgc59e712">1.3. Compare external forces and forces applied by the actuators</a></li> <li><a href="#orgb87f273">1.3. Conclusion</a></li>
<li><a href="#org81ab204">1.4. Comparison of the static transfer function and the Compliance matrix</a></li> </ul>
<li><a href="#orge663148">1.5. Transfer function from forces applied in the legs to the displacement of the legs</a></li> </li>
<li><a href="#org81ab204">2. Comparison of the static transfer function and the Compliance matrix</a>
<ul>
<li><a href="#orge7e7242">2.1. Analysis</a></li>
<li><a href="#org230655f">2.2. Conclusion</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<div id="outline-container-orgdae5fe1" class="outline-2"> <div id="outline-container-orgc59e712" class="outline-2">
<h2 id="orgdae5fe1"><span class="section-number-2">1</span> Some tests</h2> <h2 id="orgc59e712"><span class="section-number-2">1</span> Compare external forces and forces applied by the actuators</h2>
<div class="outline-text-2" id="text-1"> <div class="outline-text-2" id="text-1">
</div> </div>
<div id="outline-container-orga032902" class="outline-3"> <div id="outline-container-org4509b7d" class="outline-3">
<h3 id="orga032902"><span class="section-number-3">1.1</span> Simscape Model</h3> <h3 id="org4509b7d"><span class="section-number-3">1.1</span> Comparison with fixed support</h3>
<div class="outline-text-3" id="text-1-1"> <div class="outline-text-3" id="text-1-1">
<div class="org-src-container"> <div class="org-src-container">
<pre class="src src-matlab">open(<span class="org-string">'stewart_platform_dynamics.slx'</span>)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgdbd3cde" class="outline-3">
<h3 id="orgdbd3cde"><span class="section-number-3">1.2</span> test</h3>
<div class="outline-text-3" id="text-1-2">
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeStewartPlatform(); <pre class="src src-matlab">stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart); stewart = initializeFramesPositions(stewart, <span class="org-string">'H'</span>, 90e<span class="org-type">-</span>3, <span class="org-string">'MO_B'</span>, 45e<span class="org-type">-</span>3);
stewart = generateGeneralConfiguration(stewart); stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart); stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart); stewart = initializeStrutDynamics(stewart);
stewart = initializeJointDynamics(stewart, <span class="org-string">'type_F'</span>, <span class="org-string">'universal_p'</span>, <span class="org-string">'type_M'</span>, <span class="org-string">'spherical_p'</span>);
stewart = initializeCylindricalPlatforms(stewart); stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart); stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart); stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart); stewart = initializeStewartPose(stewart);
stewart = initializeInertialSensor(stewart, <span class="org-string">'type'</span>, <span class="org-string">'none'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">ground = initializeGround(<span class="org-string">'type'</span>, <span class="org-string">'none'</span>);
payload = initializePayload(<span class="org-string">'type'</span>, <span class="org-string">'none'</span>);
</pre> </pre>
</div> </div>
<p> <p>
Estimation of the transfer function from \(\mathcal{\bm{F}}\) to \(\mathcal{\bm{X}}\): Estimation of the transfer function from \(\bm{\tau}\) to \(\mathcal{\bm{X}}\):
</p> </p>
<div class="org-src-container"> <div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak"><span class="org-comment">%% Options for Linearized</span></span> <pre class="src src-matlab"><span class="org-matlab-cellbreak"><span class="org-comment">%% Options for Linearized</span></span>
@ -320,33 +322,12 @@ options = linearizeOptions;
options.SampleTime = 0; options.SampleTime = 0;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span>
mdl = <span class="org-string">'stewart_platform_dynamics'</span>; mdl = <span class="org-string">'stewart_platform_model'</span>;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
clear io; io_i = 1; clear io; io_i = 1;
io(io_i) = linio([mdl, <span class="org-string">'/F'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1; io(io_i) = linio([mdl, <span class="org-string">'/Controller'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1; <span class="org-comment">% Actuator Force Inputs [N]</span>
io(io_i) = linio([mdl, <span class="org-string">'/X'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1; io(io_i) = linio([mdl, <span class="org-string">'/Relative Motion Sensor'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1; <span class="org-comment">% Position/Orientation of {B} w.r.t. {A}</span>
<span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span>
G = linearize(mdl, io, options);
G.InputName = {<span class="org-string">'Fx'</span>, <span class="org-string">'Fy'</span>, <span class="org-string">'Fz'</span>, <span class="org-string">'Mx'</span>, <span class="org-string">'My'</span>, <span class="org-string">'Mz'</span>};
G.OutputName = {<span class="org-string">'Edx'</span>, <span class="org-string">'Edy'</span>, <span class="org-string">'Edz'</span>, <span class="org-string">'Erx'</span>, <span class="org-string">'Ery'</span>, <span class="org-string">'Erz'</span>};
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak"><span class="org-comment">%% Options for Linearized</span></span>
options = linearizeOptions;
options.SampleTime = 0;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span>
mdl = <span class="org-string">'stewart_platform_dynamics'</span>;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
clear io; io_i = 1;
io(io_i) = linio([mdl, <span class="org-string">'/J-T'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1;
io(io_i) = linio([mdl, <span class="org-string">'/X'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span>
G = linearize(mdl, io, options); G = linearize(mdl, io, options);
@ -356,28 +337,19 @@ G.OutputName = {<span class="org-string">'Edx'</span>, <span class="org-string">
</div> </div>
<div class="org-src-container"> <div class="org-src-container">
<pre class="src src-matlab">G_cart = minreal(G<span class="org-type">*</span>inv(stewart.J<span class="org-type">'</span>)); <pre class="src src-matlab">Gc = minreal(G<span class="org-type">*</span>inv(stewart.kinematics.J<span class="org-type">'</span>));
G_cart.InputName = {<span class="org-string">'Fnx'</span>, <span class="org-string">'Fny'</span>, <span class="org-string">'Fnz'</span>, <span class="org-string">'Mnx'</span>, <span class="org-string">'Mny'</span>, <span class="org-string">'Mnz'</span>}; Gc.InputName = {<span class="org-string">'Fnx'</span>, <span class="org-string">'Fny'</span>, <span class="org-string">'Fnz'</span>, <span class="org-string">'Mnx'</span>, <span class="org-string">'Mny'</span>, <span class="org-string">'Mnz'</span>};
</pre> </pre>
</div> </div>
<p>
Estimation of the transfer function from \(\bm{\mathcal{F}}_{\text{ext}}\) to \(\mathcal{\bm{X}}\):
</p>
<div class="org-src-container"> <div class="org-src-container">
<pre class="src src-matlab"><span class="org-type">figure</span>; bode(G, G_cart) <pre class="src src-matlab"><span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak"><span class="org-comment">%% Options for Linearized</span></span>
options = linearizeOptions;
options.SampleTime = 0;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span>
mdl = <span class="org-string">'stewart_platform_dynamics'</span>;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
clear io; io_i = 1; clear io; io_i = 1;
io(io_i) = linio([mdl, <span class="org-string">'/Fext'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1; io(io_i) = linio([mdl, <span class="org-string">'/Disturbances'</span>], 1, <span class="org-string">'openinput'</span>, [], <span class="org-string">'F_ext'</span>); io_i = io_i <span class="org-type">+</span> 1; <span class="org-comment">% External forces/torques applied on {B}</span>
io(io_i) = linio([mdl, <span class="org-string">'/X'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1; io(io_i) = linio([mdl, <span class="org-string">'/Relative Motion Sensor'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1; <span class="org-comment">% Position/Orientation of {B} w.r.t. {A}</span>
<span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span>
Gd = linearize(mdl, io, options); Gd = linearize(mdl, io, options);
@ -385,38 +357,22 @@ Gd.InputName = {<span class="org-string">'Fex'</span>, <span class="org-string"
Gd.OutputName = {<span class="org-string">'Edx'</span>, <span class="org-string">'Edy'</span>, <span class="org-string">'Edz'</span>, <span class="org-string">'Erx'</span>, <span class="org-string">'Ery'</span>, <span class="org-string">'Erz'</span>}; Gd.OutputName = {<span class="org-string">'Edx'</span>, <span class="org-string">'Edy'</span>, <span class="org-string">'Edz'</span>, <span class="org-string">'Erx'</span>, <span class="org-string">'Ery'</span>, <span class="org-string">'Erz'</span>};
</pre> </pre>
</div> </div>
<div class="org-src-container">
<pre class="src src-matlab">freqs = logspace(0, 3, 1000);
<span class="org-type">figure</span>;
bode(Gd, G)
</pre>
</div>
</div> </div>
</div> </div>
<div id="outline-container-orgc59e712" class="outline-3"> <div id="outline-container-org8662186" class="outline-3">
<h3 id="orgc59e712"><span class="section-number-3">1.3</span> Compare external forces and forces applied by the actuators</h3> <h3 id="org8662186"><span class="section-number-3">1.2</span> Comparison with a flexible support</h3>
<div class="outline-text-3" id="text-1-3"> <div class="outline-text-3" id="text-1-2">
<p> <p>
Initialization of the Stewart platform. We redo the identification for when the Stewart platform is on a flexible support.
</p> </p>
<div class="org-src-container"> <div class="org-src-container">
<pre class="src src-matlab">stewart = initializeStewartPlatform(); <pre class="src src-matlab">ground = initializeGround(<span class="org-string">'type'</span>, <span class="org-string">'flexible'</span>);
stewart = initializeFramesPositions(stewart);
stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart);
stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart);
</pre> </pre>
</div> </div>
<p> <p>
Estimation of the transfer function from \(\mathcal{\bm{F}}\) to \(\mathcal{\bm{X}}\): Estimation of the transfer function from \(\bm{\tau}\) to \(\mathcal{\bm{X}}\):
</p> </p>
<div class="org-src-container"> <div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak"><span class="org-comment">%% Options for Linearized</span></span> <pre class="src src-matlab"><span class="org-matlab-cellbreak"><span class="org-comment">%% Options for Linearized</span></span>
@ -424,35 +380,34 @@ options = linearizeOptions;
options.SampleTime = 0; options.SampleTime = 0;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span>
mdl = <span class="org-string">'stewart_platform_dynamics'</span>; mdl = <span class="org-string">'stewart_platform_model'</span>;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
clear io; io_i = 1; clear io; io_i = 1;
io(io_i) = linio([mdl, <span class="org-string">'/F'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1; io(io_i) = linio([mdl, <span class="org-string">'/Controller'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1; <span class="org-comment">% Actuator Force Inputs [N]</span>
io(io_i) = linio([mdl, <span class="org-string">'/X'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1; io(io_i) = linio([mdl, <span class="org-string">'/Relative Motion Sensor'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1; <span class="org-comment">% Position/Orientation of {B} w.r.t. {A}</span>
<span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span>
G = linearize(mdl, io, options); G = linearize(mdl, io, options);
G.InputName = {<span class="org-string">'Fx'</span>, <span class="org-string">'Fy'</span>, <span class="org-string">'Fz'</span>, <span class="org-string">'Mx'</span>, <span class="org-string">'My'</span>, <span class="org-string">'Mz'</span>}; G.InputName = {<span class="org-string">'F1'</span>, <span class="org-string">'F2'</span>, <span class="org-string">'F3'</span>, <span class="org-string">'F4'</span>, <span class="org-string">'F5'</span>, <span class="org-string">'F6'</span>};
G.OutputName = {<span class="org-string">'Edx'</span>, <span class="org-string">'Edy'</span>, <span class="org-string">'Edz'</span>, <span class="org-string">'Erx'</span>, <span class="org-string">'Ery'</span>, <span class="org-string">'Erz'</span>}; G.OutputName = {<span class="org-string">'Edx'</span>, <span class="org-string">'Edy'</span>, <span class="org-string">'Edz'</span>, <span class="org-string">'Erx'</span>, <span class="org-string">'Ery'</span>, <span class="org-string">'Erz'</span>};
</pre> </pre>
</div> </div>
<div class="org-src-container">
<pre class="src src-matlab">Gc = minreal(G<span class="org-type">*</span>inv(stewart.kinematics.J<span class="org-type">'</span>));
Gc.InputName = {<span class="org-string">'Fnx'</span>, <span class="org-string">'Fny'</span>, <span class="org-string">'Fnz'</span>, <span class="org-string">'Mnx'</span>, <span class="org-string">'Mny'</span>, <span class="org-string">'Mnz'</span>};
</pre>
</div>
<p> <p>
Estimation of the transfer function from \(\mathcal{\bm{F}}_{d}\) to \(\mathcal{\bm{X}}\): Estimation of the transfer function from \(\bm{\mathcal{F}}_{\text{ext}}\) to \(\mathcal{\bm{X}}\):
</p> </p>
<div class="org-src-container"> <div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak"><span class="org-comment">%% Options for Linearized</span></span> <pre class="src src-matlab"><span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
options = linearizeOptions;
options.SampleTime = 0;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span>
mdl = <span class="org-string">'stewart_platform_dynamics'</span>;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
clear io; io_i = 1; clear io; io_i = 1;
io(io_i) = linio([mdl, <span class="org-string">'/Fext'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1; io(io_i) = linio([mdl, <span class="org-string">'/Disturbances'</span>], 1, <span class="org-string">'openinput'</span>, [], <span class="org-string">'F_ext'</span>); io_i = io_i <span class="org-type">+</span> 1; <span class="org-comment">% External forces/torques applied on {B}</span>
io(io_i) = linio([mdl, <span class="org-string">'/X'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1; io(io_i) = linio([mdl, <span class="org-string">'/Relative Motion Sensor'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1; <span class="org-comment">% Position/Orientation of {B} w.r.t. {A}</span>
<span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span>
Gd = linearize(mdl, io, options); Gd = linearize(mdl, io, options);
@ -460,43 +415,50 @@ Gd.InputName = {<span class="org-string">'Fex'</span>, <span class="org-string"
Gd.OutputName = {<span class="org-string">'Edx'</span>, <span class="org-string">'Edy'</span>, <span class="org-string">'Edz'</span>, <span class="org-string">'Erx'</span>, <span class="org-string">'Ery'</span>, <span class="org-string">'Erz'</span>}; Gd.OutputName = {<span class="org-string">'Edx'</span>, <span class="org-string">'Edy'</span>, <span class="org-string">'Edz'</span>, <span class="org-string">'Erx'</span>, <span class="org-string">'Ery'</span>, <span class="org-string">'Erz'</span>};
</pre> </pre>
</div> </div>
</div>
<p>
Comparison of the two transfer function matrices.
</p>
<div class="org-src-container">
<pre class="src src-matlab">freqs = logspace(0, 4, 1000);
<span class="org-type">figure</span>;
bode(Gd, G, freqs)
</pre>
</div> </div>
<div id="outline-container-orgb87f273" class="outline-3">
<h3 id="orgb87f273"><span class="section-number-3">1.3</span> Conclusion</h3>
<div class="outline-text-3" id="text-1-3">
<div class="important"> <div class="important">
<p> <p>
Seems quite similar. The transfer function from forces/torques applied by the actuators on the payload \(\bm{\mathcal{F}} = \bm{J}^T \bm{\tau}\) to the pose of the mobile platform \(\bm{\mathcal{X}}\) is the same as the transfer function from external forces/torques to \(\bm{\mathcal{X}}\) as long as the Stewart platform&rsquo;s base is fixed.
</p> </p>
</div> </div>
</div> </div>
</div> </div>
</div>
<div id="outline-container-org81ab204" class="outline-3"> <div id="outline-container-org81ab204" class="outline-2">
<h3 id="org81ab204"><span class="section-number-3">1.4</span> Comparison of the static transfer function and the Compliance matrix</h3> <h2 id="org81ab204"><span class="section-number-2">2</span> Comparison of the static transfer function and the Compliance matrix</h2>
<div class="outline-text-3" id="text-1-4"> <div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-orge7e7242" class="outline-3">
<h3 id="orge7e7242"><span class="section-number-3">2.1</span> Analysis</h3>
<div class="outline-text-3" id="text-2-1">
<p> <p>
Initialization of the Stewart platform. Initialization of the Stewart platform.
</p> </p>
<div class="org-src-container"> <div class="org-src-container">
<pre class="src src-matlab">stewart = initializeStewartPlatform(); <pre class="src src-matlab">stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart); stewart = initializeFramesPositions(stewart, <span class="org-string">'H'</span>, 90e<span class="org-type">-</span>3, <span class="org-string">'MO_B'</span>, 45e<span class="org-type">-</span>3);
stewart = generateGeneralConfiguration(stewart); stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart); stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart); stewart = initializeStrutDynamics(stewart);
stewart = initializeJointDynamics(stewart, <span class="org-string">'type_F'</span>, <span class="org-string">'universal_p'</span>, <span class="org-string">'type_M'</span>, <span class="org-string">'spherical_p'</span>);
stewart = initializeCylindricalPlatforms(stewart); stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart); stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart); stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart); stewart = initializeStewartPose(stewart);
stewart = initializeInertialSensor(stewart, <span class="org-string">'type'</span>, <span class="org-string">'none'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">ground = initializeGround(<span class="org-string">'type'</span>, <span class="org-string">'none'</span>);
payload = initializePayload(<span class="org-string">'type'</span>, <span class="org-string">'none'</span>);
</pre> </pre>
</div> </div>
@ -509,20 +471,31 @@ options = linearizeOptions;
options.SampleTime = 0; options.SampleTime = 0;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span>
mdl = <span class="org-string">'stewart_platform_dynamics'</span>; mdl = <span class="org-string">'stewart_platform_model'</span>;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
clear io; io_i = 1; clear io; io_i = 1;
io(io_i) = linio([mdl, <span class="org-string">'/F'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1; io(io_i) = linio([mdl, <span class="org-string">'/F'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1;
io(io_i) = linio([mdl, <span class="org-string">'/X'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1; io(io_i) = linio([mdl, <span class="org-string">'/X'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
clear io; io_i = 1;
io(io_i) = linio([mdl, <span class="org-string">'/Controller'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1; <span class="org-comment">% Actuator Force Inputs [N]</span>
io(io_i) = linio([mdl, <span class="org-string">'/Relative Motion Sensor'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1; <span class="org-comment">% Position/Orientation of {B} w.r.t. {A}</span>
<span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span> <span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span>
G = linearize(mdl, io, options); G = linearize(mdl, io, options);
G.InputName = {<span class="org-string">'Fx'</span>, <span class="org-string">'Fy'</span>, <span class="org-string">'Fz'</span>, <span class="org-string">'Mx'</span>, <span class="org-string">'My'</span>, <span class="org-string">'Mz'</span>}; G.InputName = {<span class="org-string">'F1'</span>, <span class="org-string">'F2'</span>, <span class="org-string">'F3'</span>, <span class="org-string">'F4'</span>, <span class="org-string">'F5'</span>, <span class="org-string">'F6'</span>};
G.OutputName = {<span class="org-string">'Edx'</span>, <span class="org-string">'Edy'</span>, <span class="org-string">'Edz'</span>, <span class="org-string">'Erx'</span>, <span class="org-string">'Ery'</span>, <span class="org-string">'Erz'</span>}; G.OutputName = {<span class="org-string">'Edx'</span>, <span class="org-string">'Edy'</span>, <span class="org-string">'Edz'</span>, <span class="org-string">'Erx'</span>, <span class="org-string">'Ery'</span>, <span class="org-string">'Erz'</span>};
</pre> </pre>
</div> </div>
<div class="org-src-container">
<pre class="src src-matlab">Gc = minreal(G<span class="org-type">*</span>inv(stewart.kinematics.J<span class="org-type">'</span>));
Gc.InputName = {<span class="org-string">'Fnx'</span>, <span class="org-string">'Fny'</span>, <span class="org-string">'Fnz'</span>, <span class="org-string">'Mnx'</span>, <span class="org-string">'Mny'</span>, <span class="org-string">'Mnz'</span>};
</pre>
</div>
<p> <p>
Let&rsquo;s first look at the low frequency transfer function matrix from \(\mathcal{\bm{F}}\) to \(\mathcal{\bm{X}}\). Let&rsquo;s first look at the low frequency transfer function matrix from \(\mathcal{\bm{F}}\) to \(\mathcal{\bm{X}}\).
</p> </p>
@ -544,57 +517,57 @@ Let&rsquo;s first look at the low frequency transfer function matrix from \(\mat
</colgroup> </colgroup>
<tbody> <tbody>
<tr> <tr>
<td class="org-right">2.0e-06</td> <td class="org-right">4.7e-08</td>
<td class="org-right">-9.1e-19</td> <td class="org-right">-7.2e-19</td>
<td class="org-right">-5.3e-12</td> <td class="org-right">5.0e-18</td>
<td class="org-right">7.3e-18</td> <td class="org-right">-8.9e-18</td>
<td class="org-right">1.7e-05</td> <td class="org-right">3.2e-07</td>
<td class="org-right">1.3e-18</td> <td class="org-right">9.9e-18</td>
</tr> </tr>
<tr> <tr>
<td class="org-right">-1.7e-18</td> <td class="org-right">4.7e-18</td>
<td class="org-right">2.0e-06</td> <td class="org-right">4.7e-08</td>
<td class="org-right">8.6e-19</td> <td class="org-right">-5.7e-18</td>
<td class="org-right">-1.7e-05</td> <td class="org-right">-3.2e-07</td>
<td class="org-right">-1.5e-17</td> <td class="org-right">-1.6e-17</td>
<td class="org-right">6.7e-12</td> <td class="org-right">-1.7e-17</td>
</tr> </tr>
<tr> <tr>
<td class="org-right">3.6e-13</td> <td class="org-right">3.3e-18</td>
<td class="org-right">3.2e-19</td> <td class="org-right">-6.3e-18</td>
<td class="org-right">5.0e-07</td> <td class="org-right">2.1e-08</td>
<td class="org-right">-2.5e-18</td> <td class="org-right">4.4e-17</td>
<td class="org-right">8.1e-12</td> <td class="org-right">6.6e-18</td>
<td class="org-right">-1.5e-19</td> <td class="org-right">7.4e-18</td>
</tr> </tr>
<tr> <tr>
<td class="org-right">1.0e-17</td> <td class="org-right">-3.2e-17</td>
<td class="org-right">-1.7e-05</td> <td class="org-right">-3.2e-07</td>
<td class="org-right">-5.0e-18</td> <td class="org-right">6.2e-18</td>
<td class="org-right">1.9e-04</td> <td class="org-right">5.2e-06</td>
<td class="org-right">9.1e-17</td> <td class="org-right">-3.5e-16</td>
<td class="org-right">-3.5e-11</td> <td class="org-right">6.3e-17</td>
</tr> </tr>
<tr> <tr>
<td class="org-right">1.7e-05</td> <td class="org-right">3.2e-07</td>
<td class="org-right">-6.9e-19</td> <td class="org-right">2.7e-17</td>
<td class="org-right">-5.3e-11</td> <td class="org-right">4.8e-17</td>
<td class="org-right">6.9e-18</td> <td class="org-right">-4.5e-16</td>
<td class="org-right">1.9e-04</td> <td class="org-right">5.2e-06</td>
<td class="org-right">4.8e-18</td> <td class="org-right">-1.2e-19</td>
</tr> </tr>
<tr> <tr>
<td class="org-right">-3.5e-18</td> <td class="org-right">4.0e-17</td>
<td class="org-right">-4.5e-12</td> <td class="org-right">-9.5e-17</td>
<td class="org-right">1.5e-18</td> <td class="org-right">8.4e-18</td>
<td class="org-right">7.1e-11</td> <td class="org-right">4.3e-16</td>
<td class="org-right">-3.4e-17</td> <td class="org-right">5.8e-16</td>
<td class="org-right">4.6e-05</td> <td class="org-right">1.7e-06</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -620,121 +593,71 @@ And now at the Compliance matrix.
</colgroup> </colgroup>
<tbody> <tbody>
<tr> <tr>
<td class="org-right">2.0e-06</td> <td class="org-right">4.7e-08</td>
<td class="org-right">2.9e-22</td> <td class="org-right">-2.0e-24</td>
<td class="org-right">2.8e-22</td> <td class="org-right">7.4e-25</td>
<td class="org-right">-3.2e-21</td> <td class="org-right">5.9e-23</td>
<td class="org-right">1.7e-05</td> <td class="org-right">3.2e-07</td>
<td class="org-right">1.5e-37</td> <td class="org-right">5.9e-24</td>
</tr> </tr>
<tr> <tr>
<td class="org-right">-2.1e-22</td> <td class="org-right">-7.1e-25</td>
<td class="org-right">2.0e-06</td> <td class="org-right">4.7e-08</td>
<td class="org-right">-1.8e-23</td> <td class="org-right">2.9e-25</td>
<td class="org-right">-1.7e-05</td> <td class="org-right">-3.2e-07</td>
<td class="org-right">-2.3e-21</td> <td class="org-right">-5.4e-24</td>
<td class="org-right">1.1e-22</td> <td class="org-right">-3.3e-23</td>
</tr> </tr>
<tr> <tr>
<td class="org-right">3.1e-22</td> <td class="org-right">7.9e-26</td>
<td class="org-right">-1.6e-23</td> <td class="org-right">-6.4e-25</td>
<td class="org-right">5.0e-07</td> <td class="org-right">2.1e-08</td>
<td class="org-right">1.7e-22</td> <td class="org-right">1.9e-23</td>
<td class="org-right">2.2e-21</td> <td class="org-right">5.3e-25</td>
<td class="org-right">-8.1e-39</td> <td class="org-right">-6.5e-40</td>
</tr> </tr>
<tr> <tr>
<td class="org-right">2.1e-21</td> <td class="org-right">1.4e-23</td>
<td class="org-right">-1.7e-05</td> <td class="org-right">-3.2e-07</td>
<td class="org-right">2.0e-22</td> <td class="org-right">1.3e-23</td>
<td class="org-right">1.9e-04</td> <td class="org-right">5.2e-06</td>
<td class="org-right">2.3e-20</td> <td class="org-right">4.9e-22</td>
<td class="org-right">-8.7e-21</td> <td class="org-right">-3.8e-24</td>
</tr> </tr>
<tr> <tr>
<td class="org-right">1.7e-05</td> <td class="org-right">3.2e-07</td>
<td class="org-right">2.5e-21</td> <td class="org-right">7.6e-24</td>
<td class="org-right">2.0e-21</td> <td class="org-right">1.2e-23</td>
<td class="org-right">-2.8e-20</td> <td class="org-right">6.9e-22</td>
<td class="org-right">1.9e-04</td> <td class="org-right">5.2e-06</td>
<td class="org-right">1.3e-36</td> <td class="org-right">-2.6e-22</td>
</tr> </tr>
<tr> <tr>
<td class="org-right">3.7e-23</td> <td class="org-right">7.3e-24</td>
<td class="org-right">3.1e-22</td> <td class="org-right">-3.2e-23</td>
<td class="org-right">-6.0e-39</td> <td class="org-right">-1.6e-39</td>
<td class="org-right">-1.0e-20</td> <td class="org-right">9.9e-23</td>
<td class="org-right">3.1e-22</td> <td class="org-right">-3.3e-22</td>
<td class="org-right">4.6e-05</td> <td class="org-right">1.7e-06</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
</div>
<div id="outline-container-org230655f" class="outline-3">
<h3 id="org230655f"><span class="section-number-3">2.2</span> Conclusion</h3>
<div class="outline-text-3" id="text-2-2">
<div class="important"> <div class="important">
<p> <p>
The low frequency transfer function matrix from \(\mathcal{\bm{F}}\) to \(\mathcal{\bm{X}}\) corresponds to the compliance matrix of the Stewart platform. The low frequency transfer function matrix from \(\mathcal{\bm{F}}\) to \(\mathcal{\bm{X}}\) corresponds to the compliance matrix of the Stewart platform.
</p> </p>
</div>
</div>
</div>
<div id="outline-container-orge663148" class="outline-3">
<h3 id="orge663148"><span class="section-number-3">1.5</span> Transfer function from forces applied in the legs to the displacement of the legs</h3>
<div class="outline-text-3" id="text-1-5">
<p>
Initialization of the Stewart platform.
</p>
<div class="org-src-container">
<pre class="src src-matlab">stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart);
stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart);
stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart);
</pre>
</div>
<p>
Estimation of the transfer function from \(\bm{\tau}\) to \(\bm{L}\):
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak"><span class="org-comment">%% Options for Linearized</span></span>
options = linearizeOptions;
options.SampleTime = 0;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span>
mdl = <span class="org-string">'stewart_platform_dynamics'</span>;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
clear io; io_i = 1;
io(io_i) = linio([mdl, <span class="org-string">'/J-T'</span>], 1, <span class="org-string">'openinput'</span>); io_i = io_i <span class="org-type">+</span> 1;
io(io_i) = linio([mdl, <span class="org-string">'/L'</span>], 1, <span class="org-string">'openoutput'</span>); io_i = io_i <span class="org-type">+</span> 1;
<span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span>
G = linearize(mdl, io, options);
G.InputName = {<span class="org-string">'F1'</span>, <span class="org-string">'F2'</span>, <span class="org-string">'F3'</span>, <span class="org-string">'F4'</span>, <span class="org-string">'F5'</span>, <span class="org-string">'F6'</span>};
G.OutputName = {<span class="org-string">'L1'</span>, <span class="org-string">'L2'</span>, <span class="org-string">'L3'</span>, <span class="org-string">'L4'</span>, <span class="org-string">'L5'</span>, <span class="org-string">'L6'</span>};
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">freqs = logspace(1, 3, 1000);
<span class="org-type">figure</span>; bode(G, 2<span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>freqs)
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">bodeFig({G(1,1), G(1,2)}, freqs, struct(<span class="org-string">'phase'</span>, <span class="org-constant">true</span>));
</pre>
</div> </div>
</div> </div>
</div> </div>
@ -742,7 +665,7 @@ G.OutputName = {<span class="org-string">'L1'</span>, <span class="org-string">'
</div> </div>
<div id="postamble" class="status"> <div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p> <p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2020-02-11 mar. 17:52</p> <p class="date">Created: 2020-02-13 jeu. 15:19</p>
</div> </div>
</body> </body>
</html> </html>

View File

@ -38,8 +38,9 @@
#+PROPERTY: header-args:latex+ :post pdf2svg(file=*this*, ext="png") #+PROPERTY: header-args:latex+ :post pdf2svg(file=*this*, ext="png")
:END: :END:
* Some tests * Compare external forces and forces applied by the actuators
** Matlab Init :noexport:ignore: ** Introduction :ignore:
** Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
<<matlab-dir>> <<matlab-dir>>
#+end_src #+end_src
@ -52,57 +53,43 @@
simulinkproject('../'); simulinkproject('../');
#+end_src #+end_src
** Simscape Model
#+begin_src matlab #+begin_src matlab
open('stewart_platform_dynamics.slx') open('stewart_platform_model.slx')
#+end_src #+end_src
** test ** Comparison with fixed support
#+begin_src matlab #+begin_src matlab
stewart = initializeStewartPlatform(); stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart); stewart = initializeFramesPositions(stewart, 'H', 90e-3, 'MO_B', 45e-3);
stewart = generateGeneralConfiguration(stewart); stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart); stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart); stewart = initializeStrutDynamics(stewart);
stewart = initializeJointDynamics(stewart, 'type_F', 'universal_p', 'type_M', 'spherical_p');
stewart = initializeCylindricalPlatforms(stewart); stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart); stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart); stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart); stewart = initializeStewartPose(stewart);
stewart = initializeInertialSensor(stewart, 'type', 'none');
#+end_src #+end_src
Estimation of the transfer function from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}$: #+begin_src matlab
ground = initializeGround('type', 'none');
payload = initializePayload('type', 'none');
#+end_src
Estimation of the transfer function from $\bm{\tau}$ to $\mathcal{\bm{X}}$:
#+begin_src matlab #+begin_src matlab
%% Options for Linearized %% Options for Linearized
options = linearizeOptions; options = linearizeOptions;
options.SampleTime = 0; options.SampleTime = 0;
%% Name of the Simulink File %% Name of the Simulink File
mdl = 'stewart_platform_dynamics'; mdl = 'stewart_platform_model';
%% Input/Output definition %% Input/Output definition
clear io; io_i = 1; clear io; io_i = 1;
io(io_i) = linio([mdl, '/F'], 1, 'openinput'); io_i = io_i + 1; io(io_i) = linio([mdl, '/Controller'], 1, 'openinput'); io_i = io_i + 1; % Actuator Force Inputs [N]
io(io_i) = linio([mdl, '/X'], 1, 'openoutput'); io_i = io_i + 1; io(io_i) = linio([mdl, '/Relative Motion Sensor'], 1, 'openoutput'); io_i = io_i + 1; % Position/Orientation of {B} w.r.t. {A}
%% Run the linearization
G = linearize(mdl, io, options);
G.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'};
G.OutputName = {'Edx', 'Edy', 'Edz', 'Erx', 'Ery', 'Erz'};
#+end_src
#+begin_src matlab
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'stewart_platform_dynamics';
%% Input/Output definition
clear io; io_i = 1;
io(io_i) = linio([mdl, '/J-T'], 1, 'openinput'); io_i = io_i + 1;
io(io_i) = linio([mdl, '/X'], 1, 'openoutput'); io_i = io_i + 1;
%% Run the linearization %% Run the linearization
G = linearize(mdl, io, options); G = linearize(mdl, io, options);
@ -111,26 +98,16 @@ Estimation of the transfer function from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}
#+end_src #+end_src
#+begin_src matlab #+begin_src matlab
G_cart = minreal(G*inv(stewart.J')); Gc = minreal(G*inv(stewart.kinematics.J'));
G_cart.InputName = {'Fnx', 'Fny', 'Fnz', 'Mnx', 'Mny', 'Mnz'}; Gc.InputName = {'Fnx', 'Fny', 'Fnz', 'Mnx', 'Mny', 'Mnz'};
#+end_src #+end_src
Estimation of the transfer function from $\bm{\mathcal{F}}_{\text{ext}}$ to $\mathcal{\bm{X}}$:
#+begin_src matlab #+begin_src matlab
figure; bode(G, G_cart)
#+end_src
#+begin_src matlab
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'stewart_platform_dynamics';
%% Input/Output definition %% Input/Output definition
clear io; io_i = 1; clear io; io_i = 1;
io(io_i) = linio([mdl, '/Fext'], 1, 'openinput'); io_i = io_i + 1; io(io_i) = linio([mdl, '/Disturbances'], 1, 'openinput', [], 'F_ext'); io_i = io_i + 1; % External forces/torques applied on {B}
io(io_i) = linio([mdl, '/X'], 1, 'openoutput'); io_i = io_i + 1; io(io_i) = linio([mdl, '/Relative Motion Sensor'], 1, 'openoutput'); io_i = io_i + 1; % Position/Orientation of {B} w.r.t. {A}
%% Run the linearization %% Run the linearization
Gd = linearize(mdl, io, options); Gd = linearize(mdl, io, options);
@ -138,60 +115,70 @@ Estimation of the transfer function from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}
Gd.OutputName = {'Edx', 'Edy', 'Edz', 'Erx', 'Ery', 'Erz'}; Gd.OutputName = {'Edx', 'Edy', 'Edz', 'Erx', 'Ery', 'Erz'};
#+end_src #+end_src
#+begin_src matlab #+begin_src matlab :exports none
freqs = logspace(0, 3, 1000); freqs = logspace(1, 4, 1000);
figure; figure;
bode(Gd, G)
ax1 = subplot(2, 1, 1);
hold on;
plot(freqs, abs(squeeze(freqresp(Gc(1,1), freqs, 'Hz'))), '-');
plot(freqs, abs(squeeze(freqresp(Gd(1,1), freqs, 'Hz'))), '--');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Amplitude [N/N]'); set(gca, 'XTickLabel',[]);
ax2 = subplot(2, 1, 2);
hold on;
plot(freqs, 180/pi*angle(squeeze(freqresp(Gc(1,1), freqs, 'Hz'))), '-');
plot(freqs, 180/pi*angle(squeeze(freqresp(Gd(1,1), freqs, 'Hz'))), '--');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
ylabel('Phase [deg]'); xlabel('Frequency [Hz]');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
linkaxes([ax1,ax2],'x');
#+end_src #+end_src
** Compare external forces and forces applied by the actuators
Initialization of the Stewart platform. ** Comparison with a flexible support
We redo the identification for when the Stewart platform is on a flexible support.
#+begin_src matlab #+begin_src matlab
stewart = initializeStewartPlatform(); ground = initializeGround('type', 'flexible');
stewart = initializeFramesPositions(stewart);
stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart);
stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart);
#+end_src #+end_src
Estimation of the transfer function from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}$: Estimation of the transfer function from $\bm{\tau}$ to $\mathcal{\bm{X}}$:
#+begin_src matlab #+begin_src matlab
%% Options for Linearized %% Options for Linearized
options = linearizeOptions; options = linearizeOptions;
options.SampleTime = 0; options.SampleTime = 0;
%% Name of the Simulink File %% Name of the Simulink File
mdl = 'stewart_platform_dynamics'; mdl = 'stewart_platform_model';
%% Input/Output definition %% Input/Output definition
clear io; io_i = 1; clear io; io_i = 1;
io(io_i) = linio([mdl, '/F'], 1, 'openinput'); io_i = io_i + 1; io(io_i) = linio([mdl, '/Controller'], 1, 'openinput'); io_i = io_i + 1; % Actuator Force Inputs [N]
io(io_i) = linio([mdl, '/X'], 1, 'openoutput'); io_i = io_i + 1; io(io_i) = linio([mdl, '/Relative Motion Sensor'], 1, 'openoutput'); io_i = io_i + 1; % Position/Orientation of {B} w.r.t. {A}
%% Run the linearization %% Run the linearization
G = linearize(mdl, io, options); G = linearize(mdl, io, options);
G.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'}; G.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
G.OutputName = {'Edx', 'Edy', 'Edz', 'Erx', 'Ery', 'Erz'}; G.OutputName = {'Edx', 'Edy', 'Edz', 'Erx', 'Ery', 'Erz'};
#+end_src #+end_src
Estimation of the transfer function from $\mathcal{\bm{F}}_{d}$ to $\mathcal{\bm{X}}$:
#+begin_src matlab #+begin_src matlab
%% Options for Linearized Gc = minreal(G*inv(stewart.kinematics.J'));
options = linearizeOptions; Gc.InputName = {'Fnx', 'Fny', 'Fnz', 'Mnx', 'Mny', 'Mnz'};
options.SampleTime = 0; #+end_src
%% Name of the Simulink File
mdl = 'stewart_platform_dynamics';
Estimation of the transfer function from $\bm{\mathcal{F}}_{\text{ext}}$ to $\mathcal{\bm{X}}$:
#+begin_src matlab
%% Input/Output definition %% Input/Output definition
clear io; io_i = 1; clear io; io_i = 1;
io(io_i) = linio([mdl, '/Fext'], 1, 'openinput'); io_i = io_i + 1; io(io_i) = linio([mdl, '/Disturbances'], 1, 'openinput', [], 'F_ext'); io_i = io_i + 1; % External forces/torques applied on {B}
io(io_i) = linio([mdl, '/X'], 1, 'openoutput'); io_i = io_i + 1; io(io_i) = linio([mdl, '/Relative Motion Sensor'], 1, 'openoutput'); io_i = io_i + 1; % Position/Orientation of {B} w.r.t. {A}
%% Run the linearization %% Run the linearization
Gd = linearize(mdl, io, options); Gd = linearize(mdl, io, options);
@ -199,30 +186,75 @@ Estimation of the transfer function from $\mathcal{\bm{F}}_{d}$ to $\mathcal{\bm
Gd.OutputName = {'Edx', 'Edy', 'Edz', 'Erx', 'Ery', 'Erz'}; Gd.OutputName = {'Edx', 'Edy', 'Edz', 'Erx', 'Ery', 'Erz'};
#+end_src #+end_src
Comparison of the two transfer function matrices. #+begin_src matlab :exports none
#+begin_src matlab freqs = logspace(1, 4, 1000);
freqs = logspace(0, 4, 1000);
figure; figure;
bode(Gd, G, freqs)
ax1 = subplot(2, 1, 1);
hold on;
plot(freqs, abs(squeeze(freqresp(Gc(1,1), freqs, 'Hz'))), '-');
plot(freqs, abs(squeeze(freqresp(Gd(1,1), freqs, 'Hz'))), '--');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Amplitude [N/N]'); set(gca, 'XTickLabel',[]);
ax2 = subplot(2, 1, 2);
hold on;
plot(freqs, 180/pi*angle(squeeze(freqresp(Gc(1,1), freqs, 'Hz'))), '-');
plot(freqs, 180/pi*angle(squeeze(freqresp(Gd(1,1), freqs, 'Hz'))), '--');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
ylabel('Phase [deg]'); xlabel('Frequency [Hz]');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
linkaxes([ax1,ax2],'x');
#+end_src #+end_src
** Conclusion
#+begin_important #+begin_important
Seems quite similar. The transfer function from forces/torques applied by the actuators on the payload $\bm{\mathcal{F}} = \bm{J}^T \bm{\tau}$ to the pose of the mobile platform $\bm{\mathcal{X}}$ is the same as the transfer function from external forces/torques to $\bm{\mathcal{X}}$ as long as the Stewart platform's base is fixed.
#+end_important #+end_important
** Comparison of the static transfer function and the Compliance matrix * Comparison of the static transfer function and the Compliance matrix
** Introduction :ignore:
** Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
<<matlab-dir>>
#+end_src
#+begin_src matlab :exports none :results silent :noweb yes
<<matlab-init>>
#+end_src
#+begin_src matlab
simulinkproject('../');
#+end_src
#+begin_src matlab
open('stewart_platform_model.slx')
#+end_src
** Analysis
Initialization of the Stewart platform. Initialization of the Stewart platform.
#+begin_src matlab #+begin_src matlab
stewart = initializeStewartPlatform(); stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart); stewart = initializeFramesPositions(stewart, 'H', 90e-3, 'MO_B', 45e-3);
stewart = generateGeneralConfiguration(stewart); stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart); stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart); stewart = initializeStrutDynamics(stewart);
stewart = initializeJointDynamics(stewart, 'type_F', 'universal_p', 'type_M', 'spherical_p');
stewart = initializeCylindricalPlatforms(stewart); stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart); stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart); stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart); stewart = initializeStewartPose(stewart);
stewart = initializeInertialSensor(stewart, 'type', 'none');
#+end_src
#+begin_src matlab
ground = initializeGround('type', 'none');
payload = initializePayload('type', 'none');
#+end_src #+end_src
Estimation of the transfer function from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}$: Estimation of the transfer function from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}$:
@ -232,88 +264,56 @@ Estimation of the transfer function from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}
options.SampleTime = 0; options.SampleTime = 0;
%% Name of the Simulink File %% Name of the Simulink File
mdl = 'stewart_platform_dynamics'; mdl = 'stewart_platform_model';
%% Input/Output definition %% Input/Output definition
clear io; io_i = 1; clear io; io_i = 1;
io(io_i) = linio([mdl, '/F'], 1, 'openinput'); io_i = io_i + 1; io(io_i) = linio([mdl, '/F'], 1, 'openinput'); io_i = io_i + 1;
io(io_i) = linio([mdl, '/X'], 1, 'openoutput'); io_i = io_i + 1; io(io_i) = linio([mdl, '/X'], 1, 'openoutput'); io_i = io_i + 1;
%% Input/Output definition
clear io; io_i = 1;
io(io_i) = linio([mdl, '/Controller'], 1, 'openinput'); io_i = io_i + 1; % Actuator Force Inputs [N]
io(io_i) = linio([mdl, '/Relative Motion Sensor'], 1, 'openoutput'); io_i = io_i + 1; % Position/Orientation of {B} w.r.t. {A}
%% Run the linearization %% Run the linearization
G = linearize(mdl, io, options); G = linearize(mdl, io, options);
G.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'}; G.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
G.OutputName = {'Edx', 'Edy', 'Edz', 'Erx', 'Ery', 'Erz'}; G.OutputName = {'Edx', 'Edy', 'Edz', 'Erx', 'Ery', 'Erz'};
#+end_src #+end_src
#+begin_src matlab
Gc = minreal(G*inv(stewart.kinematics.J'));
Gc.InputName = {'Fnx', 'Fny', 'Fnz', 'Mnx', 'Mny', 'Mnz'};
#+end_src
Let's first look at the low frequency transfer function matrix from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}$. Let's first look at the low frequency transfer function matrix from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}$.
#+begin_src matlab :exports results :results value table replace :tangle no #+begin_src matlab :exports results :results value table replace :tangle no
data2orgtable(real(freqresp(G, 0.1)), {}, {}, ' %.1e '); data2orgtable(real(freqresp(Gd, 0.1)), {}, {}, ' %.1e ');
#+end_src #+end_src
#+RESULTS: #+RESULTS:
| 2.0e-06 | -9.1e-19 | -5.3e-12 | 7.3e-18 | 1.7e-05 | 1.3e-18 | | 4.7e-08 | -7.2e-19 | 5.0e-18 | -8.9e-18 | 3.2e-07 | 9.9e-18 |
| -1.7e-18 | 2.0e-06 | 8.6e-19 | -1.7e-05 | -1.5e-17 | 6.7e-12 | | 4.7e-18 | 4.7e-08 | -5.7e-18 | -3.2e-07 | -1.6e-17 | -1.7e-17 |
| 3.6e-13 | 3.2e-19 | 5.0e-07 | -2.5e-18 | 8.1e-12 | -1.5e-19 | | 3.3e-18 | -6.3e-18 | 2.1e-08 | 4.4e-17 | 6.6e-18 | 7.4e-18 |
| 1.0e-17 | -1.7e-05 | -5.0e-18 | 1.9e-04 | 9.1e-17 | -3.5e-11 | | -3.2e-17 | -3.2e-07 | 6.2e-18 | 5.2e-06 | -3.5e-16 | 6.3e-17 |
| 1.7e-05 | -6.9e-19 | -5.3e-11 | 6.9e-18 | 1.9e-04 | 4.8e-18 | | 3.2e-07 | 2.7e-17 | 4.8e-17 | -4.5e-16 | 5.2e-06 | -1.2e-19 |
| -3.5e-18 | -4.5e-12 | 1.5e-18 | 7.1e-11 | -3.4e-17 | 4.6e-05 | | 4.0e-17 | -9.5e-17 | 8.4e-18 | 4.3e-16 | 5.8e-16 | 1.7e-06 |
And now at the Compliance matrix. And now at the Compliance matrix.
#+begin_src matlab :exports results :results value table replace :tangle no #+begin_src matlab :exports results :results value table replace :tangle no
data2orgtable(stewart.C, {}, {}, ' %.1e '); data2orgtable(stewart.kinematics.C, {}, {}, ' %.1e ');
#+end_src #+end_src
#+RESULTS: #+RESULTS:
| 2.0e-06 | 2.9e-22 | 2.8e-22 | -3.2e-21 | 1.7e-05 | 1.5e-37 | | 4.7e-08 | -2.0e-24 | 7.4e-25 | 5.9e-23 | 3.2e-07 | 5.9e-24 |
| -2.1e-22 | 2.0e-06 | -1.8e-23 | -1.7e-05 | -2.3e-21 | 1.1e-22 | | -7.1e-25 | 4.7e-08 | 2.9e-25 | -3.2e-07 | -5.4e-24 | -3.3e-23 |
| 3.1e-22 | -1.6e-23 | 5.0e-07 | 1.7e-22 | 2.2e-21 | -8.1e-39 | | 7.9e-26 | -6.4e-25 | 2.1e-08 | 1.9e-23 | 5.3e-25 | -6.5e-40 |
| 2.1e-21 | -1.7e-05 | 2.0e-22 | 1.9e-04 | 2.3e-20 | -8.7e-21 | | 1.4e-23 | -3.2e-07 | 1.3e-23 | 5.2e-06 | 4.9e-22 | -3.8e-24 |
| 1.7e-05 | 2.5e-21 | 2.0e-21 | -2.8e-20 | 1.9e-04 | 1.3e-36 | | 3.2e-07 | 7.6e-24 | 1.2e-23 | 6.9e-22 | 5.2e-06 | -2.6e-22 |
| 3.7e-23 | 3.1e-22 | -6.0e-39 | -1.0e-20 | 3.1e-22 | 4.6e-05 | | 7.3e-24 | -3.2e-23 | -1.6e-39 | 9.9e-23 | -3.3e-22 | 1.7e-06 |
** Conclusion
#+begin_important #+begin_important
The low frequency transfer function matrix from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}$ corresponds to the compliance matrix of the Stewart platform. The low frequency transfer function matrix from $\mathcal{\bm{F}}$ to $\mathcal{\bm{X}}$ corresponds to the compliance matrix of the Stewart platform.
#+end_important #+end_important
** Transfer function from forces applied in the legs to the displacement of the legs
Initialization of the Stewart platform.
#+begin_src matlab
stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart);
stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart);
stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart);
#+end_src
Estimation of the transfer function from $\bm{\tau}$ to $\bm{L}$:
#+begin_src matlab
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'stewart_platform_dynamics';
%% Input/Output definition
clear io; io_i = 1;
io(io_i) = linio([mdl, '/J-T'], 1, 'openinput'); io_i = io_i + 1;
io(io_i) = linio([mdl, '/L'], 1, 'openoutput'); io_i = io_i + 1;
%% Run the linearization
G = linearize(mdl, io, options);
G.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
G.OutputName = {'L1', 'L2', 'L3', 'L4', 'L5', 'L6'};
#+end_src
#+begin_src matlab
freqs = logspace(1, 3, 1000);
figure; bode(G, 2*pi*freqs)
#+end_src
#+begin_src matlab
bodeFig({G(1,1), G(1,2)}, freqs, struct('phase', true));
#+end_src