Move the computeReferencePose function
This commit is contained in:
parent
021965a2b4
commit
9d3e584930
@ -3,7 +3,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>
|
||||||
<!-- 2019-11-22 ven. 15:42 -->
|
<!-- 2019-12-11 mer. 17: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>Identification of the disturbances</title>
|
<title>Identification of the disturbances</title>
|
||||||
@ -262,7 +262,10 @@ for the JavaScript code in this tag.
|
|||||||
TeX: { equationNumbers: {autoNumber: "AMS"},
|
TeX: { equationNumbers: {autoNumber: "AMS"},
|
||||||
MultLineWidth: "85%",
|
MultLineWidth: "85%",
|
||||||
TagSide: "right",
|
TagSide: "right",
|
||||||
TagIndent: ".8em"
|
TagIndent: ".8em",
|
||||||
|
Macros: {
|
||||||
|
bm: ["{\\boldsymbol #1}",1],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -280,13 +283,14 @@ 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="#org018a052">1. Identification</a></li>
|
<li><a href="#org764c7a5">1. Identification</a></li>
|
||||||
<li><a href="#orgf53a747">2. Sensitivity to Disturbances</a></li>
|
<li><a href="#orgb1acef0">2. Sensitivity to Disturbances</a></li>
|
||||||
<li><a href="#orgfdbd722">3. Power Spectral Density of the effect of the disturbances</a></li>
|
<li><a href="#orgf3d9a05">3. Power Spectral Density of the effect of the disturbances</a></li>
|
||||||
<li><a href="#org1afc869">4. Compute the Power Spectral Density of the disturbance force</a></li>
|
<li><a href="#org9f89ab8">4. Compute the Power Spectral Density of the disturbance force</a></li>
|
||||||
<li><a href="#org7b7d200">5. Noise Budget</a></li>
|
<li><a href="#org9815bee">5. Noise Budget</a></li>
|
||||||
<li><a href="#orgcb14c9c">6. Approximation</a></li>
|
<li><a href="#org926ae63">6. Approximation</a></li>
|
||||||
<li><a href="#orgb2171a0">7. Save</a></li>
|
<li><a href="#orged7769c">7. Save</a></li>
|
||||||
|
<li><a href="#org5befdfe">8. Display Obtained Disturbances</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -296,7 +300,7 @@ The goal here is to extract the Power Spectral Density of the sources of perturb
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The sources of perturbations are (schematically shown in figure <a href="#org309ec0f">1</a>):
|
The sources of perturbations are (schematically shown in figure <a href="#org41251c6">1</a>):
|
||||||
</p>
|
</p>
|
||||||
<ul class="org-ul">
|
<ul class="org-ul">
|
||||||
<li>\(D_w\): Ground Motion</li>
|
<li>\(D_w\): Ground Motion</li>
|
||||||
@ -305,12 +309,12 @@ These forces can be due to imperfect guiding for instance.</li>
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Because we cannot measure directly the perturbation forces, we have the measure the effect of those perturbations on the system (in terms of velocity for instance using geophones, \(D\) on figure <a href="#org309ec0f">1</a>) and then, using a model, compute the forces that induced such velocity.
|
Because we cannot measure directly the perturbation forces, we have the measure the effect of those perturbations on the system (in terms of velocity for instance using geophones, \(D\) on figure <a href="#org41251c6">1</a>) and then, using a model, compute the forces that induced such velocity.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="org309ec0f" class="figure">
|
<div id="org41251c6" class="figure">
|
||||||
<p><img src="figs/uniaxial-model-micro-station.png" alt="uniaxial-model-micro-station.png" />
|
<p><img src="figs/uniaxial-model-micro-station.png" alt="uniaxial-model-micro-station.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 1: </span>Schematic of the Micro Station and the sources of disturbance</p>
|
<p><span class="figure-number">Figure 1: </span>Schematic of the Micro Station and the sources of disturbance</p>
|
||||||
@ -321,18 +325,18 @@ Because we cannot measure directly the perturbation forces, we have the measure
|
|||||||
This file is divided in the following sections:
|
This file is divided in the following sections:
|
||||||
</p>
|
</p>
|
||||||
<ul class="org-ul">
|
<ul class="org-ul">
|
||||||
<li>Section <a href="#orgd02e691">1</a>: transfer functions from the disturbance forces to the relative velocity of the hexapod with respect to the granite are computed using the Simscape Model representing the experimental setup</li>
|
<li>Section <a href="#org965ca14">1</a>: transfer functions from the disturbance forces to the relative velocity of the hexapod with respect to the granite are computed using the Simscape Model representing the experimental setup</li>
|
||||||
<li>Section <a href="#orgb4494f5">2</a>: the bode plot of those transfer functions are shown</li>
|
<li>Section <a href="#orgeb1f8aa">2</a>: the bode plot of those transfer functions are shown</li>
|
||||||
<li>Section <a href="#orgc1276e1">3</a>: the measured PSD of the effect of the disturbances are shown</li>
|
<li>Section <a href="#org157daba">3</a>: the measured PSD of the effect of the disturbances are shown</li>
|
||||||
<li>Section <a href="#org8be51e3">4</a>: from the model and the measured PSD, the PSD of the disturbance forces are computed</li>
|
<li>Section <a href="#org052ae5a">4</a>: from the model and the measured PSD, the PSD of the disturbance forces are computed</li>
|
||||||
<li>Section <a href="#org5637737">5</a>: with the computed PSD, the noise budget of the system is done</li>
|
<li>Section <a href="#org2eab1f7">5</a>: with the computed PSD, the noise budget of the system is done</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div id="outline-container-org018a052" class="outline-2">
|
<div id="outline-container-org764c7a5" class="outline-2">
|
||||||
<h2 id="org018a052"><span class="section-number-2">1</span> Identification</h2>
|
<h2 id="org764c7a5"><span class="section-number-2">1</span> Identification</h2>
|
||||||
<div class="outline-text-2" id="text-1">
|
<div class="outline-text-2" id="text-1">
|
||||||
<p>
|
<p>
|
||||||
<a id="orgd02e691"></a>
|
<a id="org965ca14"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -373,15 +377,15 @@ G.OutputName = <span class="org-rainbow-delimiters-depth-1">{</span><span class=
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgf53a747" class="outline-2">
|
<div id="outline-container-orgb1acef0" class="outline-2">
|
||||||
<h2 id="orgf53a747"><span class="section-number-2">2</span> Sensitivity to Disturbances</h2>
|
<h2 id="orgb1acef0"><span class="section-number-2">2</span> Sensitivity to Disturbances</h2>
|
||||||
<div class="outline-text-2" id="text-2">
|
<div class="outline-text-2" id="text-2">
|
||||||
<p>
|
<p>
|
||||||
<a id="orgb4494f5"></a>
|
<a id="orgeb1f8aa"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<div id="orgec60752" class="figure">
|
<div id="org18fe4f2" class="figure">
|
||||||
<p><img src="figs/sensitivity_dist_gm.png" alt="sensitivity_dist_gm.png" />
|
<p><img src="figs/sensitivity_dist_gm.png" alt="sensitivity_dist_gm.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 2: </span>Sensitivity to Ground Motion (<a href="./figs/sensitivity_dist_gm.png">png</a>, <a href="./figs/sensitivity_dist_gm.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 2: </span>Sensitivity to Ground Motion (<a href="./figs/sensitivity_dist_gm.png">png</a>, <a href="./figs/sensitivity_dist_gm.pdf">pdf</a>)</p>
|
||||||
@ -389,7 +393,7 @@ G.OutputName = <span class="org-rainbow-delimiters-depth-1">{</span><span class=
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="org9e24679" class="figure">
|
<div id="org03421a4" class="figure">
|
||||||
<p><img src="figs/sensitivity_dist_fty.png" alt="sensitivity_dist_fty.png" />
|
<p><img src="figs/sensitivity_dist_fty.png" alt="sensitivity_dist_fty.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 3: </span>Sensitivity to vertical forces applied by the Ty stage (<a href="./figs/sensitivity_dist_fty.png">png</a>, <a href="./figs/sensitivity_dist_fty.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 3: </span>Sensitivity to vertical forces applied by the Ty stage (<a href="./figs/sensitivity_dist_fty.png">png</a>, <a href="./figs/sensitivity_dist_fty.pdf">pdf</a>)</p>
|
||||||
@ -397,7 +401,7 @@ G.OutputName = <span class="org-rainbow-delimiters-depth-1">{</span><span class=
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="orge1d747d" class="figure">
|
<div id="org6c556be" class="figure">
|
||||||
<p><img src="figs/sensitivity_dist_frz.png" alt="sensitivity_dist_frz.png" />
|
<p><img src="figs/sensitivity_dist_frz.png" alt="sensitivity_dist_frz.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 4: </span>Sensitivity to vertical forces applied by the Rz stage (<a href="./figs/sensitivity_dist_frz.png">png</a>, <a href="./figs/sensitivity_dist_frz.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 4: </span>Sensitivity to vertical forces applied by the Rz stage (<a href="./figs/sensitivity_dist_frz.png">png</a>, <a href="./figs/sensitivity_dist_frz.pdf">pdf</a>)</p>
|
||||||
@ -405,11 +409,11 @@ G.OutputName = <span class="org-rainbow-delimiters-depth-1">{</span><span class=
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgfdbd722" class="outline-2">
|
<div id="outline-container-orgf3d9a05" class="outline-2">
|
||||||
<h2 id="orgfdbd722"><span class="section-number-2">3</span> Power Spectral Density of the effect of the disturbances</h2>
|
<h2 id="orgf3d9a05"><span class="section-number-2">3</span> Power Spectral Density of the effect of the disturbances</h2>
|
||||||
<div class="outline-text-2" id="text-3">
|
<div class="outline-text-2" id="text-3">
|
||||||
<p>
|
<p>
|
||||||
<a id="orgc1276e1"></a>
|
<a id="org157daba"></a>
|
||||||
The PSD of the relative velocity between the hexapod and the marble in \([(m/s)^2/Hz]\) are loaded for the following sources of disturbance:
|
The PSD of the relative velocity between the hexapod and the marble in \([(m/s)^2/Hz]\) are loaded for the following sources of disturbance:
|
||||||
</p>
|
</p>
|
||||||
<ul class="org-ul">
|
<ul class="org-ul">
|
||||||
@ -438,15 +442,15 @@ We now compute the relative velocity between the hexapod and the granite due to
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The Power Spectral Density of the relative motion/velocity of the hexapod with respect to the granite are shown in figures <a href="#org2218f0d">5</a> and <a href="#orgbf5278e">6</a>.
|
The Power Spectral Density of the relative motion/velocity of the hexapod with respect to the granite are shown in figures <a href="#orga55547e">5</a> and <a href="#org7c4f520">6</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The Cumulative Amplitude Spectrum of the relative motion is shown in figure <a href="#orga2d62cc">7</a>.
|
The Cumulative Amplitude Spectrum of the relative motion is shown in figure <a href="#org868ac30">7</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<div id="org2218f0d" class="figure">
|
<div id="orga55547e" class="figure">
|
||||||
<p><img src="figs/dist_effect_relative_velocity.png" alt="dist_effect_relative_velocity.png" />
|
<p><img src="figs/dist_effect_relative_velocity.png" alt="dist_effect_relative_velocity.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 5: </span>Amplitude Spectral Density of the relative velocity of the hexapod with respect to the granite due to different sources of perturbation (<a href="./figs/dist_effect_relative_velocity.png">png</a>, <a href="./figs/dist_effect_relative_velocity.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 5: </span>Amplitude Spectral Density of the relative velocity of the hexapod with respect to the granite due to different sources of perturbation (<a href="./figs/dist_effect_relative_velocity.png">png</a>, <a href="./figs/dist_effect_relative_velocity.pdf">pdf</a>)</p>
|
||||||
@ -454,14 +458,14 @@ The Cumulative Amplitude Spectrum of the relative motion is shown in figure <a h
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="orgbf5278e" class="figure">
|
<div id="org7c4f520" class="figure">
|
||||||
<p><img src="figs/dist_effect_relative_motion.png" alt="dist_effect_relative_motion.png" />
|
<p><img src="figs/dist_effect_relative_motion.png" alt="dist_effect_relative_motion.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 6: </span>Amplitude Spectral Density of the relative displacement of the hexapod with respect to the granite due to different sources of perturbation (<a href="./figs/dist_effect_relative_motion.png">png</a>, <a href="./figs/dist_effect_relative_motion.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 6: </span>Amplitude Spectral Density of the relative displacement of the hexapod with respect to the granite due to different sources of perturbation (<a href="./figs/dist_effect_relative_motion.png">png</a>, <a href="./figs/dist_effect_relative_motion.pdf">pdf</a>)</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="orga2d62cc" class="figure">
|
<div id="org868ac30" class="figure">
|
||||||
<p><img src="figs/dist_effect_relative_motion_cas.png" alt="dist_effect_relative_motion_cas.png" />
|
<p><img src="figs/dist_effect_relative_motion_cas.png" alt="dist_effect_relative_motion_cas.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 7: </span>Cumulative Amplitude Spectrum of the relative motion due to different sources of perturbation (<a href="./figs/dist_effect_relative_motion_cas.png">png</a>, <a href="./figs/dist_effect_relative_motion_cas.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 7: </span>Cumulative Amplitude Spectrum of the relative motion due to different sources of perturbation (<a href="./figs/dist_effect_relative_motion_cas.png">png</a>, <a href="./figs/dist_effect_relative_motion_cas.pdf">pdf</a>)</p>
|
||||||
@ -469,15 +473,15 @@ The Cumulative Amplitude Spectrum of the relative motion is shown in figure <a h
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org1afc869" class="outline-2">
|
<div id="outline-container-org9f89ab8" class="outline-2">
|
||||||
<h2 id="org1afc869"><span class="section-number-2">4</span> Compute the Power Spectral Density of the disturbance force</h2>
|
<h2 id="org9f89ab8"><span class="section-number-2">4</span> Compute the Power Spectral Density of the disturbance force</h2>
|
||||||
<div class="outline-text-2" id="text-4">
|
<div class="outline-text-2" id="text-4">
|
||||||
<p>
|
<p>
|
||||||
<a id="org8be51e3"></a>
|
<a id="org052ae5a"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Now, from the extracted transfer functions from the disturbance force to the relative motion of the hexapod with respect to the granite (section <a href="#orgb4494f5">2</a>) and from the measured PSD of the relative motion (section <a href="#orgc1276e1">3</a>), we can compute the PSD of the disturbance force.
|
Now, from the extracted transfer functions from the disturbance force to the relative motion of the hexapod with respect to the granite (section <a href="#orgeb1f8aa">2</a>) and from the measured PSD of the relative motion (section <a href="#org157daba">3</a>), we can compute the PSD of the disturbance force.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="org-src-container">
|
<div class="org-src-container">
|
||||||
@ -487,7 +491,7 @@ tyz.psd_f = tyz.pxz_ty_r<span class="org-type">./</span>abs<span class="org-rain
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="org4179250" class="figure">
|
<div id="org50e0621" class="figure">
|
||||||
<p><img src="figs/dist_force_psd.png" alt="dist_force_psd.png" />
|
<p><img src="figs/dist_force_psd.png" alt="dist_force_psd.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 8: </span>Amplitude Spectral Density of the disturbance force (<a href="./figs/dist_force_psd.png">png</a>, <a href="./figs/dist_force_psd.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 8: </span>Amplitude Spectral Density of the disturbance force (<a href="./figs/dist_force_psd.png">png</a>, <a href="./figs/dist_force_psd.pdf">pdf</a>)</p>
|
||||||
@ -495,11 +499,11 @@ tyz.psd_f = tyz.pxz_ty_r<span class="org-type">./</span>abs<span class="org-rain
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-org7b7d200" class="outline-2">
|
<div id="outline-container-org9815bee" class="outline-2">
|
||||||
<h2 id="org7b7d200"><span class="section-number-2">5</span> Noise Budget</h2>
|
<h2 id="org9815bee"><span class="section-number-2">5</span> Noise Budget</h2>
|
||||||
<div class="outline-text-2" id="text-5">
|
<div class="outline-text-2" id="text-5">
|
||||||
<p>
|
<p>
|
||||||
<a id="org5637737"></a>
|
<a id="org2eab1f7"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -508,7 +512,7 @@ We should verify that this is coherent with the measurements.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<div id="org7b815bd" class="figure">
|
<div id="org82364a5" class="figure">
|
||||||
<p><img src="figs/psd_effect_dist_verif.png" alt="psd_effect_dist_verif.png" />
|
<p><img src="figs/psd_effect_dist_verif.png" alt="psd_effect_dist_verif.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 9: </span>Computed Effect of the disturbances on the relative displacement hexapod/granite (<a href="./figs/psd_effect_dist_verif.png">png</a>, <a href="./figs/psd_effect_dist_verif.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 9: </span>Computed Effect of the disturbances on the relative displacement hexapod/granite (<a href="./figs/psd_effect_dist_verif.png">png</a>, <a href="./figs/psd_effect_dist_verif.pdf">pdf</a>)</p>
|
||||||
@ -516,7 +520,7 @@ We should verify that this is coherent with the measurements.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="org61c8022" class="figure">
|
<div id="org551988f" class="figure">
|
||||||
<p><img src="figs/cas_computed_relative_displacement.png" alt="cas_computed_relative_displacement.png" />
|
<p><img src="figs/cas_computed_relative_displacement.png" alt="cas_computed_relative_displacement.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 10: </span>CAS of the total Relative Displacement due to all considered sources of perturbation (<a href="./figs/cas_computed_relative_displacement.png">png</a>, <a href="./figs/cas_computed_relative_displacement.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 10: </span>CAS of the total Relative Displacement due to all considered sources of perturbation (<a href="./figs/cas_computed_relative_displacement.png">png</a>, <a href="./figs/cas_computed_relative_displacement.pdf">pdf</a>)</p>
|
||||||
@ -524,8 +528,8 @@ We should verify that this is coherent with the measurements.
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgcb14c9c" class="outline-2">
|
<div id="outline-container-org926ae63" class="outline-2">
|
||||||
<h2 id="orgcb14c9c"><span class="section-number-2">6</span> Approximation</h2>
|
<h2 id="org926ae63"><span class="section-number-2">6</span> Approximation</h2>
|
||||||
<div class="outline-text-2" id="text-6">
|
<div class="outline-text-2" id="text-6">
|
||||||
<p>
|
<p>
|
||||||
We approximate the PSD of the disturbance with the following transfer functions.
|
We approximate the PSD of the disturbance with the following transfer functions.
|
||||||
@ -541,14 +545,14 @@ G_gm = <span class="org-highlight-numbers-number">0</span>.<span class="org-high
|
|||||||
We compute the effect of these approximate disturbances on \(D\).
|
We compute the effect of these approximate disturbances on \(D\).
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div id="orgaa5c4d0" class="figure">
|
<div id="orge066a98" class="figure">
|
||||||
<p><img src="figs/estimate_spectral_density_disturbances.png" alt="estimate_spectral_density_disturbances.png" />
|
<p><img src="figs/estimate_spectral_density_disturbances.png" alt="estimate_spectral_density_disturbances.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 11: </span>Estimated spectral density of the disturbances (<a href="./figs/estimate_spectral_density_disturbances.png">png</a>, <a href="./figs/estimate_spectral_density_disturbances.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 11: </span>Estimated spectral density of the disturbances (<a href="./figs/estimate_spectral_density_disturbances.png">png</a>, <a href="./figs/estimate_spectral_density_disturbances.pdf">pdf</a>)</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="orgc7b6ba7" class="figure">
|
<div id="orgce34474" class="figure">
|
||||||
<p><img src="figs/comp_estimation_cas_disturbances.png" alt="comp_estimation_cas_disturbances.png" />
|
<p><img src="figs/comp_estimation_cas_disturbances.png" alt="comp_estimation_cas_disturbances.png" />
|
||||||
</p>
|
</p>
|
||||||
<p><span class="figure-number">Figure 12: </span>Comparison of the CAS of the disturbances with the approximate ones (<a href="./figs/comp_estimation_cas_disturbances.png">png</a>, <a href="./figs/comp_estimation_cas_disturbances.pdf">pdf</a>)</p>
|
<p><span class="figure-number">Figure 12: </span>Comparison of the CAS of the disturbances with the approximate ones (<a href="./figs/comp_estimation_cas_disturbances.png">png</a>, <a href="./figs/comp_estimation_cas_disturbances.pdf">pdf</a>)</p>
|
||||||
@ -556,8 +560,8 @@ We compute the effect of these approximate disturbances on \(D\).
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="outline-container-orgb2171a0" class="outline-2">
|
<div id="outline-container-orged7769c" class="outline-2">
|
||||||
<h2 id="orgb2171a0"><span class="section-number-2">7</span> Save</h2>
|
<h2 id="orged7769c"><span class="section-number-2">7</span> Save</h2>
|
||||||
<div class="outline-text-2" id="text-7">
|
<div class="outline-text-2" id="text-7">
|
||||||
<p>
|
<p>
|
||||||
The PSD of the disturbance force are now saved for further noise budgeting when control is applied (the mat file is accessible <a href="mat/dist_psd.mat">here</a>).
|
The PSD of the disturbance force are now saved for further noise budgeting when control is applied (the mat file is accessible <a href="mat/dist_psd.mat">here</a>).
|
||||||
@ -581,10 +585,45 @@ save<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org5befdfe" class="outline-2">
|
||||||
|
<h2 id="org5befdfe"><span class="section-number-2">8</span> Display Obtained Disturbances</h2>
|
||||||
|
<div class="outline-text-2" id="text-8">
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab">initDisturbances<span class="org-rainbow-delimiters-depth-1">()</span>;
|
||||||
|
load<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'./mat/nass_disturbances.mat'</span>, <span class="org-string">'Dwx'</span>, <span class="org-string">'Dwy'</span>, <span class="org-string">'Dwz'</span>, <span class="org-string">'Fty_x'</span>, <span class="org-string">'Fty_z'</span>, <span class="org-string">'Frz_z'</span>, <span class="org-string">'Fd'</span>, <span class="org-string">'Ts'</span>, <span class="org-string">'t'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab"><span class="org-type">figure</span>;
|
||||||
|
hold on;
|
||||||
|
plot<span class="org-rainbow-delimiters-depth-1">(</span>t, Dwx, <span class="org-string">'DisplayName'</span>, <span class="org-string">'Dw x'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
plot<span class="org-rainbow-delimiters-depth-1">(</span>t, Dwy, <span class="org-string">'DisplayName'</span>, <span class="org-string">'Dw y'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
plot<span class="org-rainbow-delimiters-depth-1">(</span>t, Dwz, <span class="org-string">'DisplayName'</span>, <span class="org-string">'Dw z'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
hold off;
|
||||||
|
xlabel<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'Time </span><span class="org-string"><span class="org-rainbow-delimiters-depth-2">[</span></span><span class="org-string">s</span><span class="org-string"><span class="org-rainbow-delimiters-depth-2">]</span></span><span class="org-string">'</span><span class="org-rainbow-delimiters-depth-1">)</span>; ylabel<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'Amplitude </span><span class="org-string"><span class="org-rainbow-delimiters-depth-2">[</span></span><span class="org-string">m</span><span class="org-string"><span class="org-rainbow-delimiters-depth-2">]</span></span><span class="org-string">'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
legend<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'location'</span>, <span class="org-string">'north east'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab"><span class="org-type">figure</span>;
|
||||||
|
hold on;
|
||||||
|
plot<span class="org-rainbow-delimiters-depth-1">(</span>t, Fty_x, <span class="org-string">'DisplayName'</span>, <span class="org-string">'Ty x'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
plot<span class="org-rainbow-delimiters-depth-1">(</span>t, Fty_z, <span class="org-string">'DisplayName'</span>, <span class="org-string">'Ty z'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
plot<span class="org-rainbow-delimiters-depth-1">(</span>t, Frz_z, <span class="org-string">'DisplayName'</span>, <span class="org-string">'Rz z'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
hold off;
|
||||||
|
xlabel<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'Time </span><span class="org-string"><span class="org-rainbow-delimiters-depth-2">[</span></span><span class="org-string">s</span><span class="org-string"><span class="org-rainbow-delimiters-depth-2">]</span></span><span class="org-string">'</span><span class="org-rainbow-delimiters-depth-1">)</span>; ylabel<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'Force </span><span class="org-string"><span class="org-rainbow-delimiters-depth-2">[</span></span><span class="org-string">N</span><span class="org-string"><span class="org-rainbow-delimiters-depth-2">]</span></span><span class="org-string">'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
legend<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'location'</span>, <span class="org-string">'north east'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</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: 2019-11-22 ven. 15:42</p>
|
<p class="date">Created: 2019-12-11 mer. 17:19</p>
|
||||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -587,153 +587,6 @@ The PSD of the disturbance force are now saved for further noise budgeting when
|
|||||||
save('./disturbances/mat/dist_psd.mat', 'dist_f');
|
save('./disturbances/mat/dist_psd.mat', 'dist_f');
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Function that initialize the disturbances
|
|
||||||
:PROPERTIES:
|
|
||||||
:header-args:matlab+: :tangle ../src/initDisturbances.m
|
|
||||||
:header-args:matlab+: :comments none :mkdirp yes
|
|
||||||
:header-args:matlab+: :eval no :results none
|
|
||||||
:END:
|
|
||||||
<<sec:initDisturbances>>
|
|
||||||
|
|
||||||
This Matlab function is accessible [[file:src/initDisturbances.m][here]].
|
|
||||||
|
|
||||||
#+begin_src matlab
|
|
||||||
function [] = initDisturbances(opts_param)
|
|
||||||
% initDisturbances - Initialize the disturbances
|
|
||||||
%
|
|
||||||
% Syntax: [] = initDisturbances(opts_param)
|
|
||||||
%
|
|
||||||
% Inputs:
|
|
||||||
% - opts_param -
|
|
||||||
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Default values for the Options
|
|
||||||
#+begin_src matlab
|
|
||||||
%% Default values for opts
|
|
||||||
opts = struct();
|
|
||||||
|
|
||||||
%% Populate opts with input parameters
|
|
||||||
if exist('opts_param','var')
|
|
||||||
for opt = fieldnames(opts_param)'
|
|
||||||
opts.(opt{1}) = opts_param.(opt{1});
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Load Data
|
|
||||||
#+begin_src matlab
|
|
||||||
load('./disturbances/mat/dist_psd.mat', 'dist_f');
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
We remove the first frequency point that usually is very large.
|
|
||||||
#+begin_src matlab :exports none
|
|
||||||
dist_f.f = dist_f.f(2:end);
|
|
||||||
dist_f.psd_gm = dist_f.psd_gm(2:end);
|
|
||||||
dist_f.psd_ty = dist_f.psd_ty(2:end);
|
|
||||||
dist_f.psd_rz = dist_f.psd_rz(2:end);
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Parameters
|
|
||||||
We define some parameters that will be used in the algorithm.
|
|
||||||
#+begin_src matlab
|
|
||||||
Fs = 2*dist_f.f(end); % Sampling Frequency of data is twice the maximum frequency of the PSD vector [Hz]
|
|
||||||
N = 2*length(dist_f.f); % Number of Samples match the one of the wanted PSD
|
|
||||||
T0 = N/Fs; % Signal Duration [s]
|
|
||||||
df = 1/T0; % Frequency resolution of the DFT [Hz]
|
|
||||||
% Also equal to (dist_f.f(2)-dist_f.f(1))
|
|
||||||
t = linspace(0, T0, N+1)'; % Time Vector [s]
|
|
||||||
Ts = 1/Fs; % Sampling Time [s]
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Ground Motion
|
|
||||||
#+begin_src matlab
|
|
||||||
phi = dist_f.psd_gm;
|
|
||||||
C = zeros(N/2,1);
|
|
||||||
for i = 1:N/2
|
|
||||||
C(i) = sqrt(phi(i)*df);
|
|
||||||
end
|
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
|
||||||
u = N/sqrt(2)*ifft(Cx); % Ground Motion - x direction [m]
|
|
||||||
% Dwx = struct('time', t, 'signals', struct('values', u));
|
|
||||||
Dwx = u;
|
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
|
||||||
u = N/sqrt(2)*ifft(Cx); % Ground Motion - y direction [m]
|
|
||||||
Dwy = u;
|
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
|
||||||
u = N/sqrt(2)*ifft(Cx); % Ground Motion - z direction [m]
|
|
||||||
Dwz = u;
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Translation Stage - X direction
|
|
||||||
#+begin_src matlab
|
|
||||||
phi = dist_f.psd_ty; % TODO - we take here the vertical direction which is wrong but approximate
|
|
||||||
C = zeros(N/2,1);
|
|
||||||
for i = 1:N/2
|
|
||||||
C(i) = sqrt(phi(i)*df);
|
|
||||||
end
|
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
|
||||||
u = N/sqrt(2)*ifft(Cx); % Disturbance Force Ty x [N]
|
|
||||||
Fty_x = u;
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Translation Stage - Z direction
|
|
||||||
#+begin_src matlab
|
|
||||||
phi = dist_f.psd_ty;
|
|
||||||
C = zeros(N/2,1);
|
|
||||||
for i = 1:N/2
|
|
||||||
C(i) = sqrt(phi(i)*df);
|
|
||||||
end
|
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
|
||||||
u = N/sqrt(2)*ifft(Cx); % Disturbance Force Ty z [N]
|
|
||||||
Fty_z = u;
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Spindle - Z direction
|
|
||||||
#+begin_src matlab
|
|
||||||
phi = dist_f.psd_rz;
|
|
||||||
C = zeros(N/2,1);
|
|
||||||
for i = 1:N/2
|
|
||||||
C(i) = sqrt(phi(i)*df);
|
|
||||||
end
|
|
||||||
theta = 2*pi*rand(N/2,1); % Generate random phase [rad]
|
|
||||||
Cx = [0 ; C.*complex(cos(theta),sin(theta))];
|
|
||||||
Cx = [Cx; flipud(conj(Cx(2:end)))];;
|
|
||||||
u = N/sqrt(2)*ifft(Cx); % Disturbance Force Rz z [N]
|
|
||||||
Frz_z = u;
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Direct Forces
|
|
||||||
#+begin_src matlab
|
|
||||||
u = zeros(length(t), 6);
|
|
||||||
Fd = u;
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Set initial value to zero
|
|
||||||
#+begin_src matlab
|
|
||||||
Dwx = Dwx - Dwx(1);
|
|
||||||
Dwy = Dwy - Dwy(1);
|
|
||||||
Dwz = Dwz - Dwz(1);
|
|
||||||
Fty_x = Fty_x - Fty_x(1);
|
|
||||||
Fty_z = Fty_z - Fty_z(1);
|
|
||||||
Frz_z = Frz_z - Frz_z(1);
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Save
|
|
||||||
#+begin_src matlab
|
|
||||||
save('./mat/nass_disturbances.mat', 'Dwx', 'Dwy', 'Dwz', 'Fty_x', 'Fty_z', 'Frz_z', 'Fd', 'Ts', 't');
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
* Display Obtained Disturbances
|
* Display Obtained Disturbances
|
||||||
#+begin_src matlab
|
#+begin_src matlab
|
||||||
initDisturbances();
|
initDisturbances();
|
||||||
|
883
functions/index.html
Normal file
883
functions/index.html
Normal file
@ -0,0 +1,883 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||||
|
<head>
|
||||||
|
<!-- 2019-12-11 mer. 17:33 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Matlab Functions used for the NASS Project</title>
|
||||||
|
<meta name="generator" content="Org mode" />
|
||||||
|
<meta name="author" content="Dehaeze Thomas" />
|
||||||
|
<style type="text/css">
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
.title { text-align: center;
|
||||||
|
margin-bottom: .2em; }
|
||||||
|
.subtitle { text-align: center;
|
||||||
|
font-size: medium;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top:0; }
|
||||||
|
.todo { font-family: monospace; color: red; }
|
||||||
|
.done { font-family: monospace; color: green; }
|
||||||
|
.priority { font-family: monospace; color: orange; }
|
||||||
|
.tag { background-color: #eee; font-family: monospace;
|
||||||
|
padding: 2px; font-size: 80%; font-weight: normal; }
|
||||||
|
.timestamp { color: #bebebe; }
|
||||||
|
.timestamp-kwd { color: #5f9ea0; }
|
||||||
|
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
|
||||||
|
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
|
||||||
|
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
|
||||||
|
.underline { text-decoration: underline; }
|
||||||
|
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
||||||
|
p.verse { margin-left: 3%; }
|
||||||
|
pre {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
box-shadow: 3px 3px 3px #eee;
|
||||||
|
padding: 8pt;
|
||||||
|
font-family: monospace;
|
||||||
|
overflow: auto;
|
||||||
|
margin: 1.2em;
|
||||||
|
}
|
||||||
|
pre.src {
|
||||||
|
position: relative;
|
||||||
|
overflow: visible;
|
||||||
|
padding-top: 1.2em;
|
||||||
|
}
|
||||||
|
pre.src:before {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
background-color: white;
|
||||||
|
top: -10px;
|
||||||
|
right: 10px;
|
||||||
|
padding: 3px;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
pre.src:hover:before { display: inline;}
|
||||||
|
/* Languages per Org manual */
|
||||||
|
pre.src-asymptote:before { content: 'Asymptote'; }
|
||||||
|
pre.src-awk:before { content: 'Awk'; }
|
||||||
|
pre.src-C:before { content: 'C'; }
|
||||||
|
/* pre.src-C++ doesn't work in CSS */
|
||||||
|
pre.src-clojure:before { content: 'Clojure'; }
|
||||||
|
pre.src-css:before { content: 'CSS'; }
|
||||||
|
pre.src-D:before { content: 'D'; }
|
||||||
|
pre.src-ditaa:before { content: 'ditaa'; }
|
||||||
|
pre.src-dot:before { content: 'Graphviz'; }
|
||||||
|
pre.src-calc:before { content: 'Emacs Calc'; }
|
||||||
|
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
||||||
|
pre.src-fortran:before { content: 'Fortran'; }
|
||||||
|
pre.src-gnuplot:before { content: 'gnuplot'; }
|
||||||
|
pre.src-haskell:before { content: 'Haskell'; }
|
||||||
|
pre.src-hledger:before { content: 'hledger'; }
|
||||||
|
pre.src-java:before { content: 'Java'; }
|
||||||
|
pre.src-js:before { content: 'Javascript'; }
|
||||||
|
pre.src-latex:before { content: 'LaTeX'; }
|
||||||
|
pre.src-ledger:before { content: 'Ledger'; }
|
||||||
|
pre.src-lisp:before { content: 'Lisp'; }
|
||||||
|
pre.src-lilypond:before { content: 'Lilypond'; }
|
||||||
|
pre.src-lua:before { content: 'Lua'; }
|
||||||
|
pre.src-matlab:before { content: 'MATLAB'; }
|
||||||
|
pre.src-mscgen:before { content: 'Mscgen'; }
|
||||||
|
pre.src-ocaml:before { content: 'Objective Caml'; }
|
||||||
|
pre.src-octave:before { content: 'Octave'; }
|
||||||
|
pre.src-org:before { content: 'Org mode'; }
|
||||||
|
pre.src-oz:before { content: 'OZ'; }
|
||||||
|
pre.src-plantuml:before { content: 'Plantuml'; }
|
||||||
|
pre.src-processing:before { content: 'Processing.js'; }
|
||||||
|
pre.src-python:before { content: 'Python'; }
|
||||||
|
pre.src-R:before { content: 'R'; }
|
||||||
|
pre.src-ruby:before { content: 'Ruby'; }
|
||||||
|
pre.src-sass:before { content: 'Sass'; }
|
||||||
|
pre.src-scheme:before { content: 'Scheme'; }
|
||||||
|
pre.src-screen:before { content: 'Gnu Screen'; }
|
||||||
|
pre.src-sed:before { content: 'Sed'; }
|
||||||
|
pre.src-sh:before { content: 'shell'; }
|
||||||
|
pre.src-sql:before { content: 'SQL'; }
|
||||||
|
pre.src-sqlite:before { content: 'SQLite'; }
|
||||||
|
/* additional languages in org.el's org-babel-load-languages alist */
|
||||||
|
pre.src-forth:before { content: 'Forth'; }
|
||||||
|
pre.src-io:before { content: 'IO'; }
|
||||||
|
pre.src-J:before { content: 'J'; }
|
||||||
|
pre.src-makefile:before { content: 'Makefile'; }
|
||||||
|
pre.src-maxima:before { content: 'Maxima'; }
|
||||||
|
pre.src-perl:before { content: 'Perl'; }
|
||||||
|
pre.src-picolisp:before { content: 'Pico Lisp'; }
|
||||||
|
pre.src-scala:before { content: 'Scala'; }
|
||||||
|
pre.src-shell:before { content: 'Shell Script'; }
|
||||||
|
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
|
||||||
|
/* additional language identifiers per "defun org-babel-execute"
|
||||||
|
in ob-*.el */
|
||||||
|
pre.src-cpp:before { content: 'C++'; }
|
||||||
|
pre.src-abc:before { content: 'ABC'; }
|
||||||
|
pre.src-coq:before { content: 'Coq'; }
|
||||||
|
pre.src-groovy:before { content: 'Groovy'; }
|
||||||
|
/* additional language identifiers from org-babel-shell-names in
|
||||||
|
ob-shell.el: ob-shell is the only babel language using a lambda to put
|
||||||
|
the execution function name together. */
|
||||||
|
pre.src-bash:before { content: 'bash'; }
|
||||||
|
pre.src-csh:before { content: 'csh'; }
|
||||||
|
pre.src-ash:before { content: 'ash'; }
|
||||||
|
pre.src-dash:before { content: 'dash'; }
|
||||||
|
pre.src-ksh:before { content: 'ksh'; }
|
||||||
|
pre.src-mksh:before { content: 'mksh'; }
|
||||||
|
pre.src-posh:before { content: 'posh'; }
|
||||||
|
/* Additional Emacs modes also supported by the LaTeX listings package */
|
||||||
|
pre.src-ada:before { content: 'Ada'; }
|
||||||
|
pre.src-asm:before { content: 'Assembler'; }
|
||||||
|
pre.src-caml:before { content: 'Caml'; }
|
||||||
|
pre.src-delphi:before { content: 'Delphi'; }
|
||||||
|
pre.src-html:before { content: 'HTML'; }
|
||||||
|
pre.src-idl:before { content: 'IDL'; }
|
||||||
|
pre.src-mercury:before { content: 'Mercury'; }
|
||||||
|
pre.src-metapost:before { content: 'MetaPost'; }
|
||||||
|
pre.src-modula-2:before { content: 'Modula-2'; }
|
||||||
|
pre.src-pascal:before { content: 'Pascal'; }
|
||||||
|
pre.src-ps:before { content: 'PostScript'; }
|
||||||
|
pre.src-prolog:before { content: 'Prolog'; }
|
||||||
|
pre.src-simula:before { content: 'Simula'; }
|
||||||
|
pre.src-tcl:before { content: 'tcl'; }
|
||||||
|
pre.src-tex:before { content: 'TeX'; }
|
||||||
|
pre.src-plain-tex:before { content: 'Plain TeX'; }
|
||||||
|
pre.src-verilog:before { content: 'Verilog'; }
|
||||||
|
pre.src-vhdl:before { content: 'VHDL'; }
|
||||||
|
pre.src-xml:before { content: 'XML'; }
|
||||||
|
pre.src-nxml:before { content: 'XML'; }
|
||||||
|
/* add a generic configuration mode; LaTeX export needs an additional
|
||||||
|
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
|
||||||
|
pre.src-conf:before { content: 'Configuration File'; }
|
||||||
|
|
||||||
|
table { border-collapse:collapse; }
|
||||||
|
caption.t-above { caption-side: top; }
|
||||||
|
caption.t-bottom { caption-side: bottom; }
|
||||||
|
td, th { vertical-align:top; }
|
||||||
|
th.org-right { text-align: center; }
|
||||||
|
th.org-left { text-align: center; }
|
||||||
|
th.org-center { text-align: center; }
|
||||||
|
td.org-right { text-align: right; }
|
||||||
|
td.org-left { text-align: left; }
|
||||||
|
td.org-center { text-align: center; }
|
||||||
|
dt { font-weight: bold; }
|
||||||
|
.footpara { display: inline; }
|
||||||
|
.footdef { margin-bottom: 1em; }
|
||||||
|
.figure { padding: 1em; }
|
||||||
|
.figure p { text-align: center; }
|
||||||
|
.equation-container {
|
||||||
|
display: table;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.equation {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.equation-label {
|
||||||
|
display: table-cell;
|
||||||
|
text-align: right;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.inlinetask {
|
||||||
|
padding: 10px;
|
||||||
|
border: 2px solid gray;
|
||||||
|
margin: 10px;
|
||||||
|
background: #ffffcc;
|
||||||
|
}
|
||||||
|
#org-div-home-and-up
|
||||||
|
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
||||||
|
textarea { overflow-x: auto; }
|
||||||
|
.linenr { font-size: smaller }
|
||||||
|
.code-highlighted { background-color: #ffff00; }
|
||||||
|
.org-info-js_info-navigation { border-style: none; }
|
||||||
|
#org-info-js_console-label
|
||||||
|
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
|
||||||
|
.org-info-js_search-highlight
|
||||||
|
{ background-color: #ffff00; color: #000000; font-weight: bold; }
|
||||||
|
.org-svg { width: 90%; }
|
||||||
|
/*]]>*/-->
|
||||||
|
</style>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/htmlize.css"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/readtheorg.css"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../css/zenburn.css"/>
|
||||||
|
<script type="text/javascript" src="../js/jquery.min.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/jquery.stickytableheaders.min.js"></script>
|
||||||
|
<script type="text/javascript" src="../js/readtheorg.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*
|
||||||
|
@licstart The following is the entire license notice for the
|
||||||
|
JavaScript code in this tag.
|
||||||
|
|
||||||
|
Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
The JavaScript code in this tag is free software: you can
|
||||||
|
redistribute it and/or modify it under the terms of the GNU
|
||||||
|
General Public License (GNU GPL) as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version. The code is distributed WITHOUT ANY WARRANTY;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
|
||||||
|
|
||||||
|
As additional permission under GNU GPL version 3 section 7, you
|
||||||
|
may distribute non-source (e.g., minimized or compacted) forms of
|
||||||
|
that code without the copy of the GNU GPL normally required by
|
||||||
|
section 4, provided you include this license notice and a URL
|
||||||
|
through which recipients can access the Corresponding Source.
|
||||||
|
|
||||||
|
|
||||||
|
@licend The above is the entire license notice
|
||||||
|
for the JavaScript code in this tag.
|
||||||
|
*/
|
||||||
|
<!--/*--><![CDATA[/*><!--*/
|
||||||
|
function CodeHighlightOn(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(null != target) {
|
||||||
|
elem.cacheClassElem = elem.className;
|
||||||
|
elem.cacheClassTarget = target.className;
|
||||||
|
target.className = "code-highlighted";
|
||||||
|
elem.className = "code-highlighted";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function CodeHighlightOff(elem, id)
|
||||||
|
{
|
||||||
|
var target = document.getElementById(id);
|
||||||
|
if(elem.cacheClassElem)
|
||||||
|
elem.className = elem.cacheClassElem;
|
||||||
|
if(elem.cacheClassTarget)
|
||||||
|
target.className = elem.cacheClassTarget;
|
||||||
|
}
|
||||||
|
/*]]>*///-->
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="org-div-home-and-up">
|
||||||
|
<a accesskey="h" href="../index.html"> UP </a>
|
||||||
|
|
|
||||||
|
<a accesskey="H" href="../index.html"> HOME </a>
|
||||||
|
</div><div id="content">
|
||||||
|
<h1 class="title">Matlab Functions used for the NASS Project</h1>
|
||||||
|
<div id="table-of-contents">
|
||||||
|
<h2>Table of Contents</h2>
|
||||||
|
<div id="text-table-of-contents">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#org05ce9cd">1. Functions</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#orgd234316">1.1. computePsdDispl</a></li>
|
||||||
|
<li><a href="#orga7dcbe9">1.2. computeSetpoint</a></li>
|
||||||
|
<li><a href="#org38afc80">1.3. converErrorBasis</a></li>
|
||||||
|
<li><a href="#orge0e5103">1.4. generateDiagPidControl</a></li>
|
||||||
|
<li><a href="#orga0abbff">1.5. identifyPlant</a></li>
|
||||||
|
<li><a href="#orgd0e3a86">1.6. runSimulation</a></li>
|
||||||
|
<li><a href="#org288e05d">1.7. Inverse Kinematics of the Hexapod</a></li>
|
||||||
|
<li><a href="#org33a19ae">1.8. computeReferencePose</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org05ce9cd" class="outline-2">
|
||||||
|
<h2 id="org05ce9cd"><span class="section-number-2">1</span> Functions</h2>
|
||||||
|
<div class="outline-text-2" id="text-1">
|
||||||
|
<p>
|
||||||
|
<a id="org1c061a7"></a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div id="outline-container-orgd234316" class="outline-3">
|
||||||
|
<h3 id="orgd234316"><span class="section-number-3">1.1</span> computePsdDispl</h3>
|
||||||
|
<div class="outline-text-3" id="text-1-1">
|
||||||
|
<p>
|
||||||
|
<a id="orgabe5453"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This Matlab function is accessible <a href="../src/computePsdDispl.m">here</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">[</span></span><span class="org-variable-name">psd_object</span><span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">]</span></span> = <span class="org-function-name">computePsdDispl</span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">sys_data</span>, <span class="org-variable-name">t_init</span>, <span class="org-variable-name">n_av</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
i_init = find<span class="org-rainbow-delimiters-depth-1">(</span>sys_data.time <span class="org-type">></span> t_init, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
han_win = hanning<span class="org-rainbow-delimiters-depth-1">(</span>ceil<span class="org-rainbow-delimiters-depth-2">(</span>length<span class="org-rainbow-delimiters-depth-3">(</span>sys_data.Dx<span class="org-rainbow-delimiters-depth-4">(</span>i_init<span class="org-type">:</span>end, <span class="org-type">:</span><span class="org-rainbow-delimiters-depth-4">)</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-type">/</span>n_av<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
Fs = <span class="org-highlight-numbers-number">1</span><span class="org-type">/</span>sys_data.time<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
<span class="org-rainbow-delimiters-depth-1">[</span>pdx, f<span class="org-rainbow-delimiters-depth-1">]</span> = pwelch<span class="org-rainbow-delimiters-depth-1">(</span>sys_data.Dx<span class="org-rainbow-delimiters-depth-2">(</span>i_init<span class="org-type">:</span>end, <span class="org-type">:</span><span class="org-rainbow-delimiters-depth-2">)</span>, han_win, <span class="org-rainbow-delimiters-depth-2">[]</span>, <span class="org-rainbow-delimiters-depth-2">[]</span>, Fs<span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-rainbow-delimiters-depth-1">[</span>pdy, <span class="org-type">~</span><span class="org-rainbow-delimiters-depth-1">]</span> = pwelch<span class="org-rainbow-delimiters-depth-1">(</span>sys_data.Dy<span class="org-rainbow-delimiters-depth-2">(</span>i_init<span class="org-type">:</span>end, <span class="org-type">:</span><span class="org-rainbow-delimiters-depth-2">)</span>, han_win, <span class="org-rainbow-delimiters-depth-2">[]</span>, <span class="org-rainbow-delimiters-depth-2">[]</span>, Fs<span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-rainbow-delimiters-depth-1">[</span>pdz, <span class="org-type">~</span><span class="org-rainbow-delimiters-depth-1">]</span> = pwelch<span class="org-rainbow-delimiters-depth-1">(</span>sys_data.Dz<span class="org-rainbow-delimiters-depth-2">(</span>i_init<span class="org-type">:</span>end, <span class="org-type">:</span><span class="org-rainbow-delimiters-depth-2">)</span>, han_win, <span class="org-rainbow-delimiters-depth-2">[]</span>, <span class="org-rainbow-delimiters-depth-2">[]</span>, Fs<span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
<span class="org-rainbow-delimiters-depth-1">[</span>prx, <span class="org-type">~</span><span class="org-rainbow-delimiters-depth-1">]</span> = pwelch<span class="org-rainbow-delimiters-depth-1">(</span>sys_data.Rx<span class="org-rainbow-delimiters-depth-2">(</span>i_init<span class="org-type">:</span>end, <span class="org-type">:</span><span class="org-rainbow-delimiters-depth-2">)</span>, han_win, <span class="org-rainbow-delimiters-depth-2">[]</span>, <span class="org-rainbow-delimiters-depth-2">[]</span>, Fs<span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-rainbow-delimiters-depth-1">[</span>pry, <span class="org-type">~</span><span class="org-rainbow-delimiters-depth-1">]</span> = pwelch<span class="org-rainbow-delimiters-depth-1">(</span>sys_data.Ry<span class="org-rainbow-delimiters-depth-2">(</span>i_init<span class="org-type">:</span>end, <span class="org-type">:</span><span class="org-rainbow-delimiters-depth-2">)</span>, han_win, <span class="org-rainbow-delimiters-depth-2">[]</span>, <span class="org-rainbow-delimiters-depth-2">[]</span>, Fs<span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-rainbow-delimiters-depth-1">[</span>prz, <span class="org-type">~</span><span class="org-rainbow-delimiters-depth-1">]</span> = pwelch<span class="org-rainbow-delimiters-depth-1">(</span>sys_data.Rz<span class="org-rainbow-delimiters-depth-2">(</span>i_init<span class="org-type">:</span>end, <span class="org-type">:</span><span class="org-rainbow-delimiters-depth-2">)</span>, han_win, <span class="org-rainbow-delimiters-depth-2">[]</span>, <span class="org-rainbow-delimiters-depth-2">[]</span>, Fs<span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
psd_object = struct<span class="org-rainbow-delimiters-depth-1">(</span>...
|
||||||
|
<span class="org-string">'f'</span>, f, ...
|
||||||
|
<span class="org-string">'dx'</span>, pdx, ...
|
||||||
|
<span class="org-string">'dy'</span>, pdy, ...
|
||||||
|
<span class="org-string">'dz'</span>, pdz, ...
|
||||||
|
<span class="org-string">'rx'</span>, prx, ...
|
||||||
|
<span class="org-string">'ry'</span>, pry, ...
|
||||||
|
<span class="org-string">'rz'</span>, prz<span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orga7dcbe9" class="outline-3">
|
||||||
|
<h3 id="orga7dcbe9"><span class="section-number-3">1.2</span> computeSetpoint</h3>
|
||||||
|
<div class="outline-text-3" id="text-1-2">
|
||||||
|
<p>
|
||||||
|
<a id="org879cac6"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This Matlab function is accessible <a href="../src/computeSetpoint.m">here</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name">setpoint</span> = <span class="org-function-name">computeSetpoint</span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">ty</span>, <span class="org-variable-name">ry</span>, <span class="org-variable-name">rz</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%%</span></span>
|
||||||
|
setpoint = zeros<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">6</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Ty</span></span>
|
||||||
|
Ty = <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> ty ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
% Tyinv = [<span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
% <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-type">-</span>ty ;
|
||||||
|
% <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
% <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> ];
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Ry</span></span>
|
||||||
|
Ry = <span class="org-rainbow-delimiters-depth-1">[</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> sin<span class="org-rainbow-delimiters-depth-2">(</span>ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
<span class="org-comment">% TMry = Ty*Ry*Tyinv;</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Rz</span></span>
|
||||||
|
Rz = <span class="org-rainbow-delimiters-depth-1">[</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>rz<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>rz<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
sin<span class="org-rainbow-delimiters-depth-2">(</span>rz<span class="org-rainbow-delimiters-depth-2">)</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>rz<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
<span class="org-comment">% TMrz = Ty*TMry*Rz*TMry'*Tyinv;</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% All stages</span></span>
|
||||||
|
<span class="org-comment">% </span><span class="org-comment"><span class="org-constant">TM </span></span><span class="org-comment">= TMrz*TMry*Ty;</span>
|
||||||
|
|
||||||
|
TM = Ty<span class="org-type">*</span>Ry<span class="org-type">*</span>Rz;
|
||||||
|
|
||||||
|
<span class="org-rainbow-delimiters-depth-1">[</span>thetax, thetay, thetaz<span class="org-rainbow-delimiters-depth-1">]</span> = RM2angle<span class="org-rainbow-delimiters-depth-1">(</span>TM<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
setpoint<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-1">)</span> = TM<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
setpoint<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">4</span><span class="org-type">:</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-1">)</span> = <span class="org-rainbow-delimiters-depth-1">[</span>thetax, thetay, thetaz<span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Custom Functions</span></span>
|
||||||
|
<span class="org-keyword">function</span> <span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">[</span></span><span class="org-variable-name">thetax, thetay, thetaz</span><span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">]</span></span> = <span class="org-function-name">RM2angle</span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">R</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
<span class="org-keyword">if</span> abs<span class="org-rainbow-delimiters-depth-1">(</span>abs<span class="org-rainbow-delimiters-depth-2">(</span>R<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span> <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type">></span> <span class="org-highlight-numbers-number">1e</span><span class="org-type">-</span><span class="org-highlight-numbers-number">6</span> % R31 <span class="org-type">!</span>= <span class="org-highlight-numbers-number">1</span> and R31 <span class="org-type">!</span>= <span class="org-type">-</span><span class="org-highlight-numbers-number">1</span>
|
||||||
|
thetay = <span class="org-type">-</span>asin<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
thetax = atan2<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">/</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>thetay<span class="org-rainbow-delimiters-depth-2">)</span>, R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">/</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>thetay<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
thetaz = atan2<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">2</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">/</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>thetay<span class="org-rainbow-delimiters-depth-2">)</span>, R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">/</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>thetay<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-keyword">else</span>
|
||||||
|
thetaz = <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-keyword">if</span> abs<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">+</span><span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type"><</span> <span class="org-highlight-numbers-number">1e</span><span class="org-type">-</span><span class="org-highlight-numbers-number">6</span> % R31 = <span class="org-type">-</span><span class="org-highlight-numbers-number">1</span>
|
||||||
|
thetay = <span class="org-constant">pi</span><span class="org-type">/</span><span class="org-highlight-numbers-number">2</span>;
|
||||||
|
thetax = thetaz <span class="org-type">+</span> atan2<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-2">)</span>, R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-keyword">else</span>
|
||||||
|
thetay = <span class="org-type">-</span><span class="org-constant">pi</span><span class="org-type">/</span><span class="org-highlight-numbers-number">2</span>;
|
||||||
|
thetax = <span class="org-type">-</span>thetaz <span class="org-type">+</span> atan2<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-type">-</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-2">)</span>, <span class="org-type">-</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org38afc80" class="outline-3">
|
||||||
|
<h3 id="org38afc80"><span class="section-number-3">1.3</span> converErrorBasis</h3>
|
||||||
|
<div class="outline-text-3" id="text-1-3">
|
||||||
|
<p>
|
||||||
|
<a id="org1e357a7"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This Matlab function is accessible <a href="../src/converErrorBasis.m">here</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name">error_nass</span> = <span class="org-function-name">convertErrorBasis</span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">pos</span>, <span class="org-variable-name">setpoint</span>, <span class="org-variable-name">ty</span>, <span class="org-variable-name">ry</span>, <span class="org-variable-name">rz</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
<span class="org-comment">% convertErrorBasis -</span>
|
||||||
|
<span class="org-comment">%</span>
|
||||||
|
<span class="org-comment">% Syntax: convertErrorBasis(p_error, ty, ry, rz)</span>
|
||||||
|
<span class="org-comment">%</span>
|
||||||
|
<span class="org-comment">% Inputs:</span>
|
||||||
|
<span class="org-comment">% - p_error - Position error of the sample w.r.t. the granite [m, rad]</span>
|
||||||
|
<span class="org-comment">% - ty - Measured translation of the Ty stage [m]</span>
|
||||||
|
<span class="org-comment">% - ry - Measured rotation of the Ry stage [rad]</span>
|
||||||
|
<span class="org-comment">% - rz - Measured rotation of the Rz stage [rad]</span>
|
||||||
|
<span class="org-comment">%</span>
|
||||||
|
<span class="org-comment">% Outputs:</span>
|
||||||
|
<span class="org-comment">% - P_nass - Position error of the sample w.r.t. the NASS base [m]</span>
|
||||||
|
<span class="org-comment">% - R_nass - Rotation error of the sample w.r.t. the NASS base [rad]</span>
|
||||||
|
<span class="org-comment">%</span>
|
||||||
|
<span class="org-comment">% Example:</span>
|
||||||
|
<span class="org-comment">%</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% If line vector => column vector</span></span>
|
||||||
|
<span class="org-keyword">if</span> size<span class="org-rainbow-delimiters-depth-1">(</span>pos, <span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type">==</span> <span class="org-highlight-numbers-number">6</span>
|
||||||
|
pos = pos<span class="org-type">'</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
|
||||||
|
<span class="org-keyword">if</span> size<span class="org-rainbow-delimiters-depth-1">(</span>setpoint, <span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type">==</span> <span class="org-highlight-numbers-number">6</span>
|
||||||
|
setpoint = setpoint<span class="org-type">'</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Position of the sample in the frame fixed to the Granite</span></span>
|
||||||
|
P_granite = <span class="org-rainbow-delimiters-depth-1">[</span>pos<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span>; <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-comment">% Position [m]</span>
|
||||||
|
R_granite = <span class="org-rainbow-delimiters-depth-1">[</span>setpoint<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span>; <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-comment">% Reference [m]</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Transformation matrices of the stages</span></span>
|
||||||
|
<span class="org-comment">% T-y</span>
|
||||||
|
TMty = <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> ty ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
<span class="org-comment">% R-y</span>
|
||||||
|
TMry = <span class="org-rainbow-delimiters-depth-1">[</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> sin<span class="org-rainbow-delimiters-depth-2">(</span>ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
<span class="org-comment">% R-z</span>
|
||||||
|
TMrz = <span class="org-rainbow-delimiters-depth-1">[</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>rz<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>rz<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
sin<span class="org-rainbow-delimiters-depth-2">(</span>rz<span class="org-rainbow-delimiters-depth-2">)</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>rz<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Compute Point coordinates in the new reference fixed to the NASS base</span></span>
|
||||||
|
<span class="org-comment">% P_nass = TMrz*TMry*TMty*P_granite;</span>
|
||||||
|
P_nass = TMrz<span class="org-type">\</span>TMry<span class="org-type">\</span>TMty<span class="org-type">\</span>P_granite;
|
||||||
|
R_nass = TMrz<span class="org-type">\</span>TMry<span class="org-type">\</span>TMty<span class="org-type">\</span>R_granite;
|
||||||
|
|
||||||
|
dx = R_nass<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span><span class="org-type">-</span>P_nass<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
dy = R_nass<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-1">)</span><span class="org-type">-</span>P_nass<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
dz = R_nass<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-1">)</span><span class="org-type">-</span>P_nass<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Compute new basis vectors linked to the NASS base</span></span>
|
||||||
|
% ux_nass = TMrz<span class="org-type">*</span>TMry<span class="org-type">*</span>TMty<span class="org-type">*</span>[<span class="org-highlight-numbers-number">1</span>; <span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">0</span>];
|
||||||
|
% ux_nass = ux_nass(<span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span>);
|
||||||
|
% uy_nass = TMrz<span class="org-type">*</span>TMry<span class="org-type">*</span>TMty<span class="org-type">*</span>[<span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">1</span>; <span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">0</span>];
|
||||||
|
% uy_nass = uy_nass(<span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span>);
|
||||||
|
% uz_nass = TMrz<span class="org-type">*</span>TMry<span class="org-type">*</span>TMty<span class="org-type">*</span>[<span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">1</span>; <span class="org-highlight-numbers-number">0</span>];
|
||||||
|
% uz_nass = uz_nass(<span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span>);
|
||||||
|
|
||||||
|
ux_nass = TMrz<span class="org-type">\</span>TMry<span class="org-type">\</span>TMty<span class="org-type">\</span><span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">1</span>; <span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">0</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
ux_nass = ux_nass<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
uy_nass = TMrz<span class="org-type">\</span>TMry<span class="org-type">\</span>TMty<span class="org-type">\</span><span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">1</span>; <span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">0</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
uy_nass = uy_nass<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
uz_nass = TMrz<span class="org-type">\</span>TMry<span class="org-type">\</span>TMty<span class="org-type">\</span><span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">0</span>; <span class="org-highlight-numbers-number">1</span>; <span class="org-highlight-numbers-number">0</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
uz_nass = uz_nass<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Rotations error w.r.t. granite Frame</span></span>
|
||||||
|
<span class="org-comment">% Rotations error w.r.t. granite Frame</span>
|
||||||
|
rx_nass = pos<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
ry_nass = pos<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">5</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
rz_nass = pos<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
<span class="org-comment">% Rotation matrices of the Sample w.r.t. the Granite</span>
|
||||||
|
Mrx_error = <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> cos<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>rx_nass<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>rx_nass<span class="org-rainbow-delimiters-depth-2">)</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> sin<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>rx_nass<span class="org-rainbow-delimiters-depth-2">)</span> cos<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>rx_nass<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
Mry_error = <span class="org-rainbow-delimiters-depth-1">[</span> cos<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>ry_nass<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> sin<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>ry_nass<span class="org-rainbow-delimiters-depth-2">)</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>ry_nass<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> cos<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>ry_nass<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
Mrz_error = <span class="org-rainbow-delimiters-depth-1">[</span>cos<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>rz_nass<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>rz_nass<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
sin<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>rz_nass<span class="org-rainbow-delimiters-depth-2">)</span> cos<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-type">-</span>rz_nass<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
<span class="org-comment">% Rotation matrix of the Sample w.r.t. the Granite</span>
|
||||||
|
Mr_error = Mrz_error<span class="org-type">*</span>Mry_error<span class="org-type">*</span>Mrx_error;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Use matrix to solve</span></span>
|
||||||
|
R = Mr_error<span class="org-type">/</span><span class="org-rainbow-delimiters-depth-1">[</span>ux_nass, uy_nass, uz_nass<span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-comment">% Rotation matrix from NASS base to Sample</span>
|
||||||
|
|
||||||
|
<span class="org-rainbow-delimiters-depth-1">[</span>thetax, thetay, thetaz<span class="org-rainbow-delimiters-depth-1">]</span> = RM2angle<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
error_nass = <span class="org-rainbow-delimiters-depth-1">[</span>dx; dy; dz; thetax; thetay; thetaz<span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Custom Functions</span></span>
|
||||||
|
<span class="org-keyword">function</span> <span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">[</span></span><span class="org-variable-name">thetax, thetay, thetaz</span><span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">]</span></span> = <span class="org-function-name">RM2angle</span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">R</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
<span class="org-keyword">if</span> abs<span class="org-rainbow-delimiters-depth-1">(</span>abs<span class="org-rainbow-delimiters-depth-2">(</span>R<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span> <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type">></span> <span class="org-highlight-numbers-number">1e</span><span class="org-type">-</span><span class="org-highlight-numbers-number">6</span> % R31 <span class="org-type">!</span>= <span class="org-highlight-numbers-number">1</span> and R31 <span class="org-type">!</span>= <span class="org-type">-</span><span class="org-highlight-numbers-number">1</span>
|
||||||
|
thetay = <span class="org-type">-</span>asin<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-comment">% thetaybis = pi-thetay;</span>
|
||||||
|
thetax = atan2<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">/</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>thetay<span class="org-rainbow-delimiters-depth-2">)</span>, R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">/</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>thetay<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
% thetaxbis = atan2(R(<span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">2</span>)<span class="org-type">/</span>cos(thetaybis), R(<span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">3</span>)<span class="org-type">/</span>cos(thetaybis));
|
||||||
|
thetaz = atan2<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">2</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">/</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>thetay<span class="org-rainbow-delimiters-depth-2">)</span>, R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">/</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>thetay<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
% thetazbis = atan2(R(<span class="org-highlight-numbers-number">2</span>, <span class="org-highlight-numbers-number">1</span>)<span class="org-type">/</span>cos(thetaybis), R(<span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">1</span>)<span class="org-type">/</span>cos(thetaybis));
|
||||||
|
<span class="org-keyword">else</span>
|
||||||
|
thetaz = <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-keyword">if</span> abs<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">+</span><span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type"><</span> <span class="org-highlight-numbers-number">1e</span><span class="org-type">-</span><span class="org-highlight-numbers-number">6</span> % R31 = <span class="org-type">-</span><span class="org-highlight-numbers-number">1</span>
|
||||||
|
thetay = <span class="org-constant">pi</span><span class="org-type">/</span><span class="org-highlight-numbers-number">2</span>;
|
||||||
|
thetax = thetaz <span class="org-type">+</span> atan2<span class="org-rainbow-delimiters-depth-1">(</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-2">)</span>, R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-keyword">else</span>
|
||||||
|
thetay = <span class="org-type">-</span><span class="org-constant">pi</span><span class="org-type">/</span><span class="org-highlight-numbers-number">2</span>;
|
||||||
|
thetax = <span class="org-type">-</span>thetaz <span class="org-type">+</span> atan2<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-type">-</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-2">)</span>, <span class="org-type">-</span>R<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span>, <span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orge0e5103" class="outline-3">
|
||||||
|
<h3 id="orge0e5103"><span class="section-number-3">1.4</span> generateDiagPidControl</h3>
|
||||||
|
<div class="outline-text-3" id="text-1-4">
|
||||||
|
<p>
|
||||||
|
<a id="org0799e34"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This Matlab function is accessible <a href="../src/generateDiagPidControl.m">here</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">[</span></span><span class="org-variable-name">K</span><span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">]</span></span> = <span class="org-function-name">generateDiagPidControl</span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">G</span>, <span class="org-variable-name">fs</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%%</span></span>
|
||||||
|
pid_opts = pidtuneOptions<span class="org-rainbow-delimiters-depth-1">(</span>...
|
||||||
|
<span class="org-string">'PhaseMargin'</span>, <span class="org-highlight-numbers-number">50</span>, ...
|
||||||
|
<span class="org-string">'DesignFocus'</span>, <span class="org-string">'disturbance-rejection'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%%</span></span>
|
||||||
|
K = tf<span class="org-rainbow-delimiters-depth-1">(</span>zeros<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-constant">i</span></span> = <span class="org-constant"><span class="org-highlight-numbers-number">1</span></span><span class="org-constant">:</span><span class="org-constant"><span class="org-highlight-numbers-number">6</span></span>
|
||||||
|
input_name = G.InputName<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-constant">i</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
output_name = G.OutputName<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-constant">i</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
K<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-constant">i</span>, <span class="org-constant">i</span><span class="org-rainbow-delimiters-depth-1">)</span> = tf<span class="org-rainbow-delimiters-depth-1">(</span>pidtune<span class="org-rainbow-delimiters-depth-2">(</span>minreal<span class="org-rainbow-delimiters-depth-3">(</span>G<span class="org-rainbow-delimiters-depth-4">(</span>output_name, input_name<span class="org-rainbow-delimiters-depth-4">)</span><span class="org-rainbow-delimiters-depth-3">)</span>, <span class="org-string">'PIDF'</span>, <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>fs, pid_opts<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
|
||||||
|
K.InputName = G.OutputName;
|
||||||
|
K.OutputName = G.InputName;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orga0abbff" class="outline-3">
|
||||||
|
<h3 id="orga0abbff"><span class="section-number-3">1.5</span> identifyPlant</h3>
|
||||||
|
<div class="outline-text-3" id="text-1-5">
|
||||||
|
<p>
|
||||||
|
<a id="org348e5c9"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This Matlab function is accessible <a href="../src/identifyPlant.m">here</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">[</span></span><span class="org-variable-name">sys</span><span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">]</span></span> = <span class="org-function-name">identifyPlant</span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">opts_param</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Default values for opts</span></span>
|
||||||
|
opts = struct<span class="org-rainbow-delimiters-depth-1">()</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Populate opts with input parameters</span></span>
|
||||||
|
<span class="org-keyword">if</span> exist<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'opts_param'</span>,<span class="org-string">'var'</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
<span class="org-keyword">for</span> <span class="org-variable-name">opt</span> = <span class="org-constant">fieldnames</span><span class="org-constant"><span class="org-rainbow-delimiters-depth-1">(</span></span><span class="org-constant">opts_param</span><span class="org-constant"><span class="org-rainbow-delimiters-depth-1">)</span></span><span class="org-constant">'</span>
|
||||||
|
opts.<span class="org-rainbow-delimiters-depth-1">(</span>opt<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">}</span><span class="org-rainbow-delimiters-depth-1">)</span> = opts_param.<span class="org-rainbow-delimiters-depth-1">(</span>opt<span class="org-rainbow-delimiters-depth-2">{</span><span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">}</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Options for Linearized</span></span>
|
||||||
|
options = linearizeOptions;
|
||||||
|
options.SampleTime = <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Name of the Simulink File</span></span>
|
||||||
|
mdl = <span class="org-string">'sim_nano_station_id'</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Input/Output definition</span></span>
|
||||||
|
io<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span> = linio<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-rainbow-delimiters-depth-2">[</span>mdl, <span class="org-string">'/Fn'</span><span class="org-rainbow-delimiters-depth-2">]</span>, <span class="org-highlight-numbers-number">1</span>, <span class="org-string">'input'</span><span class="org-rainbow-delimiters-depth-1">)</span>; <span class="org-comment">% Cartesian forces applied by NASS</span>
|
||||||
|
io<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-1">)</span> = linio<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-rainbow-delimiters-depth-2">[</span>mdl, <span class="org-string">'/Dw'</span><span class="org-rainbow-delimiters-depth-2">]</span>, <span class="org-highlight-numbers-number">1</span>, <span class="org-string">'input'</span><span class="org-rainbow-delimiters-depth-1">)</span>; <span class="org-comment">% Ground Motion</span>
|
||||||
|
io<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-1">)</span> = linio<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-rainbow-delimiters-depth-2">[</span>mdl, <span class="org-string">'/Fs'</span><span class="org-rainbow-delimiters-depth-2">]</span>, <span class="org-highlight-numbers-number">1</span>, <span class="org-string">'input'</span><span class="org-rainbow-delimiters-depth-1">)</span>; <span class="org-comment">% External forces on the sample</span>
|
||||||
|
io<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-1">)</span> = linio<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-rainbow-delimiters-depth-2">[</span>mdl, <span class="org-string">'/Fnl'</span><span class="org-rainbow-delimiters-depth-2">]</span>, <span class="org-highlight-numbers-number">1</span>, <span class="org-string">'input'</span><span class="org-rainbow-delimiters-depth-1">)</span>; <span class="org-comment">% Forces applied on the NASS's legs</span>
|
||||||
|
io<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">5</span><span class="org-rainbow-delimiters-depth-1">)</span> = linio<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-rainbow-delimiters-depth-2">[</span>mdl, <span class="org-string">'/Fd'</span><span class="org-rainbow-delimiters-depth-2">]</span>, <span class="org-highlight-numbers-number">1</span>, <span class="org-string">'input'</span><span class="org-rainbow-delimiters-depth-1">)</span>; <span class="org-comment">% Disturbance Forces</span>
|
||||||
|
io<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-1">)</span> = linio<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-rainbow-delimiters-depth-2">[</span>mdl, <span class="org-string">'/Dsm'</span><span class="org-rainbow-delimiters-depth-2">]</span>, <span class="org-highlight-numbers-number">1</span>, <span class="org-string">'output'</span><span class="org-rainbow-delimiters-depth-1">)</span>; <span class="org-comment">% Displacement of the sample</span>
|
||||||
|
io<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">7</span><span class="org-rainbow-delimiters-depth-1">)</span> = linio<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-rainbow-delimiters-depth-2">[</span>mdl, <span class="org-string">'/Fnlm'</span><span class="org-rainbow-delimiters-depth-2">]</span>, <span class="org-highlight-numbers-number">1</span>, <span class="org-string">'output'</span><span class="org-rainbow-delimiters-depth-1">)</span>; <span class="org-comment">% Force sensor in NASS's legs</span>
|
||||||
|
io<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">8</span><span class="org-rainbow-delimiters-depth-1">)</span> = linio<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-rainbow-delimiters-depth-2">[</span>mdl, <span class="org-string">'/Dnlm'</span><span class="org-rainbow-delimiters-depth-2">]</span>, <span class="org-highlight-numbers-number">1</span>, <span class="org-string">'output'</span><span class="org-rainbow-delimiters-depth-1">)</span>; <span class="org-comment">% Displacement of NASS's legs</span>
|
||||||
|
io<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">9</span><span class="org-rainbow-delimiters-depth-1">)</span> = linio<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-rainbow-delimiters-depth-2">[</span>mdl, <span class="org-string">'/Es'</span><span class="org-rainbow-delimiters-depth-2">]</span>, <span class="org-highlight-numbers-number">1</span>, <span class="org-string">'output'</span><span class="org-rainbow-delimiters-depth-1">)</span>; <span class="org-comment">% Position Error w.r.t. NASS base</span>
|
||||||
|
io<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">10</span><span class="org-rainbow-delimiters-depth-1">)</span> = linio<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-rainbow-delimiters-depth-2">[</span>mdl, <span class="org-string">'/Vlm'</span><span class="org-rainbow-delimiters-depth-2">]</span>, <span class="org-highlight-numbers-number">1</span>, <span class="org-string">'output'</span><span class="org-rainbow-delimiters-depth-1">)</span>; <span class="org-comment">% Measured absolute velocity of the legs</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Run the linearization</span></span>
|
||||||
|
G = linearize<span class="org-rainbow-delimiters-depth-1">(</span>mdl, io, options<span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
G.InputName = <span class="org-rainbow-delimiters-depth-1">{</span><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>, ...
|
||||||
|
<span class="org-string">'Dgx'</span>, <span class="org-string">'Dgy'</span>, <span class="org-string">'Dgz'</span>, ...
|
||||||
|
<span class="org-string">'Fsx'</span>, <span class="org-string">'Fsy'</span>, <span class="org-string">'Fsz'</span>, <span class="org-string">'Msx'</span>, <span class="org-string">'Msy'</span>, <span class="org-string">'Msz'</span>, ...
|
||||||
|
<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>, ...
|
||||||
|
<span class="org-string">'Frzz'</span>, <span class="org-string">'Ftyx'</span>, <span class="org-string">'Ftyz'</span><span class="org-rainbow-delimiters-depth-1">}</span>;
|
||||||
|
G.OutputName = <span class="org-rainbow-delimiters-depth-1">{</span><span class="org-string">'Dx'</span>, <span class="org-string">'Dy'</span>, <span class="org-string">'Dz'</span>, <span class="org-string">'Rx'</span>, <span class="org-string">'Ry'</span>, <span class="org-string">'Rz'</span>, ...
|
||||||
|
<span class="org-string">'Fm1'</span>, <span class="org-string">'Fm2'</span>, <span class="org-string">'Fm3'</span>, <span class="org-string">'Fm4'</span>, <span class="org-string">'Fm5'</span>, <span class="org-string">'Fm6'</span>, ...
|
||||||
|
<span class="org-string">'Dm1'</span>, <span class="org-string">'Dm2'</span>, <span class="org-string">'Dm3'</span>, <span class="org-string">'Dm4'</span>, <span class="org-string">'Dm5'</span>, <span class="org-string">'Dm6'</span>, ...
|
||||||
|
<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>, ...
|
||||||
|
<span class="org-string">'Vm1'</span>, <span class="org-string">'Vm2'</span>, <span class="org-string">'Vm3'</span>, <span class="org-string">'Vm4'</span>, <span class="org-string">'Vm5'</span>, <span class="org-string">'Vm6'</span><span class="org-rainbow-delimiters-depth-1">}</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Create the sub transfer functions</span></span>
|
||||||
|
minreal_tol = sqrt<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-constant">eps</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-comment">% From forces applied in the cartesian frame to displacement of the sample in the cartesian frame</span>
|
||||||
|
sys.G_cart = minreal<span class="org-rainbow-delimiters-depth-1">(</span>G<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-rainbow-delimiters-depth-3">{</span><span class="org-string">'Dx'</span>, <span class="org-string">'Dy'</span>, <span class="org-string">'Dz'</span>, <span class="org-string">'Rx'</span>, <span class="org-string">'Ry'</span>, <span class="org-string">'Rz'</span><span class="org-rainbow-delimiters-depth-3">}</span>, <span class="org-rainbow-delimiters-depth-3">{</span><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><span class="org-rainbow-delimiters-depth-3">}</span><span class="org-rainbow-delimiters-depth-2">)</span>, minreal_tol, <span class="org-constant">false</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-comment">% From ground motion to Sample displacement</span>
|
||||||
|
sys.G_gm = minreal<span class="org-rainbow-delimiters-depth-1">(</span>G<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-rainbow-delimiters-depth-3">{</span><span class="org-string">'Dx'</span>, <span class="org-string">'Dy'</span>, <span class="org-string">'Dz'</span>, <span class="org-string">'Rx'</span>, <span class="org-string">'Ry'</span>, <span class="org-string">'Rz'</span><span class="org-rainbow-delimiters-depth-3">}</span>, <span class="org-rainbow-delimiters-depth-3">{</span><span class="org-string">'Dgx'</span>, <span class="org-string">'Dgy'</span>, <span class="org-string">'Dgz'</span><span class="org-rainbow-delimiters-depth-3">}</span><span class="org-rainbow-delimiters-depth-2">)</span>, minreal_tol, <span class="org-constant">false</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-comment">% From direct forces applied on the sample to displacement of the sample</span>
|
||||||
|
sys.G_fs = minreal<span class="org-rainbow-delimiters-depth-1">(</span>G<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-rainbow-delimiters-depth-3">{</span><span class="org-string">'Dx'</span>, <span class="org-string">'Dy'</span>, <span class="org-string">'Dz'</span>, <span class="org-string">'Rx'</span>, <span class="org-string">'Ry'</span>, <span class="org-string">'Rz'</span><span class="org-rainbow-delimiters-depth-3">}</span>, <span class="org-rainbow-delimiters-depth-3">{</span><span class="org-string">'Fsx'</span>, <span class="org-string">'Fsy'</span>, <span class="org-string">'Fsz'</span>, <span class="org-string">'Msx'</span>, <span class="org-string">'Msy'</span>, <span class="org-string">'Msz'</span><span class="org-rainbow-delimiters-depth-3">}</span><span class="org-rainbow-delimiters-depth-2">)</span>, minreal_tol, <span class="org-constant">false</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-comment">% From forces applied on NASS's legs to force sensor in each leg</span>
|
||||||
|
sys.G_iff = minreal<span class="org-rainbow-delimiters-depth-1">(</span>G<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-rainbow-delimiters-depth-3">{</span><span class="org-string">'Fm1'</span>, <span class="org-string">'Fm2'</span>, <span class="org-string">'Fm3'</span>, <span class="org-string">'Fm4'</span>, <span class="org-string">'Fm5'</span>, <span class="org-string">'Fm6'</span><span class="org-rainbow-delimiters-depth-3">}</span>, <span class="org-rainbow-delimiters-depth-3">{</span><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><span class="org-rainbow-delimiters-depth-3">}</span><span class="org-rainbow-delimiters-depth-2">)</span>, minreal_tol, <span class="org-constant">false</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-comment">% From forces applied on NASS's legs to displacement of each leg</span>
|
||||||
|
sys.G_dleg = minreal<span class="org-rainbow-delimiters-depth-1">(</span>G<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-rainbow-delimiters-depth-3">{</span><span class="org-string">'Dm1'</span>, <span class="org-string">'Dm2'</span>, <span class="org-string">'Dm3'</span>, <span class="org-string">'Dm4'</span>, <span class="org-string">'Dm5'</span>, <span class="org-string">'Dm6'</span><span class="org-rainbow-delimiters-depth-3">}</span>, <span class="org-rainbow-delimiters-depth-3">{</span><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><span class="org-rainbow-delimiters-depth-3">}</span><span class="org-rainbow-delimiters-depth-2">)</span>, minreal_tol, <span class="org-constant">false</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-comment">% From forces/torques applied by the NASS to position error</span>
|
||||||
|
sys.G_plant = minreal<span class="org-rainbow-delimiters-depth-1">(</span>G<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-rainbow-delimiters-depth-3">{</span><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><span class="org-rainbow-delimiters-depth-3">}</span>, <span class="org-rainbow-delimiters-depth-3">{</span><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><span class="org-rainbow-delimiters-depth-3">}</span><span class="org-rainbow-delimiters-depth-2">)</span>, minreal_tol, <span class="org-constant">false</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-comment">% From forces/torques applied by the NASS to velocity of the actuator</span>
|
||||||
|
sys.G_geoph = minreal<span class="org-rainbow-delimiters-depth-1">(</span>G<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-rainbow-delimiters-depth-3">{</span><span class="org-string">'Vm1'</span>, <span class="org-string">'Vm2'</span>, <span class="org-string">'Vm3'</span>, <span class="org-string">'Vm4'</span>, <span class="org-string">'Vm5'</span>, <span class="org-string">'Vm6'</span><span class="org-rainbow-delimiters-depth-3">}</span>, <span class="org-rainbow-delimiters-depth-3">{</span><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><span class="org-rainbow-delimiters-depth-3">}</span><span class="org-rainbow-delimiters-depth-2">)</span>, minreal_tol, <span class="org-constant">false</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-comment">% From various disturbance forces to position error</span>
|
||||||
|
sys.G_dist = minreal<span class="org-rainbow-delimiters-depth-1">(</span>G<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-rainbow-delimiters-depth-3">{</span><span class="org-string">'Dx'</span>, <span class="org-string">'Dy'</span>, <span class="org-string">'Dz'</span>, <span class="org-string">'Rx'</span>, <span class="org-string">'Ry'</span>, <span class="org-string">'Rz'</span><span class="org-rainbow-delimiters-depth-3">}</span>, <span class="org-rainbow-delimiters-depth-3">{</span><span class="org-string">'Frzz'</span>, <span class="org-string">'Ftyx'</span>, <span class="org-string">'Ftyz'</span><span class="org-rainbow-delimiters-depth-3">}</span><span class="org-rainbow-delimiters-depth-2">)</span>, minreal_tol, <span class="org-constant">false</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% We remove low frequency and high frequency dynamics that are usually unstable</span></span>
|
||||||
|
<span class="org-comment">% using =freqsep= is risky as it may change the shape of the transfer functions</span>
|
||||||
|
% f_min = <span class="org-highlight-numbers-number">0</span>.<span class="org-highlight-numbers-number">1</span>; % [Hz]
|
||||||
|
% f_max = <span class="org-highlight-numbers-number">1e4</span>; % [Hz]
|
||||||
|
|
||||||
|
% [<span class="org-type">~</span>, sys.G_cart] = freqsep(freqsep(sys.G_cart, <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_max), <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_min);
|
||||||
|
% [<span class="org-type">~</span>, sys.G_gm] = freqsep(freqsep(sys.G_gm, <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_max), <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_min);
|
||||||
|
% [<span class="org-type">~</span>, sys.G_fs] = freqsep(freqsep(sys.G_fs, <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_max), <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_min);
|
||||||
|
% [<span class="org-type">~</span>, sys.G_iff] = freqsep(freqsep(sys.G_iff, <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_max), <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_min);
|
||||||
|
% [<span class="org-type">~</span>, sys.G_dleg] = freqsep(freqsep(sys.G_dleg, <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_max), <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_min);
|
||||||
|
% [<span class="org-type">~</span>, sys.G_plant] = freqsep(freqsep(sys.G_plant, <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_max), <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>f_min);
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% We finally verify that the system is stable</span></span>
|
||||||
|
<span class="org-keyword">if</span> <span class="org-type">~</span>isstable<span class="org-rainbow-delimiters-depth-1">(</span>sys.G_cart<span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type">||</span> <span class="org-type">~</span>isstable<span class="org-rainbow-delimiters-depth-1">(</span>sys.G_gm<span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type">||</span> <span class="org-type">~</span>isstable<span class="org-rainbow-delimiters-depth-1">(</span>sys.G_fs<span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type">||</span> <span class="org-type">~</span>isstable<span class="org-rainbow-delimiters-depth-1">(</span>sys.G_iff<span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type">||</span> <span class="org-type">~</span>isstable<span class="org-rainbow-delimiters-depth-1">(</span>sys.G_dleg<span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type">||</span> <span class="org-type">~</span>isstable<span class="org-rainbow-delimiters-depth-1">(</span>sys.G_plant<span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
warning<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'One of the identified system is unstable'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-orgd0e3a86" class="outline-3">
|
||||||
|
<h3 id="orgd0e3a86"><span class="section-number-3">1.6</span> runSimulation</h3>
|
||||||
|
<div class="outline-text-3" id="text-1-6">
|
||||||
|
<p>
|
||||||
|
<a id="orgc58251f"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This Matlab function is accessible <a href="../src/runSimulation.m">here</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">[]</span></span> = <span class="org-function-name">runSimulation</span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">sys_name</span>, <span class="org-variable-name">sys_mass</span>, <span class="org-variable-name">ctrl_type</span>, <span class="org-variable-name">act_damp</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Load the controller and save it for the simulation</span></span>
|
||||||
|
<span class="org-keyword">if</span> strcmp<span class="org-rainbow-delimiters-depth-1">(</span>ctrl_type, <span class="org-string">'cl'</span><span class="org-rainbow-delimiters-depth-1">)</span> <span class="org-type">&&</span> strcmp<span class="org-rainbow-delimiters-depth-1">(</span>act_damp, <span class="org-string">'none'</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
K_obj = load<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-string">'./mat/K_fb.mat'</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
K = K_obj.<span class="org-rainbow-delimiters-depth-1">(</span>sprintf<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-string">'K_%s_%s'</span>, sys_mass, sys_name)); <span class="org-comment">%#</span><span class="org-comment"><span class="org-bold">ok</span></span>
|
||||||
|
save<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-string">'./mat/controllers.mat'</span>, <span class="org-string">'K'</span><span class="org-rainbow-delimiters-depth-3">)</span>;
|
||||||
|
<span class="org-keyword">elseif</span> strcmp<span class="org-rainbow-delimiters-depth-3">(</span>ctrl_type, <span class="org-string">'cl'</span><span class="org-rainbow-delimiters-depth-3">)</span> <span class="org-type">&&</span> strcmp<span class="org-rainbow-delimiters-depth-3">(</span>act_damp, <span class="org-string">'iff'</span><span class="org-rainbow-delimiters-depth-3">)</span>
|
||||||
|
K_obj = load<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-string">'./mat/K_fb_iff.mat'</span><span class="org-rainbow-delimiters-depth-3">)</span>;
|
||||||
|
K = K_obj.<span class="org-rainbow-delimiters-depth-3">(</span>sprintf<span class="org-rainbow-delimiters-depth-4">(</span><span class="org-string">'K_%s_%s_iff'</span>, sys_mass, sys_name)); <span class="org-comment">%#</span><span class="org-comment"><span class="org-bold">ok</span></span>
|
||||||
|
save<span class="org-rainbow-delimiters-depth-5">(</span><span class="org-string">'./mat/controllers.mat'</span>, <span class="org-string">'K'</span><span class="org-rainbow-delimiters-depth-5">)</span>;
|
||||||
|
<span class="org-keyword">elseif</span> strcmp<span class="org-rainbow-delimiters-depth-5">(</span>ctrl_type, <span class="org-string">'ol'</span><span class="org-rainbow-delimiters-depth-5">)</span>
|
||||||
|
K = tf<span class="org-rainbow-delimiters-depth-5">(</span>zeros<span class="org-rainbow-delimiters-depth-6">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-6">)</span><span class="org-rainbow-delimiters-depth-5">)</span>; <span class="org-comment">%#</span><span class="org-comment"><span class="org-bold">ok</span></span>
|
||||||
|
save<span class="org-rainbow-delimiters-depth-5">(</span><span class="org-string">'./mat/controllers.mat'</span>, <span class="org-string">'K'</span><span class="org-rainbow-delimiters-depth-5">)</span>;
|
||||||
|
<span class="org-keyword">else</span>
|
||||||
|
error<span class="org-rainbow-delimiters-depth-5">(</span><span class="org-string">'ctrl_type should be cl or ol'</span><span class="org-rainbow-delimiters-depth-5">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Active Damping</span></span>
|
||||||
|
<span class="org-keyword">if</span> strcmp<span class="org-rainbow-delimiters-depth-5">(</span>act_damp, <span class="org-string">'iff'</span><span class="org-rainbow-delimiters-depth-5">)</span>
|
||||||
|
K_iff_crit = load<span class="org-rainbow-delimiters-depth-5">(</span><span class="org-string">'./mat/K_iff_crit.mat'</span><span class="org-rainbow-delimiters-depth-5">)</span>;
|
||||||
|
K_iff = K_iff_crit.<span class="org-rainbow-delimiters-depth-5">(</span>sprintf<span class="org-rainbow-delimiters-depth-6">(</span><span class="org-string">'K_iff_%s_%s'</span>, sys_mass, sys_name)); <span class="org-comment">%#</span><span class="org-comment"><span class="org-bold">ok</span></span>
|
||||||
|
save<span class="org-rainbow-delimiters-depth-7">(</span><span class="org-string">'./mat/controllers.mat'</span>, <span class="org-string">'K_iff'</span>, <span class="org-string">'-append'</span><span class="org-rainbow-delimiters-depth-7">)</span>;
|
||||||
|
<span class="org-keyword">elseif</span> strcmp<span class="org-rainbow-delimiters-depth-7">(</span>act_damp, <span class="org-string">'none'</span><span class="org-rainbow-delimiters-depth-7">)</span>
|
||||||
|
K_iff = tf<span class="org-rainbow-delimiters-depth-7">(</span>zeros<span class="org-rainbow-delimiters-depth-8">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-8">)</span><span class="org-rainbow-delimiters-depth-7">)</span>; <span class="org-comment">%#</span><span class="org-comment"><span class="org-bold">ok</span></span>
|
||||||
|
save<span class="org-rainbow-delimiters-depth-7">(</span><span class="org-string">'./mat/controllers.mat'</span>, <span class="org-string">'K_iff'</span>, <span class="org-string">'-append'</span><span class="org-rainbow-delimiters-depth-7">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%%</span></span>
|
||||||
|
<span class="org-keyword">if</span> strcmp<span class="org-rainbow-delimiters-depth-7">(</span>sys_name, <span class="org-string">'pz'</span><span class="org-rainbow-delimiters-depth-7">)</span>
|
||||||
|
initializeNanoHexapod<span class="org-rainbow-delimiters-depth-7">(</span>struct<span class="org-rainbow-delimiters-depth-8">(</span><span class="org-string">'actuator'</span>, <span class="org-string">'piezo'</span><span class="org-rainbow-delimiters-depth-8">)</span><span class="org-rainbow-delimiters-depth-7">)</span>;
|
||||||
|
<span class="org-keyword">elseif</span> strcmp<span class="org-rainbow-delimiters-depth-7">(</span>sys_name, <span class="org-string">'vc'</span><span class="org-rainbow-delimiters-depth-7">)</span>
|
||||||
|
initializeNanoHexapod<span class="org-rainbow-delimiters-depth-7">(</span>struct<span class="org-rainbow-delimiters-depth-8">(</span><span class="org-string">'actuator'</span>, <span class="org-string">'lorentz'</span><span class="org-rainbow-delimiters-depth-8">)</span><span class="org-rainbow-delimiters-depth-7">)</span>;
|
||||||
|
<span class="org-keyword">else</span>
|
||||||
|
error<span class="org-rainbow-delimiters-depth-7">(</span><span class="org-string">'sys_name should be pz or vc'</span><span class="org-rainbow-delimiters-depth-7">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
|
||||||
|
<span class="org-keyword">if</span> strcmp<span class="org-rainbow-delimiters-depth-7">(</span>sys_mass, <span class="org-string">'light'</span><span class="org-rainbow-delimiters-depth-7">)</span>
|
||||||
|
initializeSample<span class="org-rainbow-delimiters-depth-7">(</span>struct<span class="org-rainbow-delimiters-depth-8">(</span><span class="org-string">'mass'</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-8">)</span><span class="org-rainbow-delimiters-depth-7">)</span>;
|
||||||
|
<span class="org-keyword">elseif</span> strcmp<span class="org-rainbow-delimiters-depth-7">(</span>sys_mass, <span class="org-string">'heavy'</span><span class="org-rainbow-delimiters-depth-7">)</span>
|
||||||
|
initializeSample<span class="org-rainbow-delimiters-depth-7">(</span>struct<span class="org-rainbow-delimiters-depth-8">(</span><span class="org-string">'mass'</span>, <span class="org-highlight-numbers-number">50</span><span class="org-rainbow-delimiters-depth-8">)</span><span class="org-rainbow-delimiters-depth-7">)</span>;
|
||||||
|
<span class="org-keyword">else</span>
|
||||||
|
error<span class="org-rainbow-delimiters-depth-7">(</span><span class="org-string">'sys_mass should be light or heavy'</span><span class="org-rainbow-delimiters-depth-7">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Run the simulation</span></span>
|
||||||
|
<span class="org-matlab-simulink-keyword">sim</span><span class="org-rainbow-delimiters-depth-7">(</span><span class="org-string">'sim_nano_station_ctrl.slx'</span><span class="org-rainbow-delimiters-depth-7">)</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Split the Dsample matrix into vectors</span></span>
|
||||||
|
<span class="org-rainbow-delimiters-depth-7">[</span>Dx, Dy, Dz, Rx, Ry, Rz<span class="org-rainbow-delimiters-depth-7">]</span> = matSplit<span class="org-rainbow-delimiters-depth-7">(</span>Es.Data, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-7">)</span>; <span class="org-comment">%#</span><span class="org-comment"><span class="org-bold">ok</span></span>
|
||||||
|
time = Dsample.Time; <span class="org-comment">%#</span><span class="org-comment"><span class="org-bold">ok</span></span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Save the result</span></span>
|
||||||
|
filename = sprintf<span class="org-rainbow-delimiters-depth-7">(</span><span class="org-string">'sim_%s_%s_%s_%s'</span>, sys_mass, sys_name, ctrl_type, act_damp);
|
||||||
|
save<span class="org-rainbow-delimiters-depth-8">(</span>sprintf<span class="org-rainbow-delimiters-depth-9">(</span><span class="org-string">'./mat/%s.mat'</span>, filename), ...
|
||||||
|
<span class="org-string">'time'</span>, <span class="org-string">'Dx'</span>, <span class="org-string">'Dy'</span>, <span class="org-string">'Dz'</span>, <span class="org-string">'Rx'</span>, <span class="org-string">'Ry'</span>, <span class="org-string">'Rz'</span>, <span class="org-string">'K'</span><span class="org-rainbow-delimiters-depth-9">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="outline-container-org288e05d" class="outline-3">
|
||||||
|
<h3 id="org288e05d"><span class="section-number-3">1.7</span> Inverse Kinematics of the Hexapod</h3>
|
||||||
|
<div class="outline-text-3" id="text-1-7">
|
||||||
|
<p>
|
||||||
|
<a id="orgd4c4eda"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This Matlab function is accessible <a href="src/inverseKinematicsHexapod.m">here</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">[</span></span><span class="org-variable-name">L</span><span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">]</span></span> = <span class="org-function-name">inverseKinematicsHexapod</span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">hexapod</span>, <span class="org-variable-name">AP</span>, <span class="org-variable-name">ARB</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
<span class="org-comment">% inverseKinematicsHexapod - Compute the initial position of each leg to have the wanted Hexapod's position</span>
|
||||||
|
<span class="org-comment">%</span>
|
||||||
|
<span class="org-comment">% Syntax: inverseKinematicsHexapod(hexapod, AP, ARB)</span>
|
||||||
|
<span class="org-comment">%</span>
|
||||||
|
<span class="org-comment">% Inputs:</span>
|
||||||
|
<span class="org-comment">% - hexapod - Hexapod object containing the geometry of the hexapod</span>
|
||||||
|
<span class="org-comment">% - AP - Position vector of point OB expressed in frame {A} in [m]</span>
|
||||||
|
<span class="org-comment">% - ARB - Rotation Matrix expressed in frame {A}</span>
|
||||||
|
|
||||||
|
<span class="org-comment">% Wanted Length of the hexapod's legs [m]</span>
|
||||||
|
L = zeros<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">6</span>, <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
|
||||||
|
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-constant">i</span></span> = <span class="org-constant"><span class="org-highlight-numbers-number">1</span></span><span class="org-constant">:length</span><span class="org-constant"><span class="org-rainbow-delimiters-depth-1">(</span></span><span class="org-constant">L</span><span class="org-constant"><span class="org-rainbow-delimiters-depth-1">)</span></span>
|
||||||
|
Bbi = hexapod.pos_top_tranform<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-constant">i</span>, <span class="org-type">:</span><span class="org-rainbow-delimiters-depth-1">)</span><span class="org-type">'</span> <span class="org-type">-</span> <span class="org-highlight-numbers-number">1e</span><span class="org-type">-</span><span class="org-highlight-numbers-number">3</span><span class="org-type">*</span><span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">0</span> ; <span class="org-highlight-numbers-number">0</span> ; hexapod.TP.thickness<span class="org-type">+</span>hexapod.Leg.sphere.top<span class="org-type">+</span>hexapod.SP.thickness.top<span class="org-type">+</span>hexapod.jacobian<span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-comment">% [m]</span>
|
||||||
|
Aai = hexapod.pos_base<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-constant">i</span>, <span class="org-type">:</span><span class="org-rainbow-delimiters-depth-1">)</span><span class="org-type">'</span> <span class="org-type">+</span> <span class="org-highlight-numbers-number">1e</span><span class="org-type">-</span><span class="org-highlight-numbers-number">3</span><span class="org-type">*</span><span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">0</span> ; <span class="org-highlight-numbers-number">0</span> ; hexapod.BP.thickness<span class="org-type">+</span>hexapod.Leg.sphere.bottom<span class="org-type">+</span>hexapod.SP.thickness.bottom<span class="org-type">-</span>hexapod.h<span class="org-type">-</span>hexapod.jacobian<span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-comment">% [m]</span>
|
||||||
|
|
||||||
|
L<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-constant">i</span><span class="org-rainbow-delimiters-depth-1">)</span> = sqrt<span class="org-rainbow-delimiters-depth-1">(</span>AP<span class="org-type">'*</span>AP <span class="org-type">+</span> Bbi<span class="org-type">'*</span>Bbi <span class="org-type">+</span> Aai<span class="org-type">'*</span>Aai <span class="org-type">-</span> <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span>AP<span class="org-type">'*</span>Aai <span class="org-type">+</span> <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span>AP<span class="org-type">'*</span><span class="org-rainbow-delimiters-depth-2">(</span>ARB<span class="org-type">*</span>Bbi<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span> <span class="org-highlight-numbers-number">2</span><span class="org-type">*</span><span class="org-rainbow-delimiters-depth-2">(</span>ARB<span class="org-type">*</span>Bbi<span class="org-rainbow-delimiters-depth-2">)</span><span class="org-type">'*</span>Aai<span class="org-rainbow-delimiters-depth-1">)</span>;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="outline-container-org33a19ae" class="outline-3">
|
||||||
|
<h3 id="org33a19ae"><span class="section-number-3">1.8</span> computeReferencePose</h3>
|
||||||
|
<div class="outline-text-3" id="text-1-8">
|
||||||
|
<p>
|
||||||
|
<a id="org14f924b"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This Matlab function is accessible <a href="src/computeReferencePose.m">here</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">[</span></span><span class="org-variable-name">WTr</span><span class="org-variable-name"><span class="org-rainbow-delimiters-depth-1">]</span></span> = <span class="org-function-name">computeReferencePose</span><span class="org-rainbow-delimiters-depth-1">(</span><span class="org-variable-name">Dy</span>, <span class="org-variable-name">Ry</span>, <span class="org-variable-name">Rz</span>, <span class="org-variable-name">Dh</span>, <span class="org-variable-name">Dn</span><span class="org-rainbow-delimiters-depth-1">)</span>
|
||||||
|
<span class="org-comment">% computeReferencePose - Compute the homogeneous transformation matrix corresponding to the wanted pose of the sample</span>
|
||||||
|
<span class="org-comment">%</span>
|
||||||
|
<span class="org-comment">% Syntax: [WTr] = computeReferencePose(Dy, Ry, Rz, Dh, Dn)</span>
|
||||||
|
<span class="org-comment">%</span>
|
||||||
|
<span class="org-comment">% Inputs:</span>
|
||||||
|
<span class="org-comment">% - Dy - Reference of the Translation Stage [m]</span>
|
||||||
|
<span class="org-comment">% - Ry - Reference of the Tilt Stage [rad]</span>
|
||||||
|
<span class="org-comment">% - Rz - Reference of the Spindle [rad]</span>
|
||||||
|
<span class="org-comment">% - Dh - Reference of the Micro Hexapod (Pitch, Roll, Yaw angles) [m, m, m, rad, rad, rad]</span>
|
||||||
|
<span class="org-comment">% - Dn - Reference of the Nano Hexapod [m, m, m, rad, rad, rad]</span>
|
||||||
|
<span class="org-comment">%</span>
|
||||||
|
<span class="org-comment">% Outputs:</span>
|
||||||
|
<span class="org-comment">% - WTr -</span>
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Translation Stage</span></span>
|
||||||
|
Rty = <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> Dy;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Tilt Stage - Pure rotating aligned with Ob</span></span>
|
||||||
|
Rry = <span class="org-rainbow-delimiters-depth-1">[</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> sin<span class="org-rainbow-delimiters-depth-2">(</span>Ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>Ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Ry<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Spindle - Rotation along the Z axis</span></span>
|
||||||
|
Rrz = <span class="org-rainbow-delimiters-depth-1">[</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>Rz<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>Rz<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
sin<span class="org-rainbow-delimiters-depth-2">(</span>Rz<span class="org-rainbow-delimiters-depth-2">)</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Rz<span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Micro-Hexapod</span></span>
|
||||||
|
Rhx = <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> sin<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
Rhy = <span class="org-rainbow-delimiters-depth-1">[</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">5</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> sin<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">5</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">5</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">5</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
Rhz = <span class="org-rainbow-delimiters-depth-1">[</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
sin<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Dh<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
Rh = <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> Dh<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">)</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> Dh<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-2">)</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> Dh<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
Rh<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-1">)</span> = Rhz<span class="org-type">*</span>Rhy<span class="org-type">*</span>Rhx;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Nano-Hexapod</span></span>
|
||||||
|
Rnx = <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> sin<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">4</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
Rny = <span class="org-rainbow-delimiters-depth-1">[</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">5</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> sin<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">5</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">5</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">5</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
Rnz = <span class="org-rainbow-delimiters-depth-1">[</span>cos<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-type">-</span>sin<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
sin<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> cos<span class="org-rainbow-delimiters-depth-2">(</span>Dn<span class="org-rainbow-delimiters-depth-3">(</span><span class="org-highlight-numbers-number">6</span><span class="org-rainbow-delimiters-depth-3">)</span><span class="org-rainbow-delimiters-depth-2">)</span> <span class="org-highlight-numbers-number">0</span>;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
Rn = <span class="org-rainbow-delimiters-depth-1">[</span><span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> Dn<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">1</span><span class="org-rainbow-delimiters-depth-2">)</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-highlight-numbers-number">0</span> Dn<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">2</span><span class="org-rainbow-delimiters-depth-2">)</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> Dn<span class="org-rainbow-delimiters-depth-2">(</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-2">)</span> ;
|
||||||
|
<span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">0</span> <span class="org-highlight-numbers-number">1</span> <span class="org-rainbow-delimiters-depth-1">]</span>;
|
||||||
|
|
||||||
|
Rn<span class="org-rainbow-delimiters-depth-1">(</span><span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span>, <span class="org-highlight-numbers-number">1</span><span class="org-type">:</span><span class="org-highlight-numbers-number">3</span><span class="org-rainbow-delimiters-depth-1">)</span> = Rnx<span class="org-type">*</span>Rny<span class="org-type">*</span>Rnz;
|
||||||
|
|
||||||
|
<span class="org-matlab-cellbreak"><span class="org-comment">%% Total Homogeneous transformation</span></span>
|
||||||
|
WTr = Rty<span class="org-type">*</span>Rry<span class="org-type">*</span>Rrz<span class="org-type">*</span>Rh<span class="org-type">*</span>Rn;
|
||||||
|
<span class="org-keyword">end</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="postamble" class="status">
|
||||||
|
<p class="author">Author: Dehaeze Thomas</p>
|
||||||
|
<p class="date">Created: 2019-12-11 mer. 17:33</p>
|
||||||
|
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -506,3 +506,91 @@ This Matlab function is accessible [[file:src/inverseKinematicsHexapod.m][here]]
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
#+end_src
|
#+end_src
|
||||||
|
** computeReferencePose
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:matlab+: :tangle ../src/computeReferencePose.m
|
||||||
|
:header-args:matlab+: :comments none :mkdirp yes :eval no
|
||||||
|
:END:
|
||||||
|
<<sec:computeReferencePose>>
|
||||||
|
|
||||||
|
This Matlab function is accessible [[file:src/computeReferencePose.m][here]].
|
||||||
|
|
||||||
|
#+begin_src matlab
|
||||||
|
function [WTr] = computeReferencePose(Dy, Ry, Rz, Dh, Dn)
|
||||||
|
% computeReferencePose - Compute the homogeneous transformation matrix corresponding to the wanted pose of the sample
|
||||||
|
%
|
||||||
|
% Syntax: [WTr] = computeReferencePose(Dy, Ry, Rz, Dh, Dn)
|
||||||
|
%
|
||||||
|
% Inputs:
|
||||||
|
% - Dy - Reference of the Translation Stage [m]
|
||||||
|
% - Ry - Reference of the Tilt Stage [rad]
|
||||||
|
% - Rz - Reference of the Spindle [rad]
|
||||||
|
% - Dh - Reference of the Micro Hexapod (Pitch, Roll, Yaw angles) [m, m, m, rad, rad, rad]
|
||||||
|
% - Dn - Reference of the Nano Hexapod [m, m, m, rad, rad, rad]
|
||||||
|
%
|
||||||
|
% Outputs:
|
||||||
|
% - WTr -
|
||||||
|
|
||||||
|
%% Translation Stage
|
||||||
|
Rty = [1 0 0 0;
|
||||||
|
0 1 0 Dy;
|
||||||
|
0 0 1 0;
|
||||||
|
0 0 0 1];
|
||||||
|
|
||||||
|
%% Tilt Stage - Pure rotating aligned with Ob
|
||||||
|
Rry = [ cos(Ry) 0 sin(Ry) 0;
|
||||||
|
0 1 0 0;
|
||||||
|
-sin(Ry) 0 cos(Ry) 0;
|
||||||
|
0 0 0 1];
|
||||||
|
|
||||||
|
%% Spindle - Rotation along the Z axis
|
||||||
|
Rrz = [cos(Rz) -sin(Rz) 0 0 ;
|
||||||
|
sin(Rz) cos(Rz) 0 0 ;
|
||||||
|
0 0 1 0 ;
|
||||||
|
0 0 0 1 ];
|
||||||
|
|
||||||
|
|
||||||
|
%% Micro-Hexapod
|
||||||
|
Rhx = [1 0 0;
|
||||||
|
0 cos(Dh(4)) -sin(Dh(4));
|
||||||
|
0 sin(Dh(4)) cos(Dh(4))];
|
||||||
|
|
||||||
|
Rhy = [ cos(Dh(5)) 0 sin(Dh(5));
|
||||||
|
0 1 0;
|
||||||
|
-sin(Dh(5)) 0 cos(Dh(5))];
|
||||||
|
|
||||||
|
Rhz = [cos(Dh(6)) -sin(Dh(6)) 0;
|
||||||
|
sin(Dh(6)) cos(Dh(6)) 0;
|
||||||
|
0 0 1];
|
||||||
|
|
||||||
|
Rh = [1 0 0 Dh(1) ;
|
||||||
|
0 1 0 Dh(2) ;
|
||||||
|
0 0 1 Dh(3) ;
|
||||||
|
0 0 0 1 ];
|
||||||
|
|
||||||
|
Rh(1:3, 1:3) = Rhz*Rhy*Rhx;
|
||||||
|
|
||||||
|
%% Nano-Hexapod
|
||||||
|
Rnx = [1 0 0;
|
||||||
|
0 cos(Dn(4)) -sin(Dn(4));
|
||||||
|
0 sin(Dn(4)) cos(Dn(4))];
|
||||||
|
|
||||||
|
Rny = [ cos(Dn(5)) 0 sin(Dn(5));
|
||||||
|
0 1 0;
|
||||||
|
-sin(Dn(5)) 0 cos(Dn(5))];
|
||||||
|
|
||||||
|
Rnz = [cos(Dn(6)) -sin(Dn(6)) 0;
|
||||||
|
sin(Dn(6)) cos(Dn(6)) 0;
|
||||||
|
0 0 1];
|
||||||
|
|
||||||
|
Rn = [1 0 0 Dn(1) ;
|
||||||
|
0 1 0 Dn(2) ;
|
||||||
|
0 0 1 Dn(3) ;
|
||||||
|
0 0 0 1 ];
|
||||||
|
|
||||||
|
Rn(1:3, 1:3) = Rnx*Rny*Rnz;
|
||||||
|
|
||||||
|
%% Total Homogeneous transformation
|
||||||
|
WTr = Rty*Rry*Rrz*Rh*Rn;
|
||||||
|
end
|
||||||
|
#+end_src
|
||||||
|
Loading…
Reference in New Issue
Block a user