Add css and js. Add lots of org mode files.
This commit is contained in:
		
							
								
								
									
										36
									
								
								old/active_damping/act_damp_iff_generate.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								old/active_damping/act_damp_iff_generate.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
%%
 | 
			
		||||
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');
 | 
			
		||||
							
								
								
									
										45
									
								
								old/active_damping/act_damp_iff_id.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								old/active_damping/act_damp_iff_id.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
%%
 | 
			
		||||
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');
 | 
			
		||||
							
								
								
									
										133
									
								
								old/active_damping/act_damp_iff_plots.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								old/active_damping/act_damp_iff_plots.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,133 @@
 | 
			
		||||
%%
 | 
			
		||||
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
 | 
			
		||||
							
								
								
									
										8
									
								
								old/active_damping/act_damp_main.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								old/active_damping/act_damp_main.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
% 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
 | 
			
		||||
							
								
								
									
										14
									
								
								old/analysis/analysis_stiffness.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								old/analysis/analysis_stiffness.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
%%
 | 
			
		||||
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);
 | 
			
		||||
 | 
			
		||||
%%
 | 
			
		||||
							
								
								
									
										49
									
								
								old/analyze_jacobian.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								old/analyze_jacobian.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
%% 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;
 | 
			
		||||
							
								
								
									
										12
									
								
								old/config.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								old/config.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
%%
 | 
			
		||||
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');
 | 
			
		||||
							
								
								
									
										20
									
								
								old/identification/id_G.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								old/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
									
								
								old/identification/id_jacobian.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								old/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
									
								
								old/identification/id_jacobian_plots.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								old/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
									
								
								old/identification/id_main.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								old/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
									
								
								old/identification/id_plot_cart.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								old/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
									
								
								old/identification/id_plot_db.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								old/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
									
								
								old/identification/id_plot_iff.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								old/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
									
								
								old/identification/id_plot_legs.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								old/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
 | 
			
		||||
							
								
								
									
										11
									
								
								old/main.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								old/main.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
%%
 | 
			
		||||
clear; close all; clc;
 | 
			
		||||
 | 
			
		||||
%% Configuration File
 | 
			
		||||
run config.m
 | 
			
		||||
 | 
			
		||||
%% Identification
 | 
			
		||||
open id_main.m
 | 
			
		||||
 | 
			
		||||
%% Active Damping
 | 
			
		||||
open act_damp_main.m
 | 
			
		||||
							
								
								
									
										19
									
								
								old/plot_max_positions.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								old/plot_max_positions.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
%% 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;
 | 
			
		||||
							
								
								
									
										44
									
								
								old/studies/com.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								old/studies/com.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
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);
 | 
			
		||||
							
								
								
									
										41
									
								
								old/studies/coupling.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								old/studies/coupling.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
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'})
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										26
									
								
								old/studies/stiffness_matrix.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								old/studies/stiffness_matrix.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
%%
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										55
									
								
								old/study_architecture.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								old/study_architecture.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
			
		||||
%%
 | 
			
		||||
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))');
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user