Remove org comments in tangled matlab functions

This commit is contained in:
Thomas Dehaeze 2019-12-11 14:46:31 +01:00
parent 89db48f81e
commit eda325fae2
27 changed files with 235 additions and 373 deletions

View File

@ -61,7 +61,7 @@ The disturbances are:
* Undamped System * Undamped System
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle matlab/undamped_system.m :header-args:matlab+: :tangle matlab/undamped_system.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:END: :END:
<<sec:undamped_system>> <<sec:undamped_system>>
@ -245,7 +245,7 @@ The "plant" (transfer function from forces applied by the nano-hexapod to the me
* Integral Force Feedback * Integral Force Feedback
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle matlab/iff.m :header-args:matlab+: :tangle matlab/iff.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:END: :END:
<<sec:iff>> <<sec:iff>>
@ -789,7 +789,7 @@ Integral Force Feedback:
* Relative Motion Control * Relative Motion Control
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle matlab/rmc.m :header-args:matlab+: :tangle matlab/rmc.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:END: :END:
<<sec:rmc>> <<sec:rmc>>
@ -1287,7 +1287,7 @@ Relative Motion Control:
* Direct Velocity Feedback * Direct Velocity Feedback
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle matlab/dvf.m :header-args:matlab+: :tangle matlab/dvf.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:END: :END:
<<sec:dvf>> <<sec:dvf>>

View File

@ -586,3 +586,178 @@ 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
#+begin_src matlab
initDisturbances();
load('./mat/nass_disturbances.mat', 'Dwx', 'Dwy', 'Dwz', 'Fty_x', 'Fty_z', 'Frz_z', 'Fd', 'Ts', 't');
#+end_src
#+begin_src matlab
figure;
hold on;
plot(t, Dwx, 'DisplayName', 'Dw x');
plot(t, Dwy, 'DisplayName', 'Dw y');
plot(t, Dwz, 'DisplayName', 'Dw z');
hold off;
xlabel('Time [s]'); ylabel('Amplitude [m]');
legend('location', 'north east');
#+end_src
#+begin_src matlab
figure;
hold on;
plot(t, Fty_x, 'DisplayName', 'Ty x');
plot(t, Fty_z, 'DisplayName', 'Ty z');
plot(t, Frz_z, 'DisplayName', 'Rz z');
hold off;
xlabel('Time [s]'); ylabel('Force [N]');
legend('location', 'north east');
#+end_src

View File

@ -456,12 +456,13 @@ Verify that the pose error is small.
Indeed, we are able to convert the position error in the frame of the NASS and then compensate these errors with the NASS. Indeed, we are able to convert the position error in the frame of the NASS and then compensate these errors with the NASS.
#+end_important #+end_important
* Verify that we are able to compensate the errors using the nano-hexapod :noexport: * Verify that we are able to compensate the errors using the nano-hexapod
* Functions * Functions
** computeReferencePose ** computeReferencePose
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/computeReferencePose.m :header-args:matlab+: :tangle ../src/computeReferencePose.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:computeReferencePose>> <<sec:computeReferencePose>>

View File

@ -322,7 +322,7 @@ A simulink library is developed in order to share elements between the different
** computePsdDispl ** computePsdDispl
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/computePsdDispl.m :header-args:matlab+: :tangle ../src/computePsdDispl.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:computePsdDispl>> <<sec:computePsdDispl>>
@ -358,7 +358,7 @@ This Matlab function is accessible [[file:../src/computePsdDispl.m][here]].
** computeSetpoint ** computeSetpoint
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/computeSetpoint.m :header-args:matlab+: :tangle ../src/computeSetpoint.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:computeSetpoint>> <<sec:computeSetpoint>>
@ -430,7 +430,7 @@ This Matlab function is accessible [[file:../src/computeSetpoint.m][here]].
** converErrorBasis ** converErrorBasis
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/converErrorBasis.m :header-args:matlab+: :tangle ../src/converErrorBasis.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:converErrorBasis>> <<sec:converErrorBasis>>
@ -568,7 +568,7 @@ This Matlab function is accessible [[file:../src/converErrorBasis.m][here]].
** generateDiagPidControl ** generateDiagPidControl
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/generateDiagPidControl.m :header-args:matlab+: :tangle ../src/generateDiagPidControl.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:generateDiagPidControl>> <<sec:generateDiagPidControl>>
@ -598,7 +598,7 @@ This Matlab function is accessible [[file:../src/generateDiagPidControl.m][here]
** identifyPlant ** identifyPlant
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/identifyPlant.m :header-args:matlab+: :tangle ../src/identifyPlant.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:identifyPlant>> <<sec:identifyPlant>>
@ -690,7 +690,7 @@ This Matlab function is accessible [[file:../src/identifyPlant.m][here]].
** runSimulation ** runSimulation
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/runSimulation.m :header-args:matlab+: :tangle ../src/runSimulation.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:runSimulation>> <<sec:runSimulation>>
@ -759,7 +759,7 @@ This Matlab function is accessible [[file:../src/runSimulation.m][here]].
** Experiment ** Experiment
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeExperiment.m :header-args:matlab+: :tangle ../src/initializeExperiment.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeExperiment>> <<sec:initializeExperiment>>
@ -793,8 +793,8 @@ This Matlab function is accessible [[file:../src/initializeExperiment.m][here]].
** Generate Reference Signals ** Generate Reference Signals
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeReferences.m :header-args:matlab+: :tangle ../src/initializeReferences.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no
:END: :END:
<<sec:initializeReferences>> <<sec:initializeReferences>>
@ -942,7 +942,7 @@ This Matlab function is accessible [[file:../src/initializeInputs.m][here]].
** TODO Inputs ** TODO Inputs
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeInputs.m :header-args:matlab+: :tangle ../src/initializeInputs.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeInputs>> <<sec:initializeInputs>>
@ -1132,8 +1132,8 @@ This Matlab function is accessible [[file:../src/initializeInputs.m][here]].
** Inverse Kinematics of the Hexapod ** Inverse Kinematics of the Hexapod
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/inverseKinematicsHexapod.m :header-args:matlab+: :tangle ../src/inverseKinematicsHexapod.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no
:END: :END:
<<sec:inverseKinematicsHexapod>> <<sec:inverseKinematicsHexapod>>
@ -1168,7 +1168,7 @@ This Matlab function is accessible [[file:src/inverseKinematicsHexapod.m][here]]
** Ground ** Ground
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeGround.m :header-args:matlab+: :tangle ../src/initializeGround.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeGround>> <<sec:initializeGround>>
@ -1192,7 +1192,7 @@ end
** Granite ** Granite
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeGranite.m :header-args:matlab+: :tangle ../src/initializeGranite.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeGranite>> <<sec:initializeGranite>>
@ -1258,7 +1258,7 @@ This Matlab function is accessible [[file:../src/initializeGranite.m][here]].
** Translation Stage ** Translation Stage
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeTy.m :header-args:matlab+: :tangle ../src/initializeTy.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeTy>> <<sec:initializeTy>>
@ -1340,7 +1340,7 @@ This Matlab function is accessible [[file:../src/initializeTy.m][here]].
** Tilt Stage ** Tilt Stage
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeRy.m :header-args:matlab+: :tangle ../src/initializeRy.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeRy>> <<sec:initializeRy>>
@ -1411,7 +1411,7 @@ This Matlab function is accessible [[file:../src/initializeRy.m][here]].
** Spindle ** Spindle
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeRz.m :header-args:matlab+: :tangle ../src/initializeRz.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeRz>> <<sec:initializeRz>>
@ -1475,44 +1475,10 @@ This Matlab function is accessible [[file:../src/initializeRz.m][here]].
end end
#+end_src #+end_src
** Initialize Hexapod legs' length
:PROPERTIES:
:header-args:matlab+: :tangle ../src/inverseKinematicsHexapod.m
:header-args:matlab+: :comments org :mkdirp yes
:header-args:matlab+: :eval no :results none
:END:
<<sec:inverseKinematicsHexapod>>
This Matlab function is accessible [[file:../src/inverseKinematicsHexapod.m][here]].
#+begin_src matlab
function [hexapod] = inverseKinematicsHexapod(hexapod, AP, ARB)
% inverseKinematicsHexapod -
%
% Syntax: inverseKinematicsHexapod(hexapod, AP, ARB)
%
% Inputs:
% - hexapod - Hexapod object containing the geometry of the hexapod
% - AP - Position vector of point OB expressed in frame {A}
% - ARB - Rotation Matrix expressed in frame {A}
L0 = zeros(6, 1);
for i = 1:length(L)
Bbi = hexapod.pos_top_tranform(i, :)';
Aai = hexapod.pos_base(i, :)';
L0(i) = sqrt(AP'*AP + Bbi'*Bbi + Aai'*Aai - 2*AP'*Aai + 2*AP'*(ARB*Bbi) - 2*(ARB*Bbi)'*Aai);
end
hexapod.L0 = L0;
end
#+end_src
** Micro Hexapod ** Micro Hexapod
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeMicroHexapod.m :header-args:matlab+: :tangle ../src/initializeMicroHexapod.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeMicroHexapod>> <<sec:initializeMicroHexapod>>
@ -1729,7 +1695,7 @@ This Matlab function is accessible [[file:../src/initializeMicroHexapod.m][here]
** Center of gravity compensation ** Center of gravity compensation
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeAxisc.m :header-args:matlab+: :tangle ../src/initializeAxisc.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeAxisc>> <<sec:initializeAxisc>>
@ -1773,7 +1739,7 @@ This Matlab function is accessible [[file:../src/initializeAxisc.m][here]].
** Mirror ** Mirror
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeMirror.m :header-args:matlab+: :tangle ../src/initializeMirror.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeMirror>> <<sec:initializeMirror>>
@ -1839,7 +1805,7 @@ This Matlab function is accessible [[file:../src/initializeMirror.m][here]].
** Nano Hexapod ** Nano Hexapod
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeNanoHexapod.m :header-args:matlab+: :tangle ../src/initializeNanoHexapod.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeNanoHexapod>> <<sec:initializeNanoHexapod>>
@ -2056,7 +2022,7 @@ This Matlab function is accessible [[file:../src/initializeNanoHexapod.m][here]]
** Cedrat Actuator ** Cedrat Actuator
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeCedratPiezo.m :header-args:matlab+: :tangle ../src/initializeCedratPiezo.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeCedratPiezo>> <<sec:initializeCedratPiezo>>
@ -2096,7 +2062,7 @@ This Matlab function is accessible [[file:../src/initializeCedratPiezo.m][here]]
** Sample ** Sample
:PROPERTIES: :PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeSample.m :header-args:matlab+: :tangle ../src/initializeSample.m
:header-args:matlab+: :comments org :mkdirp yes :header-args:matlab+: :comments none :mkdirp yes
:header-args:matlab+: :eval no :results none :header-args:matlab+: :eval no :results none
:END: :END:
<<sec:initializeSample>> <<sec:initializeSample>>

View File

@ -1,14 +1,3 @@
% computePsdDispl
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/computePsdDispl.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:computePsdDispl>>
% This Matlab function is accessible [[file:../src/computePsdDispl.m][here]].
function [psd_object] = computePsdDispl(sys_data, t_init, n_av) function [psd_object] = computePsdDispl(sys_data, t_init, n_av)
i_init = find(sys_data.time > t_init, 1); i_init = find(sys_data.time > t_init, 1);

View File

@ -1,14 +1,3 @@
% computeReferencePose
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/computeReferencePose.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:computeReferencePose>>
% This Matlab function is accessible [[file:src/computeReferencePose.m][here]].
function [WTr] = computeReferencePose(Dy, Ry, Rz, Dh, Dn) function [WTr] = computeReferencePose(Dy, Ry, Rz, Dh, Dn)
% computeReferencePose - Compute the homogeneous transformation matrix corresponding to the wanted pose of the sample % computeReferencePose - Compute the homogeneous transformation matrix corresponding to the wanted pose of the sample
% %

View File

@ -1,14 +1,3 @@
% computeSetpoint
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/computeSetpoint.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:computeSetpoint>>
% This Matlab function is accessible [[file:../src/computeSetpoint.m][here]].
function setpoint = computeSetpoint(ty, ry, rz) function setpoint = computeSetpoint(ty, ry, rz)
%% %%
setpoint = zeros(6, 1); setpoint = zeros(6, 1);

View File

@ -1,14 +1,3 @@
% converErrorBasis
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/converErrorBasis.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:converErrorBasis>>
% This Matlab function is accessible [[file:../src/converErrorBasis.m][here]].
function error_nass = convertErrorBasis(pos, setpoint, ty, ry, rz) function error_nass = convertErrorBasis(pos, setpoint, ty, ry, rz)
% convertErrorBasis - % convertErrorBasis -
% %

View File

@ -1,14 +1,3 @@
% generateDiagPidControl
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/generateDiagPidControl.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:generateDiagPidControl>>
% This Matlab function is accessible [[file:../src/generateDiagPidControl.m][here]].
function [K] = generateDiagPidControl(G, fs) function [K] = generateDiagPidControl(G, fs)
%% %%
pid_opts = pidtuneOptions(... pid_opts = pidtuneOptions(...

View File

@ -1,14 +1,3 @@
% identifyPlant
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/identifyPlant.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:identifyPlant>>
% This Matlab function is accessible [[file:../src/identifyPlant.m][here]].
function [sys] = identifyPlant(opts_param) function [sys] = identifyPlant(opts_param)
%% Default values for opts %% Default values for opts
opts = struct(); opts = struct();

View File

@ -1,14 +1,3 @@
% Function that initialize the disturbances
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initDisturbances.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initDisturbances>>
% This Matlab function is accessible [[file:src/initDisturbances.m][here]].
function [] = initDisturbances(opts_param) function [] = initDisturbances(opts_param)
% initDisturbances - Initialize the disturbances % initDisturbances - Initialize the disturbances
% %
@ -17,8 +6,6 @@ function [] = initDisturbances(opts_param)
% Inputs: % Inputs:
% - opts_param - % - opts_param -
% Default values for the Options
%% Default values for opts %% Default values for opts
opts = struct(); opts = struct();
@ -29,22 +16,13 @@ if exist('opts_param','var')
end end
end end
% Load Data
load('./disturbances/mat/dist_psd.mat', 'dist_f'); load('./disturbances/mat/dist_psd.mat', 'dist_f');
% We remove the first frequency point that usually is very large.
dist_f.f = dist_f.f(2:end); dist_f.f = dist_f.f(2:end);
dist_f.psd_gm = dist_f.psd_gm(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_ty = dist_f.psd_ty(2:end);
dist_f.psd_rz = dist_f.psd_rz(2:end); dist_f.psd_rz = dist_f.psd_rz(2:end);
% Parameters
% We define some parameters that will be used in the algorithm.
Fs = 2*dist_f.f(end); % Sampling Frequency of data is twice the maximum frequency of the PSD vector [Hz] 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 N = 2*length(dist_f.f); % Number of Samples match the one of the wanted PSD
T0 = N/Fs; % Signal Duration [s] T0 = N/Fs; % Signal Duration [s]
@ -53,8 +31,6 @@ df = 1/T0; % Frequency resolution of the DFT [Hz]
t = linspace(0, T0, N+1)'; % Time Vector [s] t = linspace(0, T0, N+1)'; % Time Vector [s]
Ts = 1/Fs; % Sampling Time [s] Ts = 1/Fs; % Sampling Time [s]
% Ground Motion
phi = dist_f.psd_gm; phi = dist_f.psd_gm;
C = zeros(N/2,1); C = zeros(N/2,1);
for i = 1:N/2 for i = 1:N/2
@ -77,8 +53,6 @@ Cx = [Cx; flipud(conj(Cx(2:end)))];;
u = N/sqrt(2)*ifft(Cx); % Ground Motion - z direction [m] u = N/sqrt(2)*ifft(Cx); % Ground Motion - z direction [m]
Dwz = u; Dwz = u;
% Translation Stage - X direction
phi = dist_f.psd_ty; % TODO - we take here the vertical direction which is wrong but approximate phi = dist_f.psd_ty; % TODO - we take here the vertical direction which is wrong but approximate
C = zeros(N/2,1); C = zeros(N/2,1);
for i = 1:N/2 for i = 1:N/2
@ -90,8 +64,6 @@ Cx = [Cx; flipud(conj(Cx(2:end)))];;
u = N/sqrt(2)*ifft(Cx); % Disturbance Force Ty x [N] u = N/sqrt(2)*ifft(Cx); % Disturbance Force Ty x [N]
Fty_x = u; Fty_x = u;
% Translation Stage - Z direction
phi = dist_f.psd_ty; phi = dist_f.psd_ty;
C = zeros(N/2,1); C = zeros(N/2,1);
for i = 1:N/2 for i = 1:N/2
@ -103,8 +75,6 @@ Cx = [Cx; flipud(conj(Cx(2:end)))];;
u = N/sqrt(2)*ifft(Cx); % Disturbance Force Ty z [N] u = N/sqrt(2)*ifft(Cx); % Disturbance Force Ty z [N]
Fty_z = u; Fty_z = u;
% Spindle - Z direction
phi = dist_f.psd_rz; phi = dist_f.psd_rz;
C = zeros(N/2,1); C = zeros(N/2,1);
for i = 1:N/2 for i = 1:N/2
@ -116,13 +86,9 @@ Cx = [Cx; flipud(conj(Cx(2:end)))];;
u = N/sqrt(2)*ifft(Cx); % Disturbance Force Rz z [N] u = N/sqrt(2)*ifft(Cx); % Disturbance Force Rz z [N]
Frz_z = u; Frz_z = u;
% Direct Forces
u = zeros(length(t), 6); u = zeros(length(t), 6);
Fd = u; Fd = u;
% Set initial value to zero
Dwx = Dwx - Dwx(1); Dwx = Dwx - Dwx(1);
Dwy = Dwy - Dwy(1); Dwy = Dwy - Dwy(1);
Dwz = Dwz - Dwz(1); Dwz = Dwz - Dwz(1);
@ -130,6 +96,4 @@ Fty_x = Fty_x - Fty_x(1);
Fty_z = Fty_z - Fty_z(1); Fty_z = Fty_z - Fty_z(1);
Frz_z = Frz_z - Frz_z(1); Frz_z = Frz_z - Frz_z(1);
% Save
save('./mat/nass_disturbances.mat', 'Dwx', 'Dwy', 'Dwz', 'Fty_x', 'Fty_z', 'Frz_z', 'Fd', 'Ts', 't'); save('./mat/nass_disturbances.mat', 'Dwx', 'Dwy', 'Dwz', 'Fty_x', 'Fty_z', 'Frz_z', 'Fd', 'Ts', 't');

View File

@ -1,14 +1,3 @@
% Center of gravity compensation
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeAxisc.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeAxisc>>
% This Matlab function is accessible [[file:../src/initializeAxisc.m][here]].
function [axisc] = initializeAxisc() function [axisc] = initializeAxisc()
%% %%
axisc = struct(); axisc = struct();

View File

@ -1,14 +1,3 @@
% Cedrat Actuator
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeCedratPiezo.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeCedratPiezo>>
% This Matlab function is accessible [[file:../src/initializeCedratPiezo.m][here]].
function [cedrat] = initializeCedratPiezo(opts_param) function [cedrat] = initializeCedratPiezo(opts_param)
%% Default values for opts %% Default values for opts
opts = struct(); opts = struct();

View File

@ -1,14 +1,3 @@
% Experiment
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeExperiment.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeExperiment>>
% This Matlab function is accessible [[file:../src/initializeExperiment.m][here]].
function [] = initializeExperiment(exp_name, sys_mass) function [] = initializeExperiment(exp_name, sys_mass)
if strcmp(exp_name, 'tomography') if strcmp(exp_name, 'tomography')
if strcmp(sys_mass, 'light') if strcmp(sys_mass, 'light')

View File

@ -1,14 +1,3 @@
% Granite
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeGranite.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeGranite>>
% This Matlab function is accessible [[file:../src/initializeGranite.m][here]].
function [granite] = initializeGranite(opts_param) function [granite] = initializeGranite(opts_param)
%% Default values for opts %% Default values for opts
opts = struct('rigid', false); opts = struct('rigid', false);

View File

@ -1,14 +1,3 @@
% Ground
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeGround.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeGround>>
% This Matlab function is accessible [[file:../src/initializeGround.m][here]].
function [ground] = initializeGround() function [ground] = initializeGround()
%% %%
ground = struct(); ground = struct();

View File

@ -1,16 +1,3 @@
% TODO Inputs
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeInputs.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeInputs>>
% - [ ] *This function should not be used anymore*. Now there are two functions to initialize disturbances and references.
% This Matlab function is accessible [[file:../src/initializeInputs.m][here]].
function [inputs] = initializeInputs(opts_param) function [inputs] = initializeInputs(opts_param)
%% Default values for opts %% Default values for opts
opts = struct( ... opts = struct( ...

View File

@ -1,14 +1,3 @@
% Micro Hexapod
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeMicroHexapod.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeMicroHexapod>>
% This Matlab function is accessible [[file:../src/initializeMicroHexapod.m][here]].
function [micro_hexapod] = initializeMicroHexapod(opts_param) function [micro_hexapod] = initializeMicroHexapod(opts_param)
%% Default values for opts %% Default values for opts
opts = struct(... opts = struct(...

View File

@ -1,14 +1,3 @@
% Mirror
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeMirror.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeMirror>>
% This Matlab function is accessible [[file:../src/initializeMirror.m][here]].
function [] = initializeMirror(opts_param) function [] = initializeMirror(opts_param)
%% Default values for opts %% Default values for opts
opts = struct(... opts = struct(...

View File

@ -1,14 +1,3 @@
% Nano Hexapod
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeNanoHexapod.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeNanoHexapod>>
% This Matlab function is accessible [[file:../src/initializeNanoHexapod.m][here]].
function [nano_hexapod] = initializeNanoHexapod(opts_param) function [nano_hexapod] = initializeNanoHexapod(opts_param)
%% Default values for opts %% Default values for opts
opts = struct('actuator', 'piezo'); opts = struct('actuator', 'piezo');

View File

@ -1,14 +1,3 @@
% Generate Reference Signals
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeReferences.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeReferences>>
% This Matlab function is accessible [[file:../src/initializeInputs.m][here]].
function [ref] = initializeReferences(opts_param) function [ref] = initializeReferences(opts_param)
%% Default values for opts %% Default values for opts
opts = struct( ... opts = struct( ...

View File

@ -1,14 +1,3 @@
% Tilt Stage
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeRy.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeRy>>
% This Matlab function is accessible [[file:../src/initializeRy.m][here]].
function [ry] = initializeRy(opts_param) function [ry] = initializeRy(opts_param)
%% Default values for opts %% Default values for opts
opts = struct('rigid', false); opts = struct('rigid', false);

View File

@ -1,14 +1,3 @@
% Spindle
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeRz.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeRz>>
% This Matlab function is accessible [[file:../src/initializeRz.m][here]].
function [rz] = initializeRz(opts_param) function [rz] = initializeRz(opts_param)
%% Default values for opts %% Default values for opts
opts = struct('rigid', false); opts = struct('rigid', false);

View File

@ -1,14 +1,3 @@
% Sample
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeSample.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeSample>>
% This Matlab function is accessible [[file:../src/initializeSample.m][here]].
function [sample] = initializeSample(opts_param) function [sample] = initializeSample(opts_param)
%% Default values for opts %% Default values for opts
sample = struct('radius', 100, ... sample = struct('radius', 100, ...

View File

@ -1,14 +1,3 @@
% Translation Stage
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/initializeTy.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:initializeTy>>
% This Matlab function is accessible [[file:../src/initializeTy.m][here]].
function [ty] = initializeTy(opts_param) function [ty] = initializeTy(opts_param)
%% Default values for opts %% Default values for opts
opts = struct('rigid', false); opts = struct('rigid', false);

View File

@ -1,14 +1,3 @@
% Inverse Kinematics of the Hexapod
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/inverseKinematicsHexapod.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:inverseKinematicsHexapod>>
% This Matlab function is accessible [[file:src/inverseKinematicsHexapod.m][here]].
function [L] = inverseKinematicsHexapod(hexapod, AP, ARB) function [L] = inverseKinematicsHexapod(hexapod, AP, ARB)
% inverseKinematicsHexapod - Compute the initial position of each leg to have the wanted Hexapod's position % inverseKinematicsHexapod - Compute the initial position of each leg to have the wanted Hexapod's position
% %

View File

@ -1,14 +1,3 @@
% runSimulation
% :PROPERTIES:
% :header-args:matlab+: :tangle ../src/runSimulation.m
% :header-args:matlab+: :comments org :mkdirp yes
% :header-args:matlab+: :eval no :results none
% :END:
% <<sec:runSimulation>>
% This Matlab function is accessible [[file:../src/runSimulation.m][here]].
function [] = runSimulation(sys_name, sys_mass, ctrl_type, act_damp) function [] = runSimulation(sys_name, sys_mass, ctrl_type, act_damp)
%% Load the controller and save it for the simulation %% Load the controller and save it for the simulation
if strcmp(ctrl_type, 'cl') && strcmp(act_damp, 'none') if strcmp(ctrl_type, 'cl') && strcmp(act_damp, 'none')