Identification of the Stewart Platform using Simscape
Table of Contents
1 Identification
The hexapod structure and Sample structure are initialized.
initializeHexapod(); initializeSample();
G = identifyPlant();
2 Cartesian Plot
From a force applied in the Cartesian frame to a displacement in the Cartesian frame.
figure; hold on; bode(G.G_cart(1, 1)); bode(G.G_cart(3, 3)); hold off;
3 From a force to force sensor
figure; hold on; bode(G.G_forc(1, 1)); bode(G.G_forc(2, 2)); bode(G.G_forc(3, 3)); bode(G.G_forc(4, 4)); bode(G.G_forc(5, 5)); bode(G.G_forc(6, 6)); hold off;
figure; hold on; bode(G.G_forc(1, 1)); bode(G.G_forc(1, 2)); bode(G.G_forc(1, 3)); bode(G.G_forc(1, 4)); bode(G.G_forc(1, 5)); bode(G.G_forc(1, 6)); hold off;
4 From a force applied in the leg to the displacement of the leg
figure; hold on; bode(G.G_legs(1, 1)); bode(G.G_legs(2, 2)); bode(G.G_legs(3, 3)); bode(G.G_legs(4, 4)); bode(G.G_legs(5, 5)); bode(G.G_legs(6, 6)); hold off;
figure; hold on; bode(G.G_legs(1, 1)); bode(G.G_legs(1, 2)); bode(G.G_legs(1, 3)); bode(G.G_legs(1, 4)); bode(G.G_legs(1, 5)); bode(G.G_legs(1, 6)); hold off;
5 Transmissibility
figure; hold on; bode(G.G_tran(1, 1)); bode(G.G_tran(2, 2)); bode(G.G_tran(3, 3)); hold off;
figure; hold on; bode(G.G_tran(4, 4)); bode(G.G_tran(5, 5)); bode(G.G_tran(6, 6)); hold off;
figure; hold on; bode(G.G_tran(1, 1)); bode(G.G_tran(2, 1)); bode(G.G_tran(3, 1)); hold off;
6 Compliance
From a force applied in the Cartesian frame to a relative displacement of the mobile platform with respect to the base.
figure; hold on; bode(G.G_comp(1, 1)); bode(G.G_comp(2, 2)); bode(G.G_comp(3, 3)); hold off;
7 Inertial
From a force applied on the Cartesian frame to the absolute displacement of the mobile platform.
figure; hold on; bode(G.G_iner(1, 1)); bode(G.G_iner(2, 2)); bode(G.G_iner(3, 3)); hold off;
8 identifyPlant
function [sys] = identifyPlant(opts_param)
We use this code block to pass optional parameters.
%% Default values for opts opts = struct(); %% Populate opts with input parameters if exist('opts_param','var') for opt = fieldnames(opts_param)' opts.(opt{1}) = opts_param.(opt{1}); end end
We defined the options for the linearize
command.
Here, we just identify the system at time \(t = 0\).
options = linearizeOptions;
options.SampleTime = 0;
We define the name of the Simulink File used to identification.
mdl = 'stewart';
Then we defined the input/output of the transfer function we want to identify.
%% Inputs io(1) = linio([mdl, '/F'], 1, 'input'); % Cartesian forces io(2) = linio([mdl, '/Fl'], 1, 'input'); % Leg forces io(3) = linio([mdl, '/Fd'], 1, 'input'); % Direct forces io(4) = linio([mdl, '/Dw'], 1, 'input'); % Base motion %% Outputs io(5) = linio([mdl, '/Dm'], 1, 'output'); % Relative Motion io(6) = linio([mdl, '/Dlm'], 1, 'output'); % Displacement of each leg io(7) = linio([mdl, '/Flm'], 1, 'output'); % Force sensor in each leg io(8) = linio([mdl, '/Xm'], 1, 'output'); % Absolute motion of platform
The linearization is run.
G = linearize(mdl, io, 0);
We defined all the Input/Output names of the identified transfer function.
G.InputName = {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz', ... 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', ... 'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz', ... 'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'}; G.OutputName = {'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm', ... 'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m', ... 'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m', ... 'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'};
We split the transfer function into sub transfer functions and we compute their minimum realization.
sys.G_cart = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz'})); sys.G_forc = minreal(G({'F1m', 'F2m', 'F3m', 'F4m', 'F5m', 'F6m'}, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'})); sys.G_legs = minreal(G({'D1m', 'D2m', 'D3m', 'D4m', 'D5m', 'D6m'}, {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'})); sys.G_tran = minreal(G({'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'}, {'Dwx', 'Dwy', 'Dwz', 'Rwx', 'Rwy', 'Rwz'})); sys.G_comp = minreal(G({'Dxm', 'Dym', 'Dzm', 'Rxm', 'Rym', 'Rzm'}, {'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'})); sys.G_iner = minreal(G({'Dxtm', 'Dytm', 'Dztm', 'Rxtm', 'Rytm', 'Rztm'}, {'Fdx', 'Fdy', 'Fdz', 'Mdx', 'Mdy', 'Mdz'})); % sys.G_all = minreal(G);
end