Removed old functions
This commit is contained in:
		@@ -1,59 +0,0 @@
 | 
			
		||||
function [stewart] = computeGeometricalProperties(stewart, opts_param)
 | 
			
		||||
 | 
			
		||||
opts = struct(...
 | 
			
		||||
    'Jd_pos', [0, 0, 30], ... % Position of the Jacobian for displacement estimation from the top of the mobile platform [mm]
 | 
			
		||||
    'Jf_pos', [0, 0, 30]  ... % Position of the Jacobian for force location from the top of the mobile platform [mm]
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
if exist('opts_param','var')
 | 
			
		||||
    for opt = fieldnames(opts_param)'
 | 
			
		||||
        opts.(opt{1}) = opts_param.(opt{1});
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
leg_length = zeros(6, 1); % [mm]
 | 
			
		||||
leg_vectors = zeros(6, 3);
 | 
			
		||||
 | 
			
		||||
legs = stewart.Ab - stewart.Aa;
 | 
			
		||||
 | 
			
		||||
for i = 1:6
 | 
			
		||||
    leg_length(i) = norm(legs(i,:));
 | 
			
		||||
    leg_vectors(i,:) = legs(i,:) / leg_length(i);
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
stewart.Rm = struct('R', eye(3));
 | 
			
		||||
 | 
			
		||||
for i = 1:6
 | 
			
		||||
  sx = cross(leg_vectors(i,:), [1 0 0]);
 | 
			
		||||
  sx = sx/norm(sx);
 | 
			
		||||
 | 
			
		||||
  sy = -cross(sx, leg_vectors(i,:));
 | 
			
		||||
  sy = sy/norm(sy);
 | 
			
		||||
 | 
			
		||||
  sz = leg_vectors(i,:);
 | 
			
		||||
  sz = sz/norm(sz);
 | 
			
		||||
 | 
			
		||||
  stewart.Rm(i).R = [sx', sy', sz'];
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
Jd = zeros(6);
 | 
			
		||||
 | 
			
		||||
for i = 1:6
 | 
			
		||||
  Jd(i, 1:3) = leg_vectors(i, :);
 | 
			
		||||
  Jd(i, 4:6) = cross(0.001*(stewart.Bb(i, :) - opts.Jd_pos), leg_vectors(i, :));
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
stewart.Jd = Jd;
 | 
			
		||||
stewart.Jd_inv = inv(Jd);
 | 
			
		||||
 | 
			
		||||
Jf = zeros(6);
 | 
			
		||||
 | 
			
		||||
for i = 1:6
 | 
			
		||||
  Jf(i, 1:3) = leg_vectors(i, :);
 | 
			
		||||
  Jf(i, 4:6) = cross(0.001*(stewart.Bb(i, :) - opts.Jf_pos), leg_vectors(i, :));
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
stewart.Jf = Jf;
 | 
			
		||||
stewart.Jf_inv = inv(Jf);
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
@@ -1,47 +0,0 @@
 | 
			
		||||
function [stewart] = initializeGeneralConfiguration(opts_param)
 | 
			
		||||
 | 
			
		||||
opts = struct(...
 | 
			
		||||
    'H_tot',   90, ... % Height of the platform [mm]
 | 
			
		||||
    'H_joint', 15, ... % Height of the joints [mm]
 | 
			
		||||
    'H_plate', 10, ... % Thickness of the fixed and mobile platforms [mm]
 | 
			
		||||
    'R_bot',  100, ... % Radius where the legs articulations are positionned [mm]
 | 
			
		||||
    'R_top',  80,  ... % Radius where the legs articulations are positionned [mm]
 | 
			
		||||
    'a_bot',  10,  ... % Angle Offset [deg]
 | 
			
		||||
    'a_top',  40,  ... % Angle Offset [deg]
 | 
			
		||||
    'da_top', 0    ... % Angle Offset from 0 position [deg]
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
if exist('opts_param','var')
 | 
			
		||||
    for opt = fieldnames(opts_param)'
 | 
			
		||||
        opts.(opt{1}) = opts_param.(opt{1});
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
Aa = zeros(6, 3); % [mm]
 | 
			
		||||
Ab = zeros(6, 3); % [mm]
 | 
			
		||||
Bb = zeros(6, 3); % [mm]
 | 
			
		||||
 | 
			
		||||
for i = 1:3
 | 
			
		||||
    Aa(2*i-1,:) = [opts.R_bot*cos( pi/180*(120*(i-1) - opts.a_bot) ), ...
 | 
			
		||||
                   opts.R_bot*sin( pi/180*(120*(i-1) - opts.a_bot) ), ...
 | 
			
		||||
                   opts.H_plate+opts.H_joint];
 | 
			
		||||
    Aa(2*i,:)   = [opts.R_bot*cos( pi/180*(120*(i-1) + opts.a_bot) ), ...
 | 
			
		||||
                   opts.R_bot*sin( pi/180*(120*(i-1) + opts.a_bot) ), ...
 | 
			
		||||
                   opts.H_plate+opts.H_joint];
 | 
			
		||||
 | 
			
		||||
    Ab(2*i-1,:) = [opts.R_top*cos( pi/180*(120*(i-1) + opts.da_top - opts.a_top) ), ...
 | 
			
		||||
                   opts.R_top*sin( pi/180*(120*(i-1) + opts.da_top - opts.a_top) ), ...
 | 
			
		||||
                   opts.H_tot - opts.H_plate - opts.H_joint];
 | 
			
		||||
    Ab(2*i,:)   = [opts.R_top*cos( pi/180*(120*(i-1) + opts.da_top + opts.a_top) ), ...
 | 
			
		||||
                   opts.R_top*sin( pi/180*(120*(i-1) + opts.da_top + opts.a_top) ), ...
 | 
			
		||||
                   opts.H_tot - opts.H_plate - opts.H_joint];
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
Bb = Ab - opts.H_tot*[0,0,1];
 | 
			
		||||
 | 
			
		||||
stewart = struct();
 | 
			
		||||
  stewart.Aa = Aa;
 | 
			
		||||
  stewart.Ab = Ab;
 | 
			
		||||
  stewart.Bb = Bb;
 | 
			
		||||
  stewart.H_tot = opts.H_tot;
 | 
			
		||||
end
 | 
			
		||||
@@ -1,94 +0,0 @@
 | 
			
		||||
function [stewart] = initializeMechanicalElements(stewart, opts_param)
 | 
			
		||||
 | 
			
		||||
opts = struct(...
 | 
			
		||||
    'thickness', 10, ... % Thickness of the base and platform [mm]
 | 
			
		||||
    'density',   1000, ... % Density of the material used for the hexapod [kg/m3]
 | 
			
		||||
    'k_ax',      1e8, ... % Stiffness of each actuator [N/m]
 | 
			
		||||
    'c_ax',      1000, ... % Damping of each actuator [N/(m/s)]
 | 
			
		||||
    'stroke',    50e-6  ... % Maximum stroke of each actuator [m]
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
if exist('opts_param','var')
 | 
			
		||||
    for opt = fieldnames(opts_param)'
 | 
			
		||||
        opts.(opt{1}) = opts_param.(opt{1});
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
BP = struct();
 | 
			
		||||
 | 
			
		||||
BP.Rint = 0;   % Internal Radius [mm]
 | 
			
		||||
BP.Rext = 150; % External Radius [mm]
 | 
			
		||||
 | 
			
		||||
BP.H = opts.thickness; % Thickness of the Bottom Plate [mm]
 | 
			
		||||
 | 
			
		||||
BP.density = opts.density; % Density of the material [kg/m3]
 | 
			
		||||
 | 
			
		||||
BP.color = [0.7 0.7 0.7]; % Color [RGB]
 | 
			
		||||
 | 
			
		||||
BP.shape = [BP.Rint BP.H; BP.Rint 0; BP.Rext 0; BP.Rext BP.H]; % [mm]
 | 
			
		||||
 | 
			
		||||
stewart.BP = BP;
 | 
			
		||||
 | 
			
		||||
TP = struct();
 | 
			
		||||
 | 
			
		||||
TP.Rint = 0;   % [mm]
 | 
			
		||||
TP.Rext = 100; % [mm]
 | 
			
		||||
 | 
			
		||||
TP.H = 10; % [mm]
 | 
			
		||||
 | 
			
		||||
TP.density = opts.density; % Density of the material [kg/m3]
 | 
			
		||||
 | 
			
		||||
TP.color = [0.7 0.7 0.7]; % Color [RGB]
 | 
			
		||||
 | 
			
		||||
TP.shape = [TP.Rint TP.H; TP.Rint 0; TP.Rext 0; TP.Rext TP.H];
 | 
			
		||||
 | 
			
		||||
stewart.TP  = TP;
 | 
			
		||||
 | 
			
		||||
Leg = struct();
 | 
			
		||||
 | 
			
		||||
Leg.stroke = opts.stroke; % [m]
 | 
			
		||||
 | 
			
		||||
Leg.k_ax = opts.k_ax; % Stiffness of each leg [N/m]
 | 
			
		||||
Leg.c_ax = opts.c_ax; % Damping of each leg [N/(m/s)]
 | 
			
		||||
 | 
			
		||||
Leg.Rtop = 10; % Radius of the cylinder of the top part of the leg[mm]
 | 
			
		||||
Leg.Rbot = 12; % Radius of the cylinder of the bottom part of the leg [mm]
 | 
			
		||||
 | 
			
		||||
Leg.density = opts.density; % Density of the material used for the legs [kg/m3]
 | 
			
		||||
 | 
			
		||||
Leg.color = [0.5 0.5 0.5]; % Color of the top part of the leg [RGB]
 | 
			
		||||
 | 
			
		||||
Leg.R = 1.3*Leg.Rbot; % Size of the sphere at the extremity of the leg [mm]
 | 
			
		||||
 | 
			
		||||
legs = stewart.Ab - stewart.Aa;
 | 
			
		||||
Leg.lenght = norm(legs(1,:))/1.5;
 | 
			
		||||
 | 
			
		||||
Leg.shape.bot = ...
 | 
			
		||||
    [0        0; ...
 | 
			
		||||
     Leg.Rbot 0; ...
 | 
			
		||||
     Leg.Rbot Leg.lenght; ...
 | 
			
		||||
     Leg.Rtop Leg.lenght; ...
 | 
			
		||||
     Leg.Rtop 0.2*Leg.lenght; ...
 | 
			
		||||
     0        0.2*Leg.lenght];
 | 
			
		||||
 | 
			
		||||
stewart.Leg = Leg;
 | 
			
		||||
 | 
			
		||||
SP = struct();
 | 
			
		||||
 | 
			
		||||
SP.k = 0; % [N*m/deg]
 | 
			
		||||
SP.c = 0; % [N*m/deg]
 | 
			
		||||
 | 
			
		||||
SP.H = stewart.Aa(1, 3) - BP.H; % [mm]
 | 
			
		||||
 | 
			
		||||
SP.R = Leg.R; % [mm]
 | 
			
		||||
 | 
			
		||||
SP.section = [0    SP.H-SP.R;
 | 
			
		||||
              0    0;
 | 
			
		||||
              SP.R 0;
 | 
			
		||||
              SP.R SP.H];
 | 
			
		||||
 | 
			
		||||
SP.density = opts.density; % [kg/m^3]
 | 
			
		||||
 | 
			
		||||
SP.color = [0.7 0.7 0.7]; % [RGB]
 | 
			
		||||
 | 
			
		||||
stewart.SP  = SP;
 | 
			
		||||
@@ -1,20 +0,0 @@
 | 
			
		||||
function [] = initializeSample(opts_param)
 | 
			
		||||
 | 
			
		||||
sample = struct( ...
 | 
			
		||||
    'radius',     100, ... % radius of the cylinder [mm]
 | 
			
		||||
    'height',     100, ... % height of the cylinder [mm]
 | 
			
		||||
    'mass',       10,  ... % mass of the cylinder [kg]
 | 
			
		||||
    'measheight', 50, ... % measurement point z-offset [mm]
 | 
			
		||||
    'offset',     [0, 0, 0],   ... % offset position of the sample [mm]
 | 
			
		||||
    'color',      [0.9 0.1 0.1] ...
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
if exist('opts_param','var')
 | 
			
		||||
    for opt = fieldnames(opts_param)'
 | 
			
		||||
        sample.(opt{1}) = opts_param.(opt{1});
 | 
			
		||||
    end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
save('./mat/sample.mat', 'sample');
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user