diff --git a/old/active_damping/act_damp_iff_generate.m b/old/active_damping/act_damp_iff_generate.m deleted file mode 100644 index de8f7a6..0000000 --- a/old/active_damping/act_damp_iff_generate.m +++ /dev/null @@ -1,36 +0,0 @@ -%% -clear; close all; clc; - -%% Load the transfer functions -load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% -s = tf('s'); - -%% Light Voice Coil -%sisotool(-G_light_vc.G_iff('Fm1', 'F1')/s); - -K_iff_light_vc = 105/s*tf(eye(6)); - -%% Light Piezo -%sisotool(-G_light_pz.G_iff('Fm1', 'F1')/s); - -K_iff_light_pz = 3300/s*tf(eye(6)); - -%% Heavy Voice Coil -%sisotool(-G_heavy_vc.G_iff('Fm1', 'F1')/s); - -K_iff_heavy_vc = 22.7/s*tf(eye(6)); - -%% Heavy Piezo -%sisotool(-G_heavy_pz.G_iff('Fm1', 'F1')/s); - -K_iff_heavy_pz = 720/s*tf(eye(6)); - -%% Save Controllers -save('./mat/K_iff_sisotool.mat', ... - 'K_iff_light_vc', 'K_iff_light_pz', ... - 'K_iff_heavy_vc', 'K_iff_heavy_pz'); diff --git a/old/active_damping/act_damp_iff_id.m b/old/active_damping/act_damp_iff_id.m deleted file mode 100644 index 4e467fd..0000000 --- a/old/active_damping/act_damp_iff_id.m +++ /dev/null @@ -1,45 +0,0 @@ -%% -clear; close all; clc; - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% Load controllers -load('./mat/K_iff_sisotool.mat', ... - 'K_iff_light_vc', 'K_iff_light_pz', ... - 'K_iff_heavy_vc', 'K_iff_heavy_pz'); - -%% -initializeSample(struct('mass', 1)); - -initializeHexapod(struct('actuator', 'lorentz')); -K_iff = K_iff_light_vc; %#ok -save('./mat/controllers.mat', 'K_iff', '-append'); - -G_light_vc_iff = identifyPlant(); - -initializeHexapod(struct('actuator', 'piezo')); -K_iff = K_iff_light_pz; %#ok -save('./mat/controllers.mat', 'K_iff', '-append'); - -G_light_pz_iff = identifyPlant(); - -%% -initializeSample(struct('mass', 50)); - -initializeHexapod(struct('actuator', 'lorentz')); -K_iff = K_iff_heavy_vc; %#ok -save('./mat/controllers.mat', 'K_iff', '-append'); - -G_heavy_vc_iff = identifyPlant(); - -initializeHexapod(struct('actuator', 'piezo')); -K_iff = K_iff_heavy_pz; -save('./mat/controllers.mat', 'K_iff', '-append'); - -G_heavy_pz_iff = identifyPlant(); - -%% Save the obtained transfer functions -save('./mat/G_iff.mat', ... - 'G_light_vc_iff', 'G_light_pz_iff', ... - 'G_heavy_vc_iff', 'G_heavy_pz_iff'); diff --git a/old/active_damping/act_damp_iff_plots.m b/old/active_damping/act_damp_iff_plots.m deleted file mode 100644 index ad18b90..0000000 --- a/old/active_damping/act_damp_iff_plots.m +++ /dev/null @@ -1,133 +0,0 @@ -%% -clear; close all; clc; - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% Load -load('./mat/G_iff.mat', 'G_light_vc_iff', 'G_light_pz_iff', 'G_heavy_vc_iff', 'G_heavy_pz_iff'); -load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); - -%% New Damped Plant - Horizontal Direction -figure; -% Amplitude -ax1 = subaxis(2,1,1); -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fx'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fx'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -set(gca, 'XTickLabel',[]); -ylabel('Amplitude [m/N]'); -hold off; - -% Phase -ax2 = subaxis(2,1,2); -hold on; -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fx'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fx'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1) -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc_iff.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz_iff.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca,'xscale','log'); -yticks(-180:90:180); -ylim([-180 180]); -xlabel('Frequency [Hz]'); ylabel('Phase [deg]'); -legend('Location', 'southwest'); -hold off; - -linkaxes([ax1,ax2],'x'); - -if save_fig; exportFig('G_hori_iff', 'normal-normal', struct('path', 'active_damping')); end - -%% New Damped Plant - Vertical Direction -figure; -% Amplitude -ax1 = subaxis(2,1,1); -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fz'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fz'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -set(gca, 'XTickLabel',[]); -ylabel('Amplitude [m/N]'); -hold off; - -% Phase -ax2 = subaxis(2,1,2); -hold on; -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fz'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fz'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1) -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc_iff.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz_iff.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca,'xscale','log'); -yticks(-180:90:180); -ylim([-180 180]); -xlabel('Frequency [Hz]'); ylabel('Phase [deg]'); -legend('Location', 'southwest'); -hold off; - -linkaxes([ax1,ax2],'x'); - -if save_fig; exportFig('G_vert_iff', 'normal-normal', struct('path', 'active_damping')); end - -%% Ground motion Transmissibility - Horizontal Direction -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_db('Dx', 'Dbx'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_db('Dx', 'Dbx'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_db('Dx', 'Dbx'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_db('Dx', 'Dbx'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -xlabel('Frequency [Hz]'); ylabel('Amplitude [m/N]'); -hold off; - -if save_fig; exportFig('G_db_hori_iff', 'normal-normal', struct('path', 'active_damping')); end - -%% Ground motion Transmissibility - Vertical Direction -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_db('Dz', 'Dbz'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_db('Dz', 'Dbz'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_db('Dz', 'Dbz'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_db('Dz', 'Dbz'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -xlabel('Frequency [Hz]'); ylabel('Amplitude [m/N]'); -hold off; - -if save_fig; exportFig('G_db_vert_iff', 'normal-normal', struct('path', 'active_damping')); end - -%% Direct Forces Compliance - Horizontal Direction -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_fi('Dx', 'Fix'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_fi('Dx', 'Fix'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_fi('Dx', 'Fix'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_fi('Dx', 'Fix'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -xlabel('Frequency [Hz]'); ylabel('Amplitude [m/N]'); -hold off; - -if save_fig; exportFig('G_fi_hori_iff', 'normal-normal', struct('path', 'active_damping')); end - -%% Direct Forces Compliance - Vertical Direction -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_fi('Dz', 'Fiz'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_fi('Dz', 'Fiz'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_fi('Dz', 'Fiz'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_fi('Dz', 'Fiz'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -xlabel('Frequency [Hz]'); ylabel('Amplitude [m/N]'); -hold off; - -if save_fig; exportFig('G_fi_vert_iff', 'normal-normal', struct('path', 'active_damping')); end diff --git a/old/active_damping/act_damp_main.m b/old/active_damping/act_damp_main.m deleted file mode 100644 index 8c83ae4..0000000 --- a/old/active_damping/act_damp_main.m +++ /dev/null @@ -1,8 +0,0 @@ -% Generate the IFF controls -run act_damp_iff_generate.m - -% Identification of the damped plant -run act_damp_iff_id.m - -% Plot new transfer functions -run act_damp_iff_plots.m \ No newline at end of file diff --git a/old/analysis/analysis_stiffness.m b/old/analysis/analysis_stiffness.m deleted file mode 100644 index 9ae1555..0000000 --- a/old/analysis/analysis_stiffness.m +++ /dev/null @@ -1,14 +0,0 @@ -%% -clear; close all; clc; - -%% -sys_0 = initializeHexapod(struct('actuator', 'piezo', 'jacobian', 0)); -sys_100 = initializeHexapod(struct('actuator', 'piezo', 'jacobian', 100)); -sys_200 = initializeHexapod(struct('actuator', 'piezo', 'jacobian', 1000000)); - -%% -K_0 = getStiffnessMatrix(sys_0.Leg.k.ax, sys_0.J ); -K_100 = getStiffnessMatrix(sys_100.Leg.k.ax, sys_100.J); -K_200 = getStiffnessMatrix(sys_200.Leg.k.ax, sys_200.J); - -%% diff --git a/old/analyze_jacobian.m b/old/analyze_jacobian.m deleted file mode 100644 index aeb3ae3..0000000 --- a/old/analyze_jacobian.m +++ /dev/null @@ -1,49 +0,0 @@ -%% Script Description -% - -%% -figure; -plot(d_meas.Time, d.Data-d_meas.Data) - -%% -figure; -plot(error.Time, error.Data) -legend({'x', 'y', 'z', 'theta_x', 'theta_y', 'theta_z'}) - -%% -J = jacobian.Data(:, :, 1); - -% Norm of the jacobian with time -J_change = (jacobian.Data - J)./J; - -figure; -hold on; -plot(jacobian.Time, squeeze(J_change(1, 1, :))); -plot(jacobian.Time, squeeze(J_change(2, 2, :))); -plot(jacobian.Time, squeeze(J_change(3, 3, :))); -plot(jacobian.Time, squeeze(J_change(4, 4, :))); -plot(jacobian.Time, squeeze(J_change(5, 5, :))); -plot(jacobian.Time, squeeze(J_change(6, 6, :))); -legend({'Jxx', 'Jyy', 'Jzz', 'Jmx', 'Jmy', 'Jmz'}) -hold off; - -%% K change -K_init = J'*J; -K = zeros(size(jacobian.Data)); - -for i=1:length(jacobian.Time) - K(:, :, i) = jacobian.Data(:, :, i)'*jacobian.Data(:, :, i); -end - -K_change = (permute(K, [2, 1, 3]) - K_init)./K_init; - -figure; -hold on; -plot(jacobian.Time, squeeze(K_change(1, 1, :))); -plot(jacobian.Time, squeeze(K_change(2, 2, :))); -plot(jacobian.Time, squeeze(K_change(3, 3, :))); -plot(jacobian.Time, squeeze(K_change(4, 4, :))); -plot(jacobian.Time, squeeze(K_change(5, 5, :))); -plot(jacobian.Time, squeeze(K_change(6, 6, :))); -legend({'Kxx', 'Kyy', 'Kzz', 'Kmx', 'Kmy', 'Kmz'}) -hold off; diff --git a/old/config.m b/old/config.m deleted file mode 100644 index 7ab7f7a..0000000 --- a/old/config.m +++ /dev/null @@ -1,12 +0,0 @@ -%% -addpath('active_damping'); -addpath('analysis'); -addpath('identification'); -addpath('library'); -addpath('studies'); -addpath('src'); - -%% -freqs = logspace(-1, 3, 1000); -save_fig = false; -save('./mat/config.mat', 'freqs', 'save_fig'); diff --git a/old/identification/id_G.m b/old/identification/id_G.m deleted file mode 100644 index 58befb8..0000000 --- a/old/identification/id_G.m +++ /dev/null @@ -1,20 +0,0 @@ -%% Script Description -% Script used to identify various transfer functions -% of the Stewart platform - -%% -clear; close all; clc; - -%% -K_iff = tf(zeros(6)); -save('./mat/controllers.mat', 'K_iff', '-append'); - -%% Initialize System -initializeSample(struct('mass', 50)); -initializeHexapod(struct('actuator', 'piezo')); - -%% Identification -G = identifyPlant(); - -%% Save -save('./mat/G.mat', 'G'); diff --git a/old/identification/id_jacobian.m b/old/identification/id_jacobian.m deleted file mode 100644 index 2ce5c01..0000000 --- a/old/identification/id_jacobian.m +++ /dev/null @@ -1,38 +0,0 @@ -%% Script Description -%% -clear; close all; clc; - -%% -K_iff = tf(zeros(6)); -save('./mat/controllers.mat', 'K_iff', '-append'); - -%% System - perfectly aligned -initializeHexapod(struct('actuator', 'piezo', 'jacobian', 1, 'density', 0.1)); -initializeSample(struct('mass', 50, 'height', 1, 'measheight', 1, 'offset', [0, 0, -25.5])); - -% Identification -G_center = identifyPlant(); - -%% System - Jacobian is too high -initializeHexapod(struct('actuator', 'piezo', 'jacobian', 160)); -initializeSample(struct('mass', 50, 'height', 300, 'measheight', 150)); - -% Identification -G_Jac_offset = identifyPlant(); - -%% System - CoM is too low -initializeHexapod(struct('actuator', 'piezo', 'jacobian', 150)); -initializeSample(struct('mass', 50, 'height', 280, 'measheight', 150)); - -% Identification -G_CoM_offset = identifyPlant(); - -%% System - Meas point is too high -initializeHexapod(struct('actuator', 'piezo', 'jacobian', 150)); -initializeSample(struct('mass', 50, 'height', 300, 'measheight', 160)); - -% Identification -G_Meas_offset = identifyPlant(); - -%% Save -save('./mat/G_jacobian.mat', 'G_center', 'G_Jac_offset', 'G_CoM_offset', 'G_Meas_offset'); diff --git a/old/identification/id_jacobian_plots.m b/old/identification/id_jacobian_plots.m deleted file mode 100644 index f89e546..0000000 --- a/old/identification/id_jacobian_plots.m +++ /dev/null @@ -1,43 +0,0 @@ -%% Script Description -% -%% -clear; close all; clc; - -%% -load('./mat/G_jacobian.mat'); - -%% -freqs = logspace(0, 3, 2000); - -%% -bode_opts = bodeoptions; -bode_opts.FreqUnits = 'Hz'; -bode_opts.MagUnits = 'abs'; -bode_opts.MagScale = 'log'; -bode_opts.PhaseVisible = 'off'; - -%% Compare when the Jac is above Meas. point and CoM -% => -figure; -bode(G_center.G_cart, G_Jac_offset.G_cart, 2*pi*freqs, bode_opts); - -%% Compare when the CoM is bellow the Meas. point and Jac -% => This make the tilt resonance frequency a little bit higher. -figure; -bode(G_center.G_cart, G_CoM_offset.G_cart, 2*pi*freqs, bode_opts); - -%% Compare when the measurement point is higher than CoM and Jac -% => -figure; -bode(G_center.G_cart, G_Meas_offset.G_cart, 2*pi*freqs, bode_opts); - -%% Compare direct forces and forces applied by actuators on the same point -% => This should be the same is the support is rigid. -% => Looks like it's close but not equal -figure; -bode(G_center.G_cart, G_center.G_comp, 2*pi*freqs, bode_opts); - -%% Compare relative sensor and absolute sensor -% => This should be the same as the support is rigid -figure; -bode(G_center.G_iner, G_center.G_comp, 2*pi*freqs, bode_opts); diff --git a/old/identification/id_main.m b/old/identification/id_main.m deleted file mode 100644 index f62250b..0000000 --- a/old/identification/id_main.m +++ /dev/null @@ -1,14 +0,0 @@ -%% -clear; close all; clc; - -%% Jacobian Study - - -%% Identification of the system -run id_G.m - -%% Plots of the identifications -run id_plot_cart.m -run id_plot_legs.m -run id_plot_iff.m -run id_plot_db.m \ No newline at end of file diff --git a/old/identification/id_plot_cart.m b/old/identification/id_plot_cart.m deleted file mode 100644 index 767879f..0000000 --- a/old/identification/id_plot_cart.m +++ /dev/null @@ -1,96 +0,0 @@ -%% -clear; close all; clc; - -%% Load the transfer functions -load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% Plant in the X direction -figure; -% Amplitude -ax1 = subaxis(2,1,1); -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fx'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fx'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -set(gca, 'XTickLabel',[]); -ylabel('Amplitude [m/N]'); -hold off; - -% Phase -ax2 = subaxis(2,1,2); -hold on; -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fx'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fx'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1) -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_vc.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_pz.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca,'xscale','log'); -yticks(-180:90:180); -ylim([-180 180]); -xlabel('Frequency [Hz]'); ylabel('Phase [deg]'); -legend('Location', 'southwest'); -hold off; - -linkaxes([ax1,ax2],'x'); - -if save_fig; exportFig('G_hori', 'normal-normal', struct('path', 'identification')); end - -%% Plant in the Z direction -figure; -% Amplitude -ax1 = subaxis(2,1,1); -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fz'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fz'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -set(gca, 'XTickLabel',[]); -ylabel('Amplitude [m/N]'); -hold off; - -% Phase -ax2 = subaxis(2,1,2); -hold on; -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fz'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fz'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1) -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_vc.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_pz.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca,'xscale','log'); -yticks(-180:90:180); -ylim([-180 180]); -xlabel('Frequency [Hz]'); ylabel('Phase [deg]'); -legend('Location', 'southwest'); -hold off; - -linkaxes([ax1,ax2],'x'); - -if save_fig; exportFig('G_vert', 'normal-normal', struct('path', 'identification')); end - -%% Coupling -figure; - -for i_input = 1:3 - for i_output = 1:3 - subaxis(3,3,3*(i_input-1)+i_output); - hold on; - plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart(i_output, i_input), freqs, 'Hz')))); - plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart(i_output, i_input), freqs, 'Hz')))); - set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); - xlim([freqs(1) freqs(end)]); ylim([1e-22, 1e-2]); - yticks([1e-20, 1e-15, 1e-10, 1e-5]); xticks([0.1 1 10 100 1000]); - if i_output > 1; set(gca,'yticklabel',[]); end - if i_input < 3; set(gca,'xticklabel',[]); end - hold off; - end -end - -if save_fig; exportFig('G_coupling', 'wide-tall', struct('path', 'identification')); end diff --git a/old/identification/id_plot_db.m b/old/identification/id_plot_db.m deleted file mode 100644 index efd2739..0000000 --- a/old/identification/id_plot_db.m +++ /dev/null @@ -1,40 +0,0 @@ -%% -clear; close all; clc; - -%% Load the transfer functions -load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_db('Dx', 'Dbx'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_db('Dx', 'Dbx'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_db('Dx', 'Dbx'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_db('Dx', 'Dbx'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -ylabel('Amplitude [m/m]'); xlabel('Frequency [Hz]'); -hold off; -legend('Location', 'southeast'); - -if save_fig; exportFig('G_db_hori', 'normal-normal', struct('path', 'identification')); end - -%% -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_db('Dz', 'Dbz'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_db('Dz', 'Dbz'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_db('Dz', 'Dbz'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_db('Dz', 'Dbz'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -ylabel('Amplitude [m/m]'); xlabel('Frequency [Hz]'); -hold off; -legend('Location', 'southeast'); - -if save_fig; exportFig('G_db_vert', 'normal-normal', struct('path', 'identification')); end - -%% diff --git a/old/identification/id_plot_iff.m b/old/identification/id_plot_iff.m deleted file mode 100644 index 5e713b8..0000000 --- a/old/identification/id_plot_iff.m +++ /dev/null @@ -1,57 +0,0 @@ -%% -clear; close all; clc; - -%% Load the transfer functions -load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% -figure; -% Amplitude -ax1 = subaxis(2,1,1); -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm1', 'F1'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_iff('Fm1', 'F1'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_iff('Fm1', 'F1'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_iff('Fm1', 'F1'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -set(gca, 'XTickLabel',[]); -ylabel('Amplitude [m/N]'); -hold off; - -% Phase -ax2 = subaxis(2,1,2); -hold on; -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_iff('Fm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_iff('Fm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1) -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_vc.G_iff('Fm1', 'F1'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_pz.G_iff('Fm1', 'F1'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca,'xscale','log'); -yticks(-180:90:180); -ylim([-180 180]); -xlabel('Frequency [Hz]'); ylabel('Phase [deg]'); -legend('Location', 'southwest'); -hold off; - -linkaxes([ax1,ax2],'x'); - -if save_fig; exportFig('G_iff', 'normal-normal', struct('path', 'identification')); end - -%% Coupling -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm1', 'F1'), freqs, 'Hz'))), 'k-'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm2', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm3', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm4', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm5', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm6', 'F1'), freqs, 'Hz'))), 'k--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -ylabel('Amplitude [m/N]'); xlabel('Frequency [Hz]'); -hold off; - -if save_fig; exportFig('G_iff_coupling', 'normal-normal', struct('path', 'identification')); end diff --git a/old/identification/id_plot_legs.m b/old/identification/id_plot_legs.m deleted file mode 100644 index 78380f7..0000000 --- a/old/identification/id_plot_legs.m +++ /dev/null @@ -1,57 +0,0 @@ -%% -clear; close all; clc; - -%% Load the transfer functions -load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); - -%% Load Configuration file -load('./mat/config.mat', 'save_fig', 'freqs'); - -%% -figure; -% Amplitude -ax1 = subaxis(2,1,1); -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_legs('D1', 'F1'), freqs, 'Hz')))); -plot(freqs, abs(squeeze(freqresp(G_light_pz.G_legs('D1', 'F1'), freqs, 'Hz')))); -set(gca,'ColorOrderIndex',1); -plot(freqs, abs(squeeze(freqresp(G_heavy_vc.G_legs('D1', 'F1'), freqs, 'Hz'))), '--'); -plot(freqs, abs(squeeze(freqresp(G_heavy_pz.G_legs('D1', 'F1'), freqs, 'Hz'))), '--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -set(gca, 'XTickLabel',[]); -ylabel('Amplitude [m/N]'); -hold off; - -% Phase -ax2 = subaxis(2,1,2); -hold on; -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_legs('D1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_legs('D1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); -set(gca,'ColorOrderIndex',1) -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_vc.G_legs('D1', 'F1'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy'); -plot(freqs, 180/pi*angle(squeeze(freqresp(G_heavy_pz.G_legs('D1', 'F1'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy'); -set(gca,'xscale','log'); -yticks(-180:90:180); -ylim([-180 180]); -xlabel('Frequency [Hz]'); ylabel('Phase [deg]'); -legend('Location', 'southwest'); -hold off; - -linkaxes([ax1,ax2],'x'); - -if save_fig; exportFig('G_legs', 'normal-normal', struct('path', 'identification')); end - -%% Coupling -figure; -hold on; -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_legs('D1', 'F1'), freqs, 'Hz'))), 'k-'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_legs('D2', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_legs('D3', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_legs('D4', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_legs('D5', 'F1'), freqs, 'Hz'))), 'k--'); -plot(freqs, abs(squeeze(freqresp(G_light_vc.G_legs('D6', 'F1'), freqs, 'Hz'))), 'k--'); -set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); -ylabel('Amplitude [m/N]'); xlabel('Frequency [Hz]'); -hold off; - -if save_fig; exportFig('G_legs_coupling', 'normal-normal', struct('path', 'identification')); end diff --git a/old/main.m b/old/main.m deleted file mode 100644 index 4542661..0000000 --- a/old/main.m +++ /dev/null @@ -1,11 +0,0 @@ -%% -clear; close all; clc; - -%% Configuration File -run config.m - -%% Identification -open id_main.m - -%% Active Damping -open act_damp_main.m diff --git a/old/plot_max_positions.m b/old/plot_max_positions.m deleted file mode 100644 index fd4236b..0000000 --- a/old/plot_max_positions.m +++ /dev/null @@ -1,19 +0,0 @@ -%% Script Description -% - -%% -clear; close all; clc; - -%% -init_simulink; - -%% -[X, Y, Z] = getMaxPositions(stewart); - -%% -figure; -hold on; -mesh(X, Y, Z); -grid on; -colorbar; -hold off; diff --git a/old/studies/com.m b/old/studies/com.m deleted file mode 100644 index f1eadf1..0000000 --- a/old/studies/com.m +++ /dev/null @@ -1,44 +0,0 @@ -clear; close all; clc; - -%% System - center of mass in the plane of joints -initializeHexapod(struct('actuator', 'piezo', 'jacobian', 150, 'density', 0.1)); -initializeSample(struct('mass', 50, 'height', 300, 'measheight', 150)); - -%% Identification -G_aligned = identifyPlant(); - -%% -initializeHexapod(struct('actuator', 'piezo', 'jacobian', 160, 'density', 0.1)); -initializeSample(struct('mass', 50, 'height', 300, 'measheight', 160)); - -%% Identification -G_com = identifyPlant(); - -%% -freqs = logspace(0, 3, 2000); - -%% -bode_opts = bodeoptions; -bode_opts.FreqUnits = 'Hz'; -bode_opts.MagUnits = 'abs'; -bode_opts.MagScale = 'log'; -bode_opts.PhaseVisible = 'off'; - -%% -figure; -bode(G_aligned.G_cart, G_com.G_cart, 2*pi*freqs, bode_opts); - -exportFig('G_com', 'wide-tall', struct('path', 'studies')); - - -%% -initializeHexapod(struct('actuator', 'piezo', 'jacobian', 150, 'density', 0.1)); -initializeSample(struct('mass', 1, 'height', 300, 'measheight', 150)); - -%% Identification -G_massless = identifyPlant(); - - -%% -figure; -bode(G_aligned.G_cart, G_massless.G_cart, 2*pi*freqs, bode_opts); diff --git a/old/studies/coupling.m b/old/studies/coupling.m deleted file mode 100644 index f7927bf..0000000 --- a/old/studies/coupling.m +++ /dev/null @@ -1,41 +0,0 @@ -clear; close all; clc; - -%% System - center of mass in the plane of joints -initializeHexapod(struct('actuator', 'piezo', 'jacobian', -25, 'density', 0.1)); -initializeSample(struct('mass', 50, 'height', 1, 'measheight', -25, 'offset', [0, 0, -25.5])); - -%% Identification -G_aligned = identifyPlant(); - -%% -freqs = logspace(0, 3, 2000); - -%% -bode_opts = bodeoptions; -bode_opts.FreqUnits = 'Hz'; -bode_opts.MagUnits = 'abs'; -bode_opts.MagScale = 'log'; -bode_opts.PhaseVisible = 'off'; - -%% -figure; -bode(G_aligned.G_legs, 2*pi*freqs, bode_opts); - - -%% Change height of stewart platform -for height = [50, 70, 90, 110, 130] - initializeHexapod(struct('actuator', 'piezo', 'jacobian', -25, 'density', 0.1, 'height', height)); - G.(['h_' num2str(height)]) = identifyPlant(); -end - -%% -figure; -bode( ... - G.h_50.G_legs, ... - G.h_70.G_legs, ... - G.h_90.G_legs, ... - G.h_110.G_legs, ... - G.h_130.G_legs, ... - 2*pi*freqs, bode_opts); -% legend({'60', '80', '100', '120', '140'}) - diff --git a/old/studies/stiffness_matrix.m b/old/studies/stiffness_matrix.m deleted file mode 100644 index b3c6560..0000000 --- a/old/studies/stiffness_matrix.m +++ /dev/null @@ -1,26 +0,0 @@ -%% -clear; close all; clc; - -%% -K_iff = tf(zeros(6)); -save('./mat/controllers.mat', 'K_iff', '-append'); - -%% Initialize System -hexapod = initializeHexapod(struct('actuator', 'piezo', 'jacobian', 150)); -initializeSample(struct('mass', 50, 'height', 300, 'measheight', 150)); - -%% Identify transfer functions -G = identifyPlant(); - -%% Run to obtain the computed Jacobian -sim stewart_identification - -%% Compare the two Jacobian matrices -J_rel = (J.data(:, :, 1)-hexapod.J)./hexapod.J; - -%% Compute the Stiffness Matrix -K = hexapod.Leg.k.ax*hexapod.J'*hexapod.J; -K_id = pinv(freqresp(G.G_cart, 0)); - -K_rel = (K-K_id)./K; - diff --git a/old/study_architecture.m b/old/study_architecture.m deleted file mode 100644 index 8210d92..0000000 --- a/old/study_architecture.m +++ /dev/null @@ -1,55 +0,0 @@ -%% -clear; close all; clc; - -%% -run stewart_parameters.m - -%% Study the effect of the radius of the top platform position of the legs -leg_radius = 50:1:120; -max_disp = zeros(length(leg_radius), 6); -stiffness = zeros(length(leg_radius), 6, 6); - -for i_leg = 1:length(leg_radius) - TP.leg.rad = leg_radius(i_leg); - run stewart_init.m; - max_disp(i_leg, :) = getMaxPureDisplacement(Leg, J)'; - stiffness(i_leg, :, :) = getStiffnessMatrix(Leg, J); -end - -%% Plot everything -figure; -hold on; -plot(leg_radius, max_disp(:, 1)) -plot(leg_radius, max_disp(:, 2)) -plot(leg_radius, max_disp(:, 3)) -hold off; -legend({'tx', 'ty', 'tz'}) -xlabel('Leg Radius at the platform'); ylabel('Maximum translation (m)'); - -figure; -hold on; -plot(leg_radius, max_disp(:, 4)) -plot(leg_radius, max_disp(:, 5)) -plot(leg_radius, max_disp(:, 6)) -hold off; -legend({'rx', 'ry', 'rz'}) -xlabel('Leg Radius at the platform'); ylabel('Maximum rotations (rad)'); - -figure; -hold on; -plot(leg_radius, stiffness(:, 1, 1)) -plot(leg_radius, stiffness(:, 2, 2)) -plot(leg_radius, stiffness(:, 3, 3)) -hold off; -legend({'kx', 'ky', 'kz'}) -xlabel('Leg Radius at the platform'); ylabel('Stiffness in translation (N/m)'); - -figure; -hold on; -plot(leg_radius, stiffness(:, 4, 4)) -plot(leg_radius, stiffness(:, 5, 5)) -plot(leg_radius, stiffness(:, 6, 6)) -hold off; -legend({'mx', 'my', 'mz'}) -xlabel('Leg Radius at the platform'); ylabel('Stiffness in rotations (N/(m/rad))'); -