Update all project: add folders with scripts
This commit is contained in:
		
							
								
								
									
										44
									
								
								studies/com.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								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
									
								
								studies/coupling.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								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
									
								
								studies/stiffness_matrix.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								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;
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user