Re-run tomography experiments

This commit is contained in:
Thomas Dehaeze 2019-12-19 12:48:12 +01:00
parent 623d2d7a26
commit 994fe2ccc7
15 changed files with 682 additions and 263 deletions

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2019-12-17 mar. 18:01 -->
<!-- 2019-12-19 jeu. 12:47 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Tomography Experiment</title>
@ -258,33 +258,33 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org9876dd1">1. Simscape Model</a></li>
<li><a href="#orge5e5b16">2. Tomography Experiment with no disturbances</a>
<li><a href="#orgc1ba6cb">1. Simscape Model</a></li>
<li><a href="#orgf0c34e6">2. Tomography Experiment with no disturbances</a>
<ul>
<li><a href="#org5e4ce3d">2.1. Simulation Setup</a></li>
<li><a href="#org8ae8a5d">2.2. Analysis</a></li>
<li><a href="#orgc99de70">2.3. Conclusion</a></li>
<li><a href="#orge470384">2.1. Simulation Setup</a></li>
<li><a href="#orgf23b2a2">2.2. Analysis</a></li>
<li><a href="#orged24ea9">2.3. Conclusion</a></li>
</ul>
</li>
<li><a href="#org236226d">3. Tomography Experiment with included perturbations</a>
<li><a href="#orgbdf5d41">3. Tomography Experiment with included perturbations</a>
<ul>
<li><a href="#org8aa359d">3.1. Simulation Setup</a></li>
<li><a href="#orgd63048b">3.2. Analysis</a></li>
<li><a href="#org5328197">3.3. Conclusion</a></li>
<li><a href="#org896f3ab">3.1. Simulation Setup</a></li>
<li><a href="#org5021a67">3.2. Analysis</a></li>
<li><a href="#org449c206">3.3. Conclusion</a></li>
</ul>
</li>
<li><a href="#orgbcf3187">4. Tomography when the micro-hexapod is not centered</a>
<li><a href="#org76d45ac">4. Tomography when the micro-hexapod is not centered</a>
<ul>
<li><a href="#orgb8fc603">4.1. Simulation Setup</a></li>
<li><a href="#org22f9788">4.2. Analysis</a></li>
<li><a href="#orga8287ac">4.3. Conclusion</a></li>
<li><a href="#org9dfa994">4.1. Simulation Setup</a></li>
<li><a href="#org53a566e">4.2. Analysis</a></li>
<li><a href="#org626ad53">4.3. Conclusion</a></li>
</ul>
</li>
<li><a href="#org9e0e5be">5. Raster Scans with the translation stage</a>
<li><a href="#org7f867ad">5. Raster Scans with the translation stage</a>
<ul>
<li><a href="#org0b48fba">5.1. Simulation Setup</a></li>
<li><a href="#orge9df7a3">5.2. Analysis</a></li>
<li><a href="#orgbdb4d14">5.3. Conclusion</a></li>
<li><a href="#org957d49b">5.1. Simulation Setup</a></li>
<li><a href="#org7c493c6">5.2. Analysis</a></li>
<li><a href="#org6d754cb">5.3. Conclusion</a></li>
</ul>
</li>
</ul>
@ -308,18 +308,18 @@ This has several goals:
The document in organized as follow:
</p>
<ul class="org-ul">
<li>In section <a href="#orga91d1df">1</a> the Simscape model is initialized</li>
<li>In section <a href="#org1018b85">2</a> a tomography experiment is performed where the sample is aligned with the rotation axis. No disturbance is included</li>
<li>In section <a href="#org8c019e4">3</a>, the same is done but with disturbance included</li>
<li>In section <a href="#org395e7ec">4</a> the micro-hexapod translate the sample such that its center of mass is no longer aligned with the rotation axis. No disturbance is included</li>
<li>In section <a href="#orga1dc368">5</a>, scans with the translation stage are simulated with no perturbation included</li>
<li>In section <a href="#org62942ec">1</a> the Simscape model is initialized</li>
<li>In section <a href="#orgc810276">2</a> a tomography experiment is performed where the sample is aligned with the rotation axis. No disturbance is included</li>
<li>In section <a href="#org9cd3ace">3</a>, the same is done but with disturbance included</li>
<li>In section <a href="#orgc5d1986">4</a> the micro-hexapod translate the sample such that its center of mass is no longer aligned with the rotation axis. No disturbance is included</li>
<li>In section <a href="#org0e3c219">5</a>, scans with the translation stage are simulated with no perturbation included</li>
</ul>
<div id="outline-container-org9876dd1" class="outline-2">
<h2 id="org9876dd1"><span class="section-number-2">1</span> Simscape Model</h2>
<div id="outline-container-orgc1ba6cb" class="outline-2">
<h2 id="orgc1ba6cb"><span class="section-number-2">1</span> Simscape Model</h2>
<div class="outline-text-2" id="text-1">
<p>
<a id="orga91d1df"></a>
<a id="org62942ec"></a>
</p>
<p>
@ -367,15 +367,15 @@ All stage is set to its zero position except the Spindle which is rotating at 60
</div>
</div>
<div id="outline-container-orge5e5b16" class="outline-2">
<h2 id="orge5e5b16"><span class="section-number-2">2</span> Tomography Experiment with no disturbances</h2>
<div id="outline-container-orgf0c34e6" class="outline-2">
<h2 id="orgf0c34e6"><span class="section-number-2">2</span> Tomography Experiment with no disturbances</h2>
<div class="outline-text-2" id="text-2">
<p>
<a id="org1018b85"></a>
<a id="orgc810276"></a>
</p>
</div>
<div id="outline-container-org5e4ce3d" class="outline-3">
<h3 id="org5e4ce3d"><span class="section-number-3">2.1</span> Simulation Setup</h3>
<div id="outline-container-orge470384" class="outline-3">
<h3 id="orge470384"><span class="section-number-3">2.1</span> Simulation Setup</h3>
<div class="outline-text-3" id="text-2-1">
<p>
And we initialize the disturbances to be equal to zero.
@ -412,8 +412,8 @@ save<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string
</div>
</div>
<div id="outline-container-org8ae8a5d" class="outline-3">
<h3 id="org8ae8a5d"><span class="section-number-3">2.2</span> Analysis</h3>
<div id="outline-container-orgf23b2a2" class="outline-3">
<h3 id="orgf23b2a2"><span class="section-number-3">2.2</span> Analysis</h3>
<div class="outline-text-3" id="text-2-2">
<div class="org-src-container">
<pre class="src src-matlab">load<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'experiment_tomography/mat/experiment.mat'</span>, <span class="org-string">'tomo_align_no_dist'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
@ -434,14 +434,14 @@ Erz = atan2<span class="org-rainbow-delimiters-depth-1">(</span><span class="org
</div>
<div id="orgda4d10e" class="figure">
<div id="org5d578cf" class="figure">
<p><img src="figs/exp_tomo_without_dist_trans.png" alt="exp_tomo_without_dist_trans.png" />
</p>
<p><span class="figure-number">Figure 1: </span>X-Y-Z translation of the sample w.r.t. granite when performing tomography experiment with no disturbances (<a href="./figs/exp_tomo_without_dist_trans.png">png</a>, <a href="./figs/exp_tomo_without_dist_trans.pdf">pdf</a>)</p>
</div>
<div id="orgf194db1" class="figure">
<div id="org8a4881b" class="figure">
<p><img src="figs/exp_tomo_without_dist_rot.png" alt="exp_tomo_without_dist_rot.png" />
</p>
<p><span class="figure-number">Figure 2: </span>X-Y-Z rotations of the sample w.r.t. granite when performing tomography experiment with no disturbances (<a href="./figs/exp_tomo_without_dist_rot.png">png</a>, <a href="./figs/exp_tomo_without_dist_rot.pdf">pdf</a>)</p>
@ -449,8 +449,8 @@ Erz = atan2<span class="org-rainbow-delimiters-depth-1">(</span><span class="org
</div>
</div>
<div id="outline-container-orgc99de70" class="outline-3">
<h3 id="orgc99de70"><span class="section-number-3">2.3</span> Conclusion</h3>
<div id="outline-container-orged24ea9" class="outline-3">
<h3 id="orged24ea9"><span class="section-number-3">2.3</span> Conclusion</h3>
<div class="outline-text-3" id="text-2-3">
<div class="important">
<p>
@ -463,15 +463,15 @@ This residual error motion probably comes from a small misalignment somewhere.
</div>
</div>
<div id="outline-container-org236226d" class="outline-2">
<h2 id="org236226d"><span class="section-number-2">3</span> Tomography Experiment with included perturbations</h2>
<div id="outline-container-orgbdf5d41" class="outline-2">
<h2 id="orgbdf5d41"><span class="section-number-2">3</span> Tomography Experiment with included perturbations</h2>
<div class="outline-text-2" id="text-3">
<p>
<a id="org8c019e4"></a>
<a id="org9cd3ace"></a>
</p>
</div>
<div id="outline-container-org8aa359d" class="outline-3">
<h3 id="org8aa359d"><span class="section-number-3">3.1</span> Simulation Setup</h3>
<div id="outline-container-org896f3ab" class="outline-3">
<h3 id="org896f3ab"><span class="section-number-3">3.1</span> Simulation Setup</h3>
<div class="outline-text-3" id="text-3-1">
<p>
We now activate the disturbances.
@ -508,8 +508,8 @@ save<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string
</div>
</div>
<div id="outline-container-orgd63048b" class="outline-3">
<h3 id="orgd63048b"><span class="section-number-3">3.2</span> Analysis</h3>
<div id="outline-container-org5021a67" class="outline-3">
<h3 id="org5021a67"><span class="section-number-3">3.2</span> Analysis</h3>
<div class="outline-text-3" id="text-3-2">
<div class="org-src-container">
<pre class="src src-matlab">load<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'experiment_tomography/mat/experiment.mat'</span>, <span class="org-string">'tomo_align_dist'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
@ -530,14 +530,14 @@ Erz = atan2<span class="org-rainbow-delimiters-depth-1">(</span><span class="org
</div>
<div id="orge9cec44" class="figure">
<div id="orgfe30b96" class="figure">
<p><img src="figs/exp_tomo_dist_trans.png" alt="exp_tomo_dist_trans.png" />
</p>
<p><span class="figure-number">Figure 3: </span>X-Y-Z translation of the sample w.r.t. the granite when performing tomography experiment with disturbances (<a href="./figs/exp_tomo_dist_trans.png">png</a>, <a href="./figs/exp_tomo_dist_trans.pdf">pdf</a>)</p>
</div>
<div id="org98cbd3c" class="figure">
<div id="org36e30c6" class="figure">
<p><img src="figs/exp_tomo_dist_rot.png" alt="exp_tomo_dist_rot.png" />
</p>
<p><span class="figure-number">Figure 4: </span>X-Y-Z rotations of the sample w.r.t. the granite when performing tomography experiment with disturbances (<a href="./figs/exp_tomo_dist_rot.png">png</a>, <a href="./figs/exp_tomo_dist_rot.pdf">pdf</a>)</p>
@ -545,8 +545,8 @@ Erz = atan2<span class="org-rainbow-delimiters-depth-1">(</span><span class="org
</div>
</div>
<div id="outline-container-org5328197" class="outline-3">
<h3 id="org5328197"><span class="section-number-3">3.3</span> Conclusion</h3>
<div id="outline-container-org449c206" class="outline-3">
<h3 id="org449c206"><span class="section-number-3">3.3</span> Conclusion</h3>
<div class="outline-text-3" id="text-3-3">
<div class="important">
<p>
@ -558,15 +558,15 @@ Error motion is what expected from the disturbance measurements.
</div>
</div>
<div id="outline-container-orgbcf3187" class="outline-2">
<h2 id="orgbcf3187"><span class="section-number-2">4</span> Tomography when the micro-hexapod is not centered</h2>
<div id="outline-container-org76d45ac" class="outline-2">
<h2 id="org76d45ac"><span class="section-number-2">4</span> Tomography when the micro-hexapod is not centered</h2>
<div class="outline-text-2" id="text-4">
<p>
<a id="org395e7ec"></a>
<a id="orgc5d1986"></a>
</p>
</div>
<div id="outline-container-orgb8fc603" class="outline-3">
<h3 id="orgb8fc603"><span class="section-number-3">4.1</span> Simulation Setup</h3>
<div id="outline-container-org9dfa994" class="outline-3">
<h3 id="org9dfa994"><span class="section-number-3">4.1</span> Simulation Setup</h3>
<div class="outline-text-3" id="text-4-1">
<p>
We first set the wanted translation of the Micro Hexapod.
@ -627,8 +627,8 @@ save<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string
</div>
</div>
<div id="outline-container-org22f9788" class="outline-3">
<h3 id="org22f9788"><span class="section-number-3">4.2</span> Analysis</h3>
<div id="outline-container-org53a566e" class="outline-3">
<h3 id="org53a566e"><span class="section-number-3">4.2</span> Analysis</h3>
<div class="outline-text-3" id="text-4-2">
<div class="org-src-container">
<pre class="src src-matlab">load<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'experiment_tomography/mat/experiment.mat'</span>, <span class="org-string">'tomo_not_align'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
@ -649,14 +649,14 @@ Erz = atan2<span class="org-rainbow-delimiters-depth-1">(</span><span class="org
</div>
<div id="org7fb9a86" class="figure">
<div id="org3ef6891" class="figure">
<p><img src="figs/exp_tomo_offset_trans.png" alt="exp_tomo_offset_trans.png" />
</p>
<p><span class="figure-number">Figure 5: </span>X-Y-Z translation of the sample w.r.t. granite when performing tomography experiment with no disturbances (<a href="./figs/exp_tomo_offset_trans.png">png</a>, <a href="./figs/exp_tomo_offset_trans.pdf">pdf</a>)</p>
</div>
<div id="orgbe8a23e" class="figure">
<div id="org8a6932c" class="figure">
<p><img src="figs/exp_tomo_offset_rot.png" alt="exp_tomo_offset_rot.png" />
</p>
<p><span class="figure-number">Figure 6: </span>X-Y-Z rotations of the sample w.r.t. granite when performing tomography experiment with no disturbances (<a href="./figs/exp_tomo_offset_rot.png">png</a>, <a href="./figs/exp_tomo_offset_rot.pdf">pdf</a>)</p>
@ -664,8 +664,8 @@ Erz = atan2<span class="org-rainbow-delimiters-depth-1">(</span><span class="org
</div>
</div>
<div id="outline-container-orga8287ac" class="outline-3">
<h3 id="orga8287ac"><span class="section-number-3">4.3</span> Conclusion</h3>
<div id="outline-container-org626ad53" class="outline-3">
<h3 id="org626ad53"><span class="section-number-3">4.3</span> Conclusion</h3>
<div class="outline-text-3" id="text-4-3">
<div class="important">
<p>
@ -677,15 +677,15 @@ The main motions are translations in the X direction of the mobile platform (cor
</div>
</div>
<div id="outline-container-org9e0e5be" class="outline-2">
<h2 id="org9e0e5be"><span class="section-number-2">5</span> Raster Scans with the translation stage</h2>
<div id="outline-container-org7f867ad" class="outline-2">
<h2 id="org7f867ad"><span class="section-number-2">5</span> Raster Scans with the translation stage</h2>
<div class="outline-text-2" id="text-5">
<p>
<a id="orga1dc368"></a>
<a id="org0e3c219"></a>
</p>
</div>
<div id="outline-container-org0b48fba" class="outline-3">
<h3 id="org0b48fba"><span class="section-number-3">5.1</span> Simulation Setup</h3>
<div id="outline-container-org957d49b" class="outline-3">
<h3 id="org957d49b"><span class="section-number-3">5.1</span> Simulation Setup</h3>
<div class="outline-text-3" id="text-5-1">
<p>
We set the reference path.
@ -747,8 +747,8 @@ save<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string
</div>
</div>
<div id="outline-container-orge9df7a3" class="outline-3">
<h3 id="orge9df7a3"><span class="section-number-3">5.2</span> Analysis</h3>
<div id="outline-container-org7c493c6" class="outline-3">
<h3 id="org7c493c6"><span class="section-number-3">5.2</span> Analysis</h3>
<div class="outline-text-3" id="text-5-2">
<div class="org-src-container">
<pre class="src src-matlab">load<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'experiment_tomography/mat/experiment.mat'</span>, <span class="org-string">'ty_scan'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
@ -769,14 +769,14 @@ Erz = atan2<span class="org-rainbow-delimiters-depth-1">(</span><span class="org
</div>
<div id="org3533d00" class="figure">
<div id="org96b63df" class="figure">
<p><img src="figs/exp_ty_scan_trans.png" alt="exp_ty_scan_trans.png" />
</p>
<p><span class="figure-number">Figure 7: </span>X-Y-Z translation of the sample w.r.t. granite when performing tomography experiment with no disturbances (<a href="./figs/exp_ty_scan_trans.png">png</a>, <a href="./figs/exp_ty_scan_trans.pdf">pdf</a>)</p>
</div>
<div id="orgcf32c40" class="figure">
<div id="org4748377" class="figure">
<p><img src="figs/exp_ty_scan_rot.png" alt="exp_ty_scan_rot.png" />
</p>
<p><span class="figure-number">Figure 8: </span>X-Y-Z rotations of the sample w.r.t. granite when performing tomography experiment with no disturbances (<a href="./figs/exp_ty_scan_rot.png">png</a>, <a href="./figs/exp_ty_scan_rot.pdf">pdf</a>)</p>
@ -784,8 +784,8 @@ Erz = atan2<span class="org-rainbow-delimiters-depth-1">(</span><span class="org
</div>
</div>
<div id="outline-container-orgbdb4d14" class="outline-3">
<h3 id="orgbdb4d14"><span class="section-number-3">5.3</span> Conclusion</h3>
<div id="outline-container-org6d754cb" class="outline-3">
<h3 id="org6d754cb"><span class="section-number-3">5.3</span> Conclusion</h3>
<div class="outline-text-3" id="text-5-3">
<div class="important">
<p>
@ -800,7 +800,7 @@ In order to reduce the errors, we can make a smoother reference path for the tra
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2019-12-17 mar. 18:01</p>
<p class="date">Created: 2019-12-19 jeu. 12:47</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -25,7 +25,7 @@
#+PROPERTY: header-args:matlab+ :exports both
#+PROPERTY: header-args:matlab+ :eval no-export
#+PROPERTY: header-args:matlab+ :output-dir figs
#+PROPERTY: header-args:matlab+ :tangle matlab/modal_frf_coh.m
#+PROPERTY: header-args:matlab+ :tangle matlab/tomo_exp.m
#+PROPERTY: header-args:matlab+ :mkdirp yes
#+PROPERTY: header-args:shell :eval no-export
@ -166,7 +166,7 @@ And we save the obtained data.
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
xlim([2, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
@ -195,7 +195,7 @@ And we save the obtained data.
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
xlim([2, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
@ -277,7 +277,7 @@ And we save the obtained data.
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
xlim([2, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
@ -306,7 +306,7 @@ And we save the obtained data.
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
xlim([2, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
@ -402,7 +402,7 @@ And we save the obtained data.
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
xlim([2, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
@ -431,7 +431,7 @@ And we save the obtained data.
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
xlim([2, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
@ -531,7 +531,7 @@ And we save the obtained data.
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
xlim([2, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes
@ -560,7 +560,7 @@ And we save the obtained data.
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
xlim([2, inf]);
#+end_src
#+HEADER: :tangle no :exports results :results none :noweb yes

View File

@ -0,0 +1,412 @@
%% Clear Workspace and Close figures
clear; close all; clc;
%% Intialize Laplace variable
s = zpk('s');
% Simscape Model
% <<sec:simscape_model>>
% The simulink file to do tomography experiments is =sim_nano_station_tomo.slx=.
open('experiment_tomography/matlab/sim_nano_station_tomo.slx')
% We load the shared simulink configuration and we set the =StopTime=.
load('mat/conf_simscape.mat');
set_param(conf_simscape, 'StopTime', '5');
% We first initialize all the stages.
initializeGround();
initializeGranite();
initializeTy();
initializeRy();
initializeRz();
initializeMicroHexapod();
initializeAxisc();
initializeMirror();
initializeNanoHexapod(struct('actuator', 'piezo'));
initializeSample(struct('mass', 1));
% We initialize the reference path for all the stages.
% All stage is set to its zero position except the Spindle which is rotating at 60rpm.
initializeReferences(struct('Rz_type', 'rotating', 'Rz_period', 1));
% Simulation Setup
% And we initialize the disturbances to be equal to zero.
opts = struct(...
'Dwx', false, ... % Ground Motion - X direction
'Dwy', false, ... % Ground Motion - Y direction
'Dwz', false, ... % Ground Motion - Z direction
'Fty_x', false, ... % Translation Stage - X direction
'Fty_z', false, ... % Translation Stage - Z direction
'Frz_z', false ... % Spindle - Z direction
);
initDisturbances(opts);
% We simulate the model.
sim('sim_nano_station_tomo');
% And we save the obtained data.
tomo_align_no_dist = struct('t', t, 'MTr', MTr);
save('experiment_tomography/mat/experiment.mat', 'tomo_align_no_dist', '-append');
% Analysis
load('experiment_tomography/mat/experiment.mat', 'tomo_align_no_dist');
t = tomo_align_no_dist.t;
MTr = tomo_align_no_dist.MTr;
Edx = squeeze(MTr(1, 4, :));
Edy = squeeze(MTr(2, 4, :));
Edz = squeeze(MTr(3, 4, :));
% The angles obtained are u-v-w Euler angles (rotations in the moving frame)
Ery = atan2( squeeze(MTr(1, 3, :)), squeeze(sqrt(MTr(1, 1, :).^2 + MTr(1, 2, :).^2)));
Erx = atan2(-squeeze(MTr(2, 3, :))./cos(Ery), squeeze(MTr(3, 3, :))./cos(Ery));
Erz = atan2(-squeeze(MTr(1, 2, :))./cos(Ery), squeeze(MTr(1, 1, :))./cos(Ery));
figure;
ax1 = subplot(1, 3, 1);
plot(t, Edx, 'DisplayName', '$\epsilon_{x}$')
ylabel('Displacement [m]');
legend('location', 'northeast');
ax2 = subplot(1, 3, 2);
plot(t, Edy, 'DisplayName', '$\epsilon_{y}$')
xlabel('Time [s]');
legend('location', 'northeast');
ax3 = subplot(1, 3, 3);
plot(t, Edz, 'DisplayName', '$\epsilon_{z}$')
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
% #+NAME: fig:exp_tomo_without_dist_trans
% #+CAPTION: X-Y-Z translation of the sample w.r.t. granite when performing tomography experiment with no disturbances ([[./figs/exp_tomo_without_dist_trans.png][png]], [[./figs/exp_tomo_without_dist_trans.pdf][pdf]])
% [[file:figs/exp_tomo_without_dist_trans.png]]
figure;
ax1 = subplot(1, 3, 1);
plot(t, Erx, 'DisplayName', '$\epsilon_{\theta x}$')
ylabel('Rotation [rad]');
legend('location', 'northeast');
ax2 = subplot(1, 3, 2);
plot(t, Ery, 'DisplayName', '$\epsilon_{\theta y}$')
xlabel('Time [s]');
legend('location', 'northeast');
ax3 = subplot(1, 3, 3);
plot(t, Erz, 'DisplayName', '$\epsilon_{\theta z}$')
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
% Simulation Setup
% We now activate the disturbances.
opts = struct(...
'Dwx', true, ... % Ground Motion - X direction
'Dwy', true, ... % Ground Motion - Y direction
'Dwz', true, ... % Ground Motion - Z direction
'Fty_x', true, ... % Translation Stage - X direction
'Fty_z', true, ... % Translation Stage - Z direction
'Frz_z', true ... % Spindle - Z direction
);
initDisturbances(opts);
% We simulate the model.
sim('sim_nano_station_tomo');
% And we save the obtained data.
tomo_align_dist = struct('t', t, 'MTr', MTr);
save('experiment_tomography/mat/experiment.mat', 'tomo_align_dist', '-append');
% Analysis
load('experiment_tomography/mat/experiment.mat', 'tomo_align_dist');
t = tomo_align_dist.t;
MTr = tomo_align_dist.MTr;
Edx = squeeze(MTr(1, 4, :));
Edy = squeeze(MTr(2, 4, :));
Edz = squeeze(MTr(3, 4, :));
% The angles obtained are u-v-w Euler angles (rotations in the moving frame)
Ery = atan2( squeeze(MTr(1, 3, :)), squeeze(sqrt(MTr(1, 1, :).^2 + MTr(1, 2, :).^2)));
Erx = atan2(-squeeze(MTr(2, 3, :))./cos(Ery), squeeze(MTr(3, 3, :))./cos(Ery));
Erz = atan2(-squeeze(MTr(1, 2, :))./cos(Ery), squeeze(MTr(1, 1, :))./cos(Ery));
figure;
ax1 = subplot(1, 3, 1);
plot(t, Edx, 'DisplayName', '$\epsilon_{x}$')
ylabel('Displacement [m]');
legend('location', 'northeast');
ax2 = subplot(1, 3, 2);
plot(t, Edy, 'DisplayName', '$\epsilon_{y}$')
xlabel('Time [s]');
legend('location', 'northeast');
ax3 = subplot(1, 3, 3);
plot(t, Edz, 'DisplayName', '$\epsilon_{z}$')
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
% #+NAME: fig:exp_tomo_dist_trans
% #+CAPTION: X-Y-Z translation of the sample w.r.t. the granite when performing tomography experiment with disturbances ([[./figs/exp_tomo_dist_trans.png][png]], [[./figs/exp_tomo_dist_trans.pdf][pdf]])
% [[file:figs/exp_tomo_dist_trans.png]]
figure;
ax1 = subplot(1, 3, 1);
plot(t, Erx, 'DisplayName', '$\epsilon_{\theta x}$')
ylabel('Rotation [rad]');
legend('location', 'northeast');
ax2 = subplot(1, 3, 2);
plot(t, Ery, 'DisplayName', '$\epsilon_{\theta y}$')
xlabel('Time [s]');
legend('location', 'northeast');
ax3 = subplot(1, 3, 3);
plot(t, Erz, 'DisplayName', '$\epsilon_{\theta z}$')
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
% Simulation Setup
% We first set the wanted translation of the Micro Hexapod.
P_micro_hexapod = [0.01; 0; 0]; % [m]
% We initialize the reference path.
initializeReferences(struct('Dh_pos', [P_micro_hexapod; 0; 0; 0], 'Rz_type', 'rotating', 'Rz_period', 1));
% We initialize the stages.
initializeMicroHexapod(struct('AP', P_micro_hexapod));
% And we initialize the disturbances to zero.
opts = struct(...
'Dwx', false, ... % Ground Motion - X direction
'Dwy', false, ... % Ground Motion - Y direction
'Dwz', false, ... % Ground Motion - Z direction
'Fty_x', false, ... % Translation Stage - X direction
'Fty_z', false, ... % Translation Stage - Z direction
'Frz_z', false ... % Spindle - Z direction
);
initDisturbances(opts);
% We simulate the model.
sim('sim_nano_station_tomo');
% And we save the obtained data.
tomo_not_align = struct('t', t, 'MTr', MTr);
save('experiment_tomography/mat/experiment.mat', 'tomo_not_align', '-append');
% Analysis
load('experiment_tomography/mat/experiment.mat', 'tomo_not_align');
t = tomo_not_align.t;
MTr = tomo_not_align.MTr;
Edx = squeeze(MTr(1, 4, :));
Edy = squeeze(MTr(2, 4, :));
Edz = squeeze(MTr(3, 4, :));
% The angles obtained are u-v-w Euler angles (rotations in the moving frame)
Ery = atan2( squeeze(MTr(1, 3, :)), squeeze(sqrt(MTr(1, 1, :).^2 + MTr(1, 2, :).^2)));
Erx = atan2(-squeeze(MTr(2, 3, :))./cos(Ery), squeeze(MTr(3, 3, :))./cos(Ery));
Erz = atan2(-squeeze(MTr(1, 2, :))./cos(Ery), squeeze(MTr(1, 1, :))./cos(Ery));
figure;
ax1 = subplot(1, 3, 1);
plot(t, Edx, 'DisplayName', '$\epsilon_{x}$')
ylabel('Displacement [m]');
legend('location', 'northeast');
ax2 = subplot(1, 3, 2);
plot(t, Edy, 'DisplayName', '$\epsilon_{y}$')
xlabel('Time [s]');
legend('location', 'northeast');
ax3 = subplot(1, 3, 3);
plot(t, Edz, 'DisplayName', '$\epsilon_{z}$')
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
% #+NAME: fig:exp_tomo_offset_trans
% #+CAPTION: X-Y-Z translation of the sample w.r.t. granite when performing tomography experiment with no disturbances ([[./figs/exp_tomo_offset_trans.png][png]], [[./figs/exp_tomo_offset_trans.pdf][pdf]])
% [[file:figs/exp_tomo_offset_trans.png]]
figure;
ax1 = subplot(1, 3, 1);
plot(t, Erx, 'DisplayName', '$\epsilon_{\theta x}$')
ylabel('Rotation [rad]');
legend('location', 'northeast');
ax2 = subplot(1, 3, 2);
plot(t, Ery, 'DisplayName', '$\epsilon_{\theta y}$')
xlabel('Time [s]');
legend('location', 'northeast');
ax3 = subplot(1, 3, 3);
plot(t, Erz, 'DisplayName', '$\epsilon_{\theta z}$')
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
% Simulation Setup
% We set the reference path.
initializeReferences(struct('Dy_type', 'triangular', 'Dy_amplitude', 10e-3, 'Dy_period', 1));
% We initialize the stages.
initializeGround();
initializeGranite();
initializeTy();
initializeRy();
initializeRz();
initializeMicroHexapod();
initializeAxisc();
initializeMirror();
initializeNanoHexapod(struct('actuator', 'piezo'));
initializeSample(struct('mass', 1));
% And we initialize the disturbances to zero.
opts = struct(...
'Dwx', false, ... % Ground Motion - X direction
'Dwy', false, ... % Ground Motion - Y direction
'Dwz', false, ... % Ground Motion - Z direction
'Fty_x', false, ... % Translation Stage - X direction
'Fty_z', false, ... % Translation Stage - Z direction
'Frz_z', false ... % Spindle - Z direction
);
initDisturbances(opts);
% We simulate the model.
sim('sim_nano_station_tomo');
% And we save the obtained data.
ty_scan = struct('t', t, 'MTr', MTr);
save('experiment_tomography/mat/experiment.mat', 'ty_scan', '-append');
% Analysis
load('experiment_tomography/mat/experiment.mat', 'ty_scan');
t = ty_scan.t;
MTr = ty_scan.MTr;
Edx = squeeze(MTr(1, 4, :));
Edy = squeeze(MTr(2, 4, :));
Edz = squeeze(MTr(3, 4, :));
% The angles obtained are u-v-w Euler angles (rotations in the moving frame)
Ery = atan2( squeeze(MTr(1, 3, :)), squeeze(sqrt(MTr(1, 1, :).^2 + MTr(1, 2, :).^2)));
Erx = atan2(-squeeze(MTr(2, 3, :))./cos(Ery), squeeze(MTr(3, 3, :))./cos(Ery));
Erz = atan2(-squeeze(MTr(1, 2, :))./cos(Ery), squeeze(MTr(1, 1, :))./cos(Ery));
figure;
ax1 = subplot(1, 3, 1);
plot(t, Edx, 'DisplayName', '$\epsilon_{x}$')
ylabel('Displacement [m]');
legend('location', 'northeast');
ax2 = subplot(1, 3, 2);
plot(t, Edy, 'DisplayName', '$\epsilon_{y}$')
xlabel('Time [s]');
legend('location', 'northeast');
ax3 = subplot(1, 3, 3);
plot(t, Edz, 'DisplayName', '$\epsilon_{z}$')
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);
% #+NAME: fig:exp_ty_scan_trans
% #+CAPTION: X-Y-Z translation of the sample w.r.t. granite when performing tomography experiment with no disturbances ([[./figs/exp_ty_scan_trans.png][png]], [[./figs/exp_ty_scan_trans.pdf][pdf]])
% [[file:figs/exp_ty_scan_trans.png]]
figure;
ax1 = subplot(1, 3, 1);
plot(t, Erx, 'DisplayName', '$\epsilon_{\theta x}$')
ylabel('Rotation [rad]');
legend('location', 'northeast');
ax2 = subplot(1, 3, 2);
plot(t, Ery, 'DisplayName', '$\epsilon_{\theta y}$')
xlabel('Time [s]');
legend('location', 'northeast');
ax3 = subplot(1, 3, 3);
plot(t, Erz, 'DisplayName', '$\epsilon_{\theta z}$')
legend('location', 'northeast');
linkaxes([ax1,ax2,ax3],'x');
xlim([1, inf]);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -126,4 +126,4 @@ Fty_x = Fty_x - Fty_x(1);
Fty_z = Fty_z - Fty_z(1);
Frz_z = Frz_z - Frz_z(1);
save('./mat/nass_disturbances.mat', 'Dwx', 'Dwy', 'Dwz', 'Fty_x', 'Fty_z', 'Frz_z', 'Fd', 'Ts', 't');
save('mat/nass_disturbances.mat', 'Dwx', 'Dwy', 'Dwz', 'Fty_x', 'Fty_z', 'Frz_z', 'Fd', 'Ts', 't');

View File

@ -1,6 +1,10 @@
function [nano_hexapod] = initializeNanoHexapod(opts_param)
%% Default values for opts
opts = struct('actuator', 'piezo');
opts = struct(...
'actuator', 'piezo', ...
'AP', zeros(3, 1), ... % Wanted position in [m] of OB with respect to frame {A}
'ARB', eye(3) ... % Rotation Matrix that represent the wanted orientation of frame {B} with respect to frame {A}
);
%% Populate opts with input parameters
if exist('opts_param','var')
@ -13,7 +17,6 @@ function [nano_hexapod] = initializeNanoHexapod(opts_param)
nano_hexapod = struct();
nano_hexapod.h = 90; % Total height of the platform [mm]
nano_hexapod.jacobian = 175; % Point where the Jacobian is computed => Center of rotation [mm]
% nano_hexapod.jacobian = 174.26; % Point where the Jacobian is computed => Center of rotation [mm]
%% Bottom Plate
BP = struct();
@ -97,6 +100,9 @@ function [nano_hexapod] = initializeNanoHexapod(opts_param)
%%
nano_hexapod = initializeParameters(nano_hexapod);
%% Setup equilibrium position of each leg
nano_hexapod.L0 = inverseKinematicsHexapod(nano_hexapod, opts.AP, opts.ARB);
%% Save
save('./mat/stages.mat', 'nano_hexapod', '-append');

View File

@ -1,184 +1,185 @@
function [ref] = initializeReferences(opts_param)
%% Default values for opts
opts = struct( ...
'Ts', 1e-3, ... % Sampling Frequency [s]
'Tmax', 100, ... % Maximum simulation time [s]
'Dy_type', 'constant', ... % Either "constant" / "triangular" / "sinusoidal"
'Dy_amplitude', 0, ... % Amplitude of the displacement [m]
'Dy_period', 1, ... % Period of the displacement [s]
'Ry_type', 'constant', ... % Either "constant" / "triangular" / "sinusoidal"
'Ry_amplitude', 0, ... % Amplitude [rad]
'Ry_period', 1, ... % Period of the displacement [s]
'Rz_type', 'constant', ... % Either "constant" / "rotating"
'Rz_amplitude', 0, ... % Initial angle [rad]
'Rz_period', 1, ... % Period of the rotating [s]
'Dh_type', 'constant', ... % For now, only constant is implemented
'Dh_pos', zeros(6, 1), ... % Initial position [m,m,m,rad,rad,rad] of the top platform (Pitch-Roll-Yaw Euler angles)
'Rm_type', 'constant', ... % For now, only constant is implemented
'Rm_pos', [0; pi], ... % Initial position of the two masses
'Dn_type', 'constant', ... % For now, only constant is implemented
'Dn_pos', zeros(6,1) ... % Initial position [m,m,m,rad,rad,rad] of the top platform
);
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
%% Default values for opts
opts = struct( ...
'Ts', 1e-3, ... % Sampling Frequency [s]
'Tmax', 100, ... % Maximum simulation time [s]
'Dy_type', 'constant', ... % Either "constant" / "triangular" / "sinusoidal"
'Dy_amplitude', 0, ... % Amplitude of the displacement [m]
'Dy_period', 1, ... % Period of the displacement [s]
'Ry_type', 'constant', ... % Either "constant" / "triangular" / "sinusoidal"
'Ry_amplitude', 0, ... % Amplitude [rad]
'Ry_period', 1, ... % Period of the displacement [s]
'Rz_type', 'constant', ... % Either "constant" / "rotating"
'Rz_amplitude', 0, ... % Initial angle [rad]
'Rz_period', 1, ... % Period of the rotating [s]
'Dh_type', 'constant', ... % For now, only constant is implemented
'Dh_pos', zeros(6, 1), ... % Initial position [m,m,m,rad,rad,rad] of the top platform (Pitch-Roll-Yaw Euler angles)
'Rm_type', 'constant', ... % For now, only constant is implemented
'Rm_pos', [0; pi], ... % Initial position of the two masses
'Dn_type', 'constant', ... % For now, only constant is implemented
'Dn_pos', zeros(6,1) ... % Initial position [m,m,m,rad,rad,rad] of the top platform
);
%% Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
%% Set Sampling Time
Ts = opts.Ts;
Tmax = opts.Tmax;
%% Low Pass Filter to filter out the references
s = zpk('s');
w0 = 2*pi*100;
xi = 1;
H_lpf = 1/(1 + 2*xi/w0*s + s^2/w0^2);
%% Translation stage - Dy
t = 0:Ts:Tmax; % Time Vector [s]
Dy = zeros(length(t), 1);
Dyd = zeros(length(t), 1);
Dydd = zeros(length(t), 1);
switch opts.Dy_type
case 'constant'
Dy(:) = opts.Dy_amplitude;
Dyd(:) = 0;
Dydd(:) = 0;
case 'triangular'
% This is done to unsure that we start with no displacement
Dy_raw = opts.Dy_amplitude*sawtooth(2*pi*t/opts.Dy_period,1/2);
i0 = find(t>=opts.Dy_period/4,1);
Dy(1:end-i0+1) = Dy_raw(i0:end);
Dy(end-i0+2:end) = Dy_raw(end); % we fix the last value
% The signal is filtered out
Dy = lsim(H_lpf, Dy, t);
Dyd = lsim(H_lpf*s, Dy, t);
Dydd = lsim(H_lpf*s^2, Dy, t);
case 'sinusoidal'
Dy(:) = opts.Dy_amplitude*sin(2*pi/opts.Dy_period*t);
Dyd = opts.Dy_amplitude*2*pi/opts.Dy_period*cos(2*pi/opts.Dy_period*t);
Dydd = -opts.Dy_amplitude*(2*pi/opts.Dy_period)^2*sin(2*pi/opts.Dy_period*t);
otherwise
warning('Dy_type is not set correctly');
end
Dy = struct('time', t, 'signals', struct('values', Dy), 'deriv', Dyd, 'dderiv', Dydd);
%% Tilt Stage - Ry
t = 0:Ts:Tmax; % Time Vector [s]
Ry = zeros(length(t), 1);
Ryd = zeros(length(t), 1);
Rydd = zeros(length(t), 1);
switch opts.Ry_type
case 'constant'
Ry(:) = opts.Ry_amplitude;
Ryd(:) = 0;
Rydd(:) = 0;
case 'triangular'
Ry_raw = opts.Ry_amplitude*sawtooth(2*pi*t/opts.Ry_period,1/2);
i0 = find(t>=opts.Ry_period/4,1);
Ry(1:end-i0+1) = Ry_raw(i0:end);
Ry(end-i0+2:end) = Ry_raw(end); % we fix the last value
% The signal is filtered out
Ry = lsim(H_lpf, Ry, t);
Ryd = lsim(H_lpf*s, Ry, t);
Rydd = lsim(H_lpf*s^2, Ry, t);
case 'sinusoidal'
Ry(:) = opts.Ry_amplitude*sin(2*pi/opts.Ry_period*t);
Ryd = opts.Ry_amplitude*2*pi/opts.Ry_period*cos(2*pi/opts.Ry_period*t);
Rydd = -opts.Ry_amplitude*(2*pi/opts.Ry_period)^2*sin(2*pi/opts.Ry_period*t);
otherwise
warning('Ry_type is not set correctly');
end
Ry = struct('time', t, 'signals', struct('values', Ry), 'deriv', Ryd, 'dderiv', Rydd);
%% Spindle - Rz
t = 0:Ts:Tmax; % Time Vector [s]
Rz = zeros(length(t), 1);
Rzd = zeros(length(t), 1);
Rzdd = zeros(length(t), 1);
switch opts.Rz_type
case 'constant'
Rz(:) = opts.Rz_amplitude;
Rzd(:) = 0;
Rzdd(:) = 0;
case 'rotating'
Rz(:) = opts.Rz_amplitude+2*pi/opts.Rz_period*t;
% The signal is filtered out
Rz = lsim(H_lpf, Rz, t);
Rzd = lsim(H_lpf*s, Rz, t);
Rzdd = lsim(H_lpf*s^2, Rz, t);
otherwise
warning('Rz_type is not set correctly');
end
Rz = struct('time', t, 'signals', struct('values', Rz), 'deriv', Rzd, 'dderiv', Rzdd);
%% Micro-Hexapod
t = [0, Ts];
Dh = zeros(length(t), 6);
Dhl = zeros(length(t), 6);
switch opts.Dh_type
case 'constant'
Dh = [opts.Dh_pos, opts.Dh_pos];
load('./mat/stages.mat', 'micro_hexapod');
AP = [opts.Dh_pos(1) ; opts.Dh_pos(2) ; opts.Dh_pos(3)];
tx = opts.Dh_pos(4);
ty = opts.Dh_pos(5);
tz = opts.Dh_pos(6);
ARB = [cos(tz) -sin(tz) 0;
sin(tz) cos(tz) 0;
0 0 1]*...
[ cos(ty) 0 sin(ty);
0 1 0;
-sin(ty) 0 cos(ty)]*...
[1 0 0;
0 cos(tx) -sin(tx);
0 sin(tx) cos(tx)];
[Dhl] = inverseKinematicsHexapod(micro_hexapod, AP, ARB);
Dhl = [Dhl, Dhl];
otherwise
warning('Dh_type is not set correctly');
end
Dh = struct('time', t, 'signals', struct('values', Dh));
Dhl = struct('time', t, 'signals', struct('values', Dhl));
%% Axis Compensation - Rm
t = [0, Ts];
Rm = [opts.Rm_pos, opts.Rm_pos];
Rm = struct('time', t, 'signals', struct('values', Rm));
%% Nano-Hexapod
t = [0, Ts];
Dn = zeros(length(t), 6);
switch opts.Dn_type
case 'constant'
Dn = [opts.Dn_pos, opts.Dn_pos];
otherwise
warning('Dn_type is not set correctly');
end
Dn = struct('time', t, 'signals', struct('values', Dn));
%% Save
save('./mat/nass_references.mat', 'Dy', 'Ry', 'Rz', 'Dh', 'Dhl', 'Rm', 'Dn', 'Ts');
end
%% Set Sampling Time
Ts = opts.Ts;
Tmax = opts.Tmax;
%% Low Pass Filter to filter out the references
s = zpk('s');
w0 = 2*pi*100;
xi = 1;
H_lpf = 1/(1 + 2*xi/w0*s + s^2/w0^2);
%% Translation stage - Dy
t = 0:Ts:Tmax; % Time Vector [s]
Dy = zeros(length(t), 1);
Dyd = zeros(length(t), 1);
Dydd = zeros(length(t), 1);
switch opts.Dy_type
case 'constant'
Dy(:) = opts.Dy_amplitude;
Dyd(:) = 0;
Dydd(:) = 0;
case 'triangular'
% This is done to unsure that we start with no displacement
Dy_raw = opts.Dy_amplitude*sawtooth(2*pi*t/opts.Dy_period,1/2);
i0 = find(t>=opts.Dy_period/4,1);
Dy(1:end-i0+1) = Dy_raw(i0:end);
Dy(end-i0+2:end) = Dy_raw(end); % we fix the last value
% The signal is filtered out
Dy = lsim(H_lpf, Dy, t);
Dyd = lsim(H_lpf*s, Dy, t);
Dydd = lsim(H_lpf*s^2, Dy, t);
case 'sinusoidal'
Dy(:) = opts.Dy_amplitude*sin(2*pi/opts.Dy_period*t);
Dyd = opts.Dy_amplitude*2*pi/opts.Dy_period*cos(2*pi/opts.Dy_period*t);
Dydd = -opts.Dy_amplitude*(2*pi/opts.Dy_period)^2*sin(2*pi/opts.Dy_period*t);
otherwise
warning('Dy_type is not set correctly');
end
Dy = struct('time', t, 'signals', struct('values', Dy), 'deriv', Dyd, 'dderiv', Dydd);
%% Tilt Stage - Ry
t = 0:Ts:Tmax; % Time Vector [s]
Ry = zeros(length(t), 1);
Ryd = zeros(length(t), 1);
Rydd = zeros(length(t), 1);
switch opts.Ry_type
case 'constant'
Ry(:) = opts.Ry_amplitude;
Ryd(:) = 0;
Rydd(:) = 0;
case 'triangular'
Ry_raw = opts.Ry_amplitude*sawtooth(2*pi*t/opts.Ry_period,1/2);
i0 = find(t>=opts.Ry_period/4,1);
Ry(1:end-i0+1) = Ry_raw(i0:end);
Ry(end-i0+2:end) = Ry_raw(end); % we fix the last value
% The signal is filtered out
Ry = lsim(H_lpf, Ry, t);
Ryd = lsim(H_lpf*s, Ry, t);
Rydd = lsim(H_lpf*s^2, Ry, t);
case 'sinusoidal'
Ry(:) = opts.Ry_amplitude*sin(2*pi/opts.Ry_period*t);
Ryd = opts.Ry_amplitude*2*pi/opts.Ry_period*cos(2*pi/opts.Ry_period*t);
Rydd = -opts.Ry_amplitude*(2*pi/opts.Ry_period)^2*sin(2*pi/opts.Ry_period*t);
otherwise
warning('Ry_type is not set correctly');
end
Ry = struct('time', t, 'signals', struct('values', Ry), 'deriv', Ryd, 'dderiv', Rydd);
%% Spindle - Rz
t = 0:Ts:Tmax; % Time Vector [s]
Rz = zeros(length(t), 1);
Rzd = zeros(length(t), 1);
Rzdd = zeros(length(t), 1);
switch opts.Rz_type
case 'constant'
Rz(:) = opts.Rz_amplitude;
Rzd(:) = 0;
Rzdd(:) = 0;
case 'rotating'
Rz(:) = opts.Rz_amplitude+2*pi/opts.Rz_period*t;
% The signal is filtered out
Rz = lsim(H_lpf, Rz, t);
Rzd = lsim(H_lpf*s, Rz, t);
Rzdd = lsim(H_lpf*s^2, Rz, t);
otherwise
warning('Rz_type is not set correctly');
end
Rz = struct('time', t, 'signals', struct('values', Rz), 'deriv', Rzd, 'dderiv', Rzdd);
%% Micro-Hexapod
t = [0, Ts];
Dh = zeros(length(t), 6);
Dhl = zeros(length(t), 6);
switch opts.Dh_type
case 'constant'
Dh = [opts.Dh_pos, opts.Dh_pos];
load('mat/stages.mat', 'micro_hexapod');
AP = [opts.Dh_pos(1) ; opts.Dh_pos(2) ; opts.Dh_pos(3)];
tx = opts.Dh_pos(4);
ty = opts.Dh_pos(5);
tz = opts.Dh_pos(6);
ARB = [cos(tz) -sin(tz) 0;
sin(tz) cos(tz) 0;
0 0 1]*...
[ cos(ty) 0 sin(ty);
0 1 0;
-sin(ty) 0 cos(ty)]*...
[1 0 0;
0 cos(tx) -sin(tx);
0 sin(tx) cos(tx)];
[Dhl] = inverseKinematicsHexapod(micro_hexapod, AP, ARB);
Dhl = [Dhl, Dhl];
otherwise
warning('Dh_type is not set correctly');
end
Dh = struct('time', t, 'signals', struct('values', Dh));
Dhl = struct('time', t, 'signals', struct('values', Dhl));
%% Axis Compensation - Rm
t = [0, Ts];
Rm = [opts.Rm_pos, opts.Rm_pos];
Rm = struct('time', t, 'signals', struct('values', Rm));
%% Nano-Hexapod
t = [0, Ts];
Dn = zeros(length(t), 6);
switch opts.Dn_type
case 'constant'
Dn = [opts.Dn_pos, opts.Dn_pos];
otherwise
warning('Dn_type is not set correctly');
end
Dn = struct('time', t, 'signals', struct('values', Dn));
%% Save
save('mat/nass_references.mat', 'Dy', 'Ry', 'Rz', 'Dh', 'Dhl', 'Rm', 'Dn', 'Ts');
end