diff --git a/.gitignore b/.gitignore index 7209543..41c2be0 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ octave-workspace # Custom stewart_displacement_grt_rtw/ +Figures/ diff --git a/identification_control.m b/identification_control.m new file mode 100644 index 0000000..908c321 --- /dev/null +++ b/identification_control.m @@ -0,0 +1,77 @@ +%% Script Description +% Script used to identify the transfer functions of the +% Stewart platform (from actuator to displacement) + +%% +clear; +close all; +clc + +%% Define options for bode plots +bode_opts = bodeoptions; + +bode_opts.Title.FontSize = 12; +bode_opts.XLabel.FontSize = 12; +bode_opts.YLabel.FontSize = 12; +bode_opts.FreqUnits = 'Hz'; +bode_opts.MagUnits = 'abs'; +bode_opts.MagScale = 'log'; +bode_opts.PhaseWrapping = 'on'; +bode_opts.PhaseVisible = 'on'; + +%% Options for Linearized +options = linearizeOptions; +options.SampleTime = 0; + +%% Name of the Simulink File +mdl = 'stewart_simscape'; + +%% Centralized control (Cartesian coordinates) +% Input/Output definition +io(1) = linio([mdl, '/F_cart'],1,'input'); +io(2) = linio([mdl, '/Stewart_Platform'],1,'output'); + +% Run the linearization +G_cart = linearize(mdl,io, 0); + +% Input/Output names +G_cart.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'}; +G_cart.OutputName = {'Dx', 'Dy', 'Dz', 'Rx', 'Ry', 'Rz'}; + +% Bode Plot of the linearized function +freqs = logspace(2, 4, 1000); + +bodeFig({G_cart(1, 1), G_cart(2, 2), G_cart(3, 3)}, freqs, struct('phase', true)) +legend({'$F_x \rightarrow D_x$', '$F_y \rightarrow D_y$', '$F_z \rightarrow D_z$'}) +exportFig('hexapod_cart_trans', 'normal-normal') + +bodeFig({G_cart(4, 4), G_cart(5, 5), G_cart(6, 6)}, freqs, struct('phase', true)) +legend({'$M_x \rightarrow R_x$', '$M_y \rightarrow R_y$', '$M_z \rightarrow R_z$'}) +exportFig('hexapod_cart_rot', 'normal-normal') + +bodeFig({G_cart(1, 1), G_cart(2, 1), G_cart(3, 1)}, freqs, struct('phase', true)) +legend({'$F_x \rightarrow D_x$', '$F_x \rightarrow D_y$', '$F_x \rightarrow D_z$'}) +exportFig('hexapod_cart_coupling', 'normal-normal') + +%% Centralized control (Cartesian coordinates) +% Input/Output definition +io(1) = linio([mdl, '/F_legs'],1,'input'); +io(2) = linio([mdl, '/Stewart_Platform'],2,'output'); + +% Run the linearization +G_legs = linearize(mdl,io, 0); + +% Input/Output names +G_legs.InputName = {'F1', 'F2', 'F3', 'M4', 'M5', 'M6'}; +G_legs.OutputName = {'D1', 'D2', 'D3', 'R4', 'R5', 'R6'}; + +% Bode Plot of the linearized function +freqs = logspace(2, 4, 1000); + +bodeFig({G_legs(1, 1)}, freqs, struct('phase', true)) +legend({'$F_i \rightarrow D_i$'}) +exportFig('hexapod_legs', 'normal-normal') + +bodeFig({G_legs(1, 1), G_legs(2, 1)}, freqs, struct('phase', true)) +legend({'$F_i \rightarrow D_i$', '$F_i \rightarrow D_j$'}) +exportFig('hexapod_legs_coupling', 'normal-normal') diff --git a/init_simulink.m b/init_simulink.m new file mode 100644 index 0000000..eca79df --- /dev/null +++ b/init_simulink.m @@ -0,0 +1,7 @@ +params_micro_hexapod; +micro_hexapod = stewart; + +params_nano_hexapod; +nano_hexapod = stewart; + +clear stewart; diff --git a/params_micro_hexapod.m b/params_micro_hexapod.m index a257002..9be175d 100644 --- a/params_micro_hexapod.m +++ b/params_micro_hexapod.m @@ -32,7 +32,7 @@ Leg = struct(); Leg.stroke = 10e-3; % Maximum Stroke of each leg [m] Leg.k.ax = 5e7; % Stiffness of each leg [N/m] -Leg.ksi.ax = 10; % Maximum amplification at resonance [] +Leg.ksi.ax = 3; % Maximum amplification at resonance [] Leg.rad.bottom = 25; % Radius of the cylinder of the bottom part [mm] Leg.rad.top = 17; % Radius of the cylinder of the top part [mm] Leg.density = 8000; % Density of the material [kg/m^3] diff --git a/params_nano_hexapod.m b/params_nano_hexapod.m index cf92b07..105bd11 100644 --- a/params_nano_hexapod.m +++ b/params_nano_hexapod.m @@ -55,7 +55,7 @@ SP.density.top = 8000; % [kg/m^3] SP.color.bottom = [0.7 0.7 0.7]; % [rgb] SP.color.top = [0.7 0.7 0.7]; % [rgb] SP.k.ax = 0; % [N*m/deg] -SP.ksi.ax = 10; +SP.ksi.ax = 3; SP.thickness.bottom = SP.height.bottom-Leg.sphere.bottom; % [mm] SP.thickness.top = SP.height.top-Leg.sphere.top; % [mm] diff --git a/stewart_simscape.slx b/stewart_simscape.slx index 606b32f..b4cf824 100644 Binary files a/stewart_simscape.slx and b/stewart_simscape.slx differ