Update all project: add folders with scripts
This commit is contained in:
20
identification/id_G.m
Normal file
20
identification/id_G.m
Normal file
@@ -0,0 +1,20 @@
|
||||
%% 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');
|
38
identification/id_jacobian.m
Normal file
38
identification/id_jacobian.m
Normal file
@@ -0,0 +1,38 @@
|
||||
%% 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');
|
43
identification/id_jacobian_plots.m
Normal file
43
identification/id_jacobian_plots.m
Normal file
@@ -0,0 +1,43 @@
|
||||
%% 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);
|
14
identification/id_main.m
Normal file
14
identification/id_main.m
Normal file
@@ -0,0 +1,14 @@
|
||||
%%
|
||||
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
|
96
identification/id_plot_cart.m
Normal file
96
identification/id_plot_cart.m
Normal file
@@ -0,0 +1,96 @@
|
||||
%%
|
||||
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
|
40
identification/id_plot_db.m
Normal file
40
identification/id_plot_db.m
Normal file
@@ -0,0 +1,40 @@
|
||||
%%
|
||||
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
|
||||
|
||||
%%
|
57
identification/id_plot_iff.m
Normal file
57
identification/id_plot_iff.m
Normal file
@@ -0,0 +1,57 @@
|
||||
%%
|
||||
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
|
57
identification/id_plot_legs.m
Normal file
57
identification/id_plot_legs.m
Normal file
@@ -0,0 +1,57 @@
|
||||
%%
|
||||
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
|
Reference in New Issue
Block a user