[REFACTORING] Huge changes, WIP.
This commit is contained in:
17
initialize/initializeAxisc.m
Normal file
17
initialize/initializeAxisc.m
Normal file
@@ -0,0 +1,17 @@
|
||||
function [axisc] = initializeAxisc()
|
||||
%%
|
||||
load('./mat/smiData.mat', 'smiData');
|
||||
|
||||
%%
|
||||
axisc = struct();
|
||||
|
||||
axisc.m = smiData.Solid(30).mass;
|
||||
axisc.k.ax = 1; % TODO [N*m/deg)]
|
||||
|
||||
axisc.c.ax = axisc.k.ax/1000;
|
||||
|
||||
%% Save if no output argument
|
||||
if nargout == 0
|
||||
save('./mat/axisc.mat', 'axisc');
|
||||
end
|
||||
end
|
17
initialize/initializeGranite.m
Normal file
17
initialize/initializeGranite.m
Normal file
@@ -0,0 +1,17 @@
|
||||
function [granite] = initializeGranite()
|
||||
%%
|
||||
load('./mat/smiData.mat', 'smiData');
|
||||
|
||||
%%
|
||||
granite = struct();
|
||||
|
||||
granite.m = smiData.Solid(5).mass;
|
||||
granite.k.ax = 1e8; % x-y-z Stiffness of the granite [N/m]
|
||||
|
||||
granite.c.ax = granite.k.ax/1000;
|
||||
|
||||
%% Save if no output argument
|
||||
if nargout == 0
|
||||
save('./mat/granite.mat', 'granite');
|
||||
end
|
||||
end
|
10
initialize/initializeGround.m
Normal file
10
initialize/initializeGround.m
Normal file
@@ -0,0 +1,10 @@
|
||||
function [ground] = initializeGround()
|
||||
ground = struct();
|
||||
|
||||
ground.shape = [2, 2, 0.5]; % m
|
||||
|
||||
if nargout == 0
|
||||
save('./mat/ground.mat', 'ground')
|
||||
end
|
||||
end
|
||||
|
96
initialize/initializeInputs.m
Normal file
96
initialize/initializeInputs.m
Normal file
@@ -0,0 +1,96 @@
|
||||
function [inputs] = initializeInputs(opts_param)
|
||||
%% Default values for opts
|
||||
opts = struct('setpoint', false, ...
|
||||
'ground_motion', false, ...
|
||||
'ty', false, ...
|
||||
'ry', false, ...
|
||||
'rz', false ...
|
||||
);
|
||||
|
||||
%% Populate opts with input parameters
|
||||
if exist('opts_param','var')
|
||||
for opt = fieldnames(opts_param)'
|
||||
opts.(opt{1}) = opts_param.(opt{1});
|
||||
end
|
||||
end
|
||||
|
||||
%% Load Sampling Time and Simulation Time
|
||||
run init_sim_configuration.m
|
||||
|
||||
%% Define the time vector
|
||||
time_vector = 0:Ts:Tsim;
|
||||
|
||||
%% Create the input Structure that will contain all the inputs
|
||||
inputs = struct();
|
||||
|
||||
%% Set point [m, rad]
|
||||
if opts.setpoint
|
||||
setpoint = zeros(length(time_vector), 6);
|
||||
setpoint(ceil(10/Ts):end, 2) = 1e-6; % Step of 1 micro-meter in y direction
|
||||
else
|
||||
setpoint = zeros(length(time_vector), 6);
|
||||
end
|
||||
|
||||
inputs.setpoint = timeseries(setpoint, time_vector);
|
||||
|
||||
%% Ground motion
|
||||
if opts.ground_motion
|
||||
load('./mat/weight_Wxg.mat', 'Wxg');
|
||||
ground_motion = 1/sqrt(2)*100*random('norm', 0, 1, length(time_vector), 3);
|
||||
ground_motion(:, 1) = lsim(Wxg, ground_motion(:, 1), time_vector);
|
||||
ground_motion(:, 2) = lsim(Wxg, ground_motion(:, 2), time_vector);
|
||||
ground_motion(:, 3) = lsim(Wxg, ground_motion(:, 3), time_vector);
|
||||
else
|
||||
ground_motion = zeros(length(time_vector), 3);
|
||||
end
|
||||
|
||||
inputs.ground_motion = timeseries(ground_motion, time_vector);
|
||||
|
||||
%% Translation stage [m]
|
||||
if opts.ty
|
||||
ty = zeros(length(time_vector), 1);
|
||||
else
|
||||
ty = zeros(length(time_vector), 1);
|
||||
end
|
||||
|
||||
inputs.ty = timeseries(ty, time_vector);
|
||||
|
||||
%% Tilt Stage [rad]
|
||||
if opts.ty
|
||||
ry = 3*(2*pi/360)*sin(2*pi*0.2*time_vector);
|
||||
else
|
||||
ry = zeros(length(time_vector), 1);
|
||||
end
|
||||
|
||||
inputs.ry = timeseries(ry, time_vector);
|
||||
|
||||
%% Spindle [rad]
|
||||
if opts.ty
|
||||
rz = 2*pi*0.5*time_vector;
|
||||
else
|
||||
rz = zeros(length(time_vector), 1);
|
||||
end
|
||||
|
||||
inputs.rz = timeseries(rz, time_vector);
|
||||
|
||||
%% Micro Hexapod
|
||||
u_hexa = zeros(length(time_vector), 6);
|
||||
|
||||
inputs.micro_hexapod = timeseries(u_hexa, time_vector);
|
||||
|
||||
%% Center of gravity compensation
|
||||
mass = zeros(length(time_vector), 2);
|
||||
|
||||
inputs.axisc = timeseries(mass, time_vector);
|
||||
|
||||
%% Nano Hexapod
|
||||
n_hexa = zeros(length(time_vector), 6);
|
||||
|
||||
inputs.nano_hexapod = timeseries(n_hexa, time_vector);
|
||||
|
||||
%% Save if no output argument
|
||||
if nargout == 0
|
||||
save('./mat/inputs.mat', 'inputs');
|
||||
end
|
||||
end
|
||||
|
194
initialize/initializeMicroHexapod.m
Normal file
194
initialize/initializeMicroHexapod.m
Normal file
@@ -0,0 +1,194 @@
|
||||
function [micro_hexapod] = initializeMicroHexapod(opts_param)
|
||||
%% 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
|
||||
|
||||
%% Stewart Object
|
||||
micro_hexapod = struct();
|
||||
micro_hexapod.h = 350; % Total height of the platform [mm]
|
||||
micro_hexapod.jacobian = 435; % Point where the Jacobian is computed => Center of rotation [mm]
|
||||
|
||||
%% Bottom Plate
|
||||
BP = struct();
|
||||
|
||||
BP.rad.int = 110; % Internal Radius [mm]
|
||||
BP.rad.ext = 207.5; % External Radius [mm]
|
||||
BP.thickness = 26; % Thickness [mm]
|
||||
BP.leg.rad = 175.5; % Radius where the legs articulations are positionned [mm]
|
||||
BP.leg.ang = 9.5; % Angle Offset [deg]
|
||||
BP.density = 8000; % Density of the material [kg/m^3]
|
||||
BP.color = [0.6 0.6 0.6]; % Color [rgb]
|
||||
BP.shape = [BP.rad.int BP.thickness; BP.rad.int 0; BP.rad.ext 0; BP.rad.ext BP.thickness];
|
||||
|
||||
%% Top Plate
|
||||
TP = struct();
|
||||
|
||||
TP.rad.int = 82; % Internal Radius [mm]
|
||||
TP.rad.ext = 150; % Internal Radius [mm]
|
||||
TP.thickness = 26; % Thickness [mm]
|
||||
TP.leg.rad = 118; % Radius where the legs articulations are positionned [mm]
|
||||
TP.leg.ang = 12.1; % Angle Offset [deg]
|
||||
TP.density = 8000; % Density of the material [kg/m^3]
|
||||
TP.color = [0.6 0.6 0.6]; % Color [rgb]
|
||||
TP.shape = [TP.rad.int TP.thickness; TP.rad.int 0; TP.rad.ext 0; TP.rad.ext TP.thickness];
|
||||
|
||||
%% Leg
|
||||
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 = 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]
|
||||
Leg.color.bottom = [0.5 0.5 0.5]; % Color [rgb]
|
||||
Leg.color.top = [0.5 0.5 0.5]; % Color [rgb]
|
||||
|
||||
Leg.sphere.bottom = Leg.rad.bottom; % Size of the sphere at the end of the leg [mm]
|
||||
Leg.sphere.top = Leg.rad.top; % Size of the sphere at the end of the leg [mm]
|
||||
Leg.m = TP.density*((pi*(TP.rad.ext/1000)^2)*(TP.thickness/1000)-(pi*(TP.rad.int/1000^2))*(TP.thickness/1000))/6; % TODO [kg]
|
||||
Leg = updateDamping(Leg);
|
||||
|
||||
|
||||
%% Sphere
|
||||
SP = struct();
|
||||
|
||||
SP.height.bottom = 27; % [mm]
|
||||
SP.height.top = 27; % [mm]
|
||||
SP.density.bottom = 8000; % [kg/m^3]
|
||||
SP.density.top = 8000; % [kg/m^3]
|
||||
SP.color.bottom = [0.6 0.6 0.6]; % [rgb]
|
||||
SP.color.top = [0.6 0.6 0.6]; % [rgb]
|
||||
SP.k.ax = 0; % [N*m/deg]
|
||||
SP.ksi.ax = 10;
|
||||
|
||||
SP.thickness.bottom = SP.height.bottom-Leg.sphere.bottom; % [mm]
|
||||
SP.thickness.top = SP.height.top-Leg.sphere.top; % [mm]
|
||||
SP.rad.bottom = Leg.sphere.bottom; % [mm]
|
||||
SP.rad.top = Leg.sphere.top; % [mm]
|
||||
SP.m = SP.density.bottom*2*pi*((SP.rad.bottom*1e-3)^2)*(SP.height.bottom*1e-3); % TODO [kg]
|
||||
|
||||
SP = updateDamping(SP);
|
||||
|
||||
%%
|
||||
Leg.support.bottom = [0 SP.thickness.bottom; 0 0; SP.rad.bottom 0; SP.rad.bottom SP.height.bottom];
|
||||
Leg.support.top = [0 SP.thickness.top; 0 0; SP.rad.top 0; SP.rad.top SP.height.top];
|
||||
|
||||
%%
|
||||
micro_hexapod.BP = BP;
|
||||
micro_hexapod.TP = TP;
|
||||
micro_hexapod.Leg = Leg;
|
||||
micro_hexapod.SP = SP;
|
||||
|
||||
%%
|
||||
micro_hexapod = initializeParameters(micro_hexapod);
|
||||
|
||||
%%
|
||||
if nargout == 0
|
||||
save('./mat/micro_hexapod.mat', 'micro_hexapod')
|
||||
end
|
||||
|
||||
%%
|
||||
function [element] = updateDamping(element)
|
||||
field = fieldnames(element.k);
|
||||
for i = 1:length(field)
|
||||
element.c.(field{i}) = 1/element.ksi.(field{i})*sqrt(element.k.(field{i})/element.m);
|
||||
end
|
||||
end
|
||||
|
||||
%%
|
||||
function [stewart] = initializeParameters(stewart)
|
||||
%% Connection points on base and top plate w.r.t. World frame at the center of the base plate
|
||||
stewart.pos_base = zeros(6, 3);
|
||||
stewart.pos_top = zeros(6, 3);
|
||||
|
||||
alpha_b = stewart.BP.leg.ang*pi/180; % angle de d<EFBFBD>calage par rapport <EFBFBD> 120 deg (pour positionner les supports bases)
|
||||
alpha_t = stewart.TP.leg.ang*pi/180; % +- offset angle from 120 degree spacing on top
|
||||
|
||||
height = (stewart.h-stewart.BP.thickness-stewart.TP.thickness-stewart.Leg.sphere.bottom-stewart.Leg.sphere.top-stewart.SP.thickness.bottom-stewart.SP.thickness.top)*0.001; % TODO
|
||||
|
||||
radius_b = stewart.BP.leg.rad*0.001; % rayon emplacement support base
|
||||
radius_t = stewart.TP.leg.rad*0.001; % top radius in meters
|
||||
|
||||
for i = 1:3
|
||||
% base points
|
||||
angle_m_b = (2*pi/3)* (i-1) - alpha_b;
|
||||
angle_p_b = (2*pi/3)* (i-1) + alpha_b;
|
||||
stewart.pos_base(2*i-1,:) = [radius_b*cos(angle_m_b), radius_b*sin(angle_m_b), 0.0];
|
||||
stewart.pos_base(2*i,:) = [radius_b*cos(angle_p_b), radius_b*sin(angle_p_b), 0.0];
|
||||
|
||||
% top points
|
||||
% Top points are 60 degrees offset
|
||||
angle_m_t = (2*pi/3)* (i-1) - alpha_t + 2*pi/6;
|
||||
angle_p_t = (2*pi/3)* (i-1) + alpha_t + 2*pi/6;
|
||||
stewart.pos_top(2*i-1,:) = [radius_t*cos(angle_m_t), radius_t*sin(angle_m_t), height];
|
||||
stewart.pos_top(2*i,:) = [radius_t*cos(angle_p_t), radius_t*sin(angle_p_t), height];
|
||||
end
|
||||
|
||||
% permute pos_top points so that legs are end points of base and top points
|
||||
stewart.pos_top = [stewart.pos_top(6,:); stewart.pos_top(1:5,:)]; %6th point on top connects to 1st on bottom
|
||||
stewart.pos_top_tranform = stewart.pos_top - height*[zeros(6, 2),ones(6, 1)];
|
||||
|
||||
%% leg vectors
|
||||
legs = stewart.pos_top - stewart.pos_base;
|
||||
leg_length = zeros(6, 1);
|
||||
leg_vectors = zeros(6, 3);
|
||||
for i = 1:6
|
||||
leg_length(i) = norm(legs(i,:));
|
||||
leg_vectors(i,:) = legs(i,:) / leg_length(i);
|
||||
end
|
||||
|
||||
stewart.Leg.lenght = 1000*leg_length(1)/1.5;
|
||||
stewart.Leg.shape.bot = [0 0; ...
|
||||
stewart.Leg.rad.bottom 0; ...
|
||||
stewart.Leg.rad.bottom stewart.Leg.lenght; ...
|
||||
stewart.Leg.rad.top stewart.Leg.lenght; ...
|
||||
stewart.Leg.rad.top 0.2*stewart.Leg.lenght; ...
|
||||
0 0.2*stewart.Leg.lenght];
|
||||
|
||||
%% Calculate revolute and cylindrical axes
|
||||
rev1 = zeros(6, 3);
|
||||
rev2 = zeros(6, 3);
|
||||
cyl1 = zeros(6, 3);
|
||||
for i = 1:6
|
||||
rev1(i,:) = cross(leg_vectors(i,:), [0 0 1]);
|
||||
rev1(i,:) = rev1(i,:) / norm(rev1(i,:));
|
||||
|
||||
rev2(i,:) = - cross(rev1(i,:), leg_vectors(i,:));
|
||||
rev2(i,:) = rev2(i,:) / norm(rev2(i,:));
|
||||
|
||||
cyl1(i,:) = leg_vectors(i,:);
|
||||
end
|
||||
|
||||
|
||||
%% Coordinate systems
|
||||
stewart.lower_leg = struct('rotation', eye(3));
|
||||
stewart.upper_leg = struct('rotation', eye(3));
|
||||
|
||||
for i = 1:6
|
||||
stewart.lower_leg(i).rotation = [rev1(i,:)', rev2(i,:)', cyl1(i,:)'];
|
||||
stewart.upper_leg(i).rotation = [rev1(i,:)', rev2(i,:)', cyl1(i,:)'];
|
||||
end
|
||||
|
||||
%% Position Matrix
|
||||
stewart.M_pos_base = stewart.pos_base + (height+(stewart.TP.thickness+stewart.Leg.sphere.top+stewart.SP.thickness.top+stewart.jacobian)*1e-3)*[zeros(6, 2),ones(6, 1)];
|
||||
|
||||
%% Compute Jacobian Matrix
|
||||
aa = stewart.pos_top_tranform + (stewart.jacobian - stewart.TP.thickness - stewart.SP.height.top)*1e-3*[zeros(6, 2),ones(6, 1)];
|
||||
stewart.J = getJacobianMatrix(leg_vectors', aa');
|
||||
end
|
||||
|
||||
function J = getJacobianMatrix(RM,M_pos_base)
|
||||
% RM: [3x6] unit vector of each leg in the fixed frame
|
||||
% M_pos_base: [3x6] vector of the leg connection at the top platform location in the fixed frame
|
||||
J = zeros(6);
|
||||
J(:, 1:3) = RM';
|
||||
J(:, 4:6) = cross(M_pos_base, RM)';
|
||||
end
|
||||
end
|
195
initialize/initializeNanoHexapod.m
Normal file
195
initialize/initializeNanoHexapod.m
Normal file
@@ -0,0 +1,195 @@
|
||||
function [nano_hexapod] = initializeNanoHexapod(opts_param)
|
||||
%% 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
|
||||
|
||||
%% Stewart Object
|
||||
nano_hexapod = struct();
|
||||
nano_hexapod.h = 90; % Total height of the platform [mm]
|
||||
nano_hexapod.jacobian = 174.5; % Point where the Jacobian is computed => Center of rotation [mm]
|
||||
|
||||
%% Bottom Plate
|
||||
BP = struct();
|
||||
|
||||
BP.rad.int = 0; % Internal Radius [mm]
|
||||
BP.rad.ext = 150; % External Radius [mm]
|
||||
BP.thickness = 10; % Thickness [mm]
|
||||
BP.leg.rad = 100; % Radius where the legs articulations are positionned [mm]
|
||||
BP.leg.ang = 5; % Angle Offset [deg]
|
||||
BP.density = 8000;% Density of the material [kg/m^3]
|
||||
BP.color = [0.7 0.7 0.7]; % Color [rgb]
|
||||
BP.shape = [BP.rad.int BP.thickness; BP.rad.int 0; BP.rad.ext 0; BP.rad.ext BP.thickness];
|
||||
|
||||
%% Top Plate
|
||||
TP = struct();
|
||||
|
||||
TP.rad.int = 0; % Internal Radius [mm]
|
||||
TP.rad.ext = 100; % Internal Radius [mm]
|
||||
TP.thickness = 10; % Thickness [mm]
|
||||
TP.leg.rad = 90; % Radius where the legs articulations are positionned [mm]
|
||||
TP.leg.ang = 5; % Angle Offset [deg]
|
||||
TP.density = 8000;% Density of the material [kg/m^3]
|
||||
TP.color = [0.7 0.7 0.7]; % Color [rgb]
|
||||
TP.shape = [TP.rad.int TP.thickness; TP.rad.int 0; TP.rad.ext 0; TP.rad.ext TP.thickness];
|
||||
|
||||
%% Leg
|
||||
Leg = struct();
|
||||
|
||||
Leg.stroke = 80e-6; % 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.rad.bottom = 12; % Radius of the cylinder of the bottom part [mm]
|
||||
Leg.rad.top = 10; % Radius of the cylinder of the top part [mm]
|
||||
Leg.density = 8000; % Density of the material [kg/m^3]
|
||||
Leg.color.bottom = [0.5 0.5 0.5]; % Color [rgb]
|
||||
Leg.color.top = [0.5 0.5 0.5]; % Color [rgb]
|
||||
|
||||
Leg.sphere.bottom = Leg.rad.bottom; % Size of the sphere at the end of the leg [mm]
|
||||
Leg.sphere.top = Leg.rad.top; % Size of the sphere at the end of the leg [mm]
|
||||
Leg.m = TP.density*((pi*(TP.rad.ext/1000)^2)*(TP.thickness/1000)-(pi*(TP.rad.int/1000^2))*(TP.thickness/1000))/6; % TODO [kg]
|
||||
|
||||
Leg = updateDamping(Leg);
|
||||
|
||||
|
||||
%% Sphere
|
||||
SP = struct();
|
||||
|
||||
SP.height.bottom = 15; % [mm]
|
||||
SP.height.top = 15; % [mm]
|
||||
SP.density.bottom = 8000; % [kg/m^3]
|
||||
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 = 3;
|
||||
|
||||
SP.thickness.bottom = SP.height.bottom-Leg.sphere.bottom; % [mm]
|
||||
SP.thickness.top = SP.height.top-Leg.sphere.top; % [mm]
|
||||
SP.rad.bottom = Leg.sphere.bottom; % [mm]
|
||||
SP.rad.top = Leg.sphere.top; % [mm]
|
||||
SP.m = SP.density.bottom*2*pi*((SP.rad.bottom*1e-3)^2)*(SP.height.bottom*1e-3); % TODO [kg]
|
||||
|
||||
SP = updateDamping(SP);
|
||||
|
||||
%%
|
||||
Leg.support.bottom = [0 SP.thickness.bottom; 0 0; SP.rad.bottom 0; SP.rad.bottom SP.height.bottom];
|
||||
Leg.support.top = [0 SP.thickness.top; 0 0; SP.rad.top 0; SP.rad.top SP.height.top];
|
||||
|
||||
%%
|
||||
nano_hexapod.BP = BP;
|
||||
nano_hexapod.TP = TP;
|
||||
nano_hexapod.Leg = Leg;
|
||||
nano_hexapod.SP = SP;
|
||||
|
||||
%%
|
||||
nano_hexapod = initializeParameters(nano_hexapod);
|
||||
|
||||
%%
|
||||
if nargout == 0
|
||||
save('./mat/nano_hexapod.mat', 'nano_hexapod')
|
||||
end
|
||||
|
||||
%%
|
||||
function [element] = updateDamping(element)
|
||||
field = fieldnames(element.k);
|
||||
for i = 1:length(field)
|
||||
element.c.(field{i}) = 1/element.ksi.(field{i})*sqrt(element.k.(field{i})/element.m);
|
||||
end
|
||||
end
|
||||
|
||||
%%
|
||||
function [stewart] = initializeParameters(stewart)
|
||||
%% Connection points on base and top plate w.r.t. World frame at the center of the base plate
|
||||
stewart.pos_base = zeros(6, 3);
|
||||
stewart.pos_top = zeros(6, 3);
|
||||
|
||||
alpha_b = stewart.BP.leg.ang*pi/180; % angle de d<EFBFBD>calage par rapport <EFBFBD> 120 deg (pour positionner les supports bases)
|
||||
alpha_t = stewart.TP.leg.ang*pi/180; % +- offset angle from 120 degree spacing on top
|
||||
|
||||
height = (stewart.h-stewart.BP.thickness-stewart.TP.thickness-stewart.Leg.sphere.bottom-stewart.Leg.sphere.top-stewart.SP.thickness.bottom-stewart.SP.thickness.top)*0.001; % TODO
|
||||
|
||||
radius_b = stewart.BP.leg.rad*0.001; % rayon emplacement support base
|
||||
radius_t = stewart.TP.leg.rad*0.001; % top radius in meters
|
||||
|
||||
for i = 1:3
|
||||
% base points
|
||||
angle_m_b = (2*pi/3)* (i-1) - alpha_b;
|
||||
angle_p_b = (2*pi/3)* (i-1) + alpha_b;
|
||||
stewart.pos_base(2*i-1,:) = [radius_b*cos(angle_m_b), radius_b*sin(angle_m_b), 0.0];
|
||||
stewart.pos_base(2*i,:) = [radius_b*cos(angle_p_b), radius_b*sin(angle_p_b), 0.0];
|
||||
|
||||
% top points
|
||||
% Top points are 60 degrees offset
|
||||
angle_m_t = (2*pi/3)* (i-1) - alpha_t + 2*pi/6;
|
||||
angle_p_t = (2*pi/3)* (i-1) + alpha_t + 2*pi/6;
|
||||
stewart.pos_top(2*i-1,:) = [radius_t*cos(angle_m_t), radius_t*sin(angle_m_t), height];
|
||||
stewart.pos_top(2*i,:) = [radius_t*cos(angle_p_t), radius_t*sin(angle_p_t), height];
|
||||
end
|
||||
|
||||
% permute pos_top points so that legs are end points of base and top points
|
||||
stewart.pos_top = [stewart.pos_top(6,:); stewart.pos_top(1:5,:)]; %6th point on top connects to 1st on bottom
|
||||
stewart.pos_top_tranform = stewart.pos_top - height*[zeros(6, 2),ones(6, 1)];
|
||||
|
||||
%% leg vectors
|
||||
legs = stewart.pos_top - stewart.pos_base;
|
||||
leg_length = zeros(6, 1);
|
||||
leg_vectors = zeros(6, 3);
|
||||
for i = 1:6
|
||||
leg_length(i) = norm(legs(i,:));
|
||||
leg_vectors(i,:) = legs(i,:) / leg_length(i);
|
||||
end
|
||||
|
||||
stewart.Leg.lenght = 1000*leg_length(1)/1.5;
|
||||
stewart.Leg.shape.bot = [0 0; ...
|
||||
stewart.Leg.rad.bottom 0; ...
|
||||
stewart.Leg.rad.bottom stewart.Leg.lenght; ...
|
||||
stewart.Leg.rad.top stewart.Leg.lenght; ...
|
||||
stewart.Leg.rad.top 0.2*stewart.Leg.lenght; ...
|
||||
0 0.2*stewart.Leg.lenght];
|
||||
|
||||
%% Calculate revolute and cylindrical axes
|
||||
rev1 = zeros(6, 3);
|
||||
rev2 = zeros(6, 3);
|
||||
cyl1 = zeros(6, 3);
|
||||
for i = 1:6
|
||||
rev1(i,:) = cross(leg_vectors(i,:), [0 0 1]);
|
||||
rev1(i,:) = rev1(i,:) / norm(rev1(i,:));
|
||||
|
||||
rev2(i,:) = - cross(rev1(i,:), leg_vectors(i,:));
|
||||
rev2(i,:) = rev2(i,:) / norm(rev2(i,:));
|
||||
|
||||
cyl1(i,:) = leg_vectors(i,:);
|
||||
end
|
||||
|
||||
|
||||
%% Coordinate systems
|
||||
stewart.lower_leg = struct('rotation', eye(3));
|
||||
stewart.upper_leg = struct('rotation', eye(3));
|
||||
|
||||
for i = 1:6
|
||||
stewart.lower_leg(i).rotation = [rev1(i,:)', rev2(i,:)', cyl1(i,:)'];
|
||||
stewart.upper_leg(i).rotation = [rev1(i,:)', rev2(i,:)', cyl1(i,:)'];
|
||||
end
|
||||
|
||||
%% Position Matrix
|
||||
stewart.M_pos_base = stewart.pos_base + (height+(stewart.TP.thickness+stewart.Leg.sphere.top+stewart.SP.thickness.top+stewart.jacobian)*1e-3)*[zeros(6, 2),ones(6, 1)];
|
||||
|
||||
%% Compute Jacobian Matrix
|
||||
aa = stewart.pos_top_tranform + (stewart.jacobian - stewart.TP.thickness - stewart.SP.height.top)*1e-3*[zeros(6, 2),ones(6, 1)];
|
||||
stewart.J = getJacobianMatrix(leg_vectors', aa');
|
||||
end
|
||||
|
||||
function J = getJacobianMatrix(RM,M_pos_base)
|
||||
% RM: [3x6] unit vector of each leg in the fixed frame
|
||||
% M_pos_base: [3x6] vector of the leg connection at the top platform location in the fixed frame
|
||||
J = zeros(6);
|
||||
J(:, 1:3) = RM';
|
||||
J(:, 4:6) = cross(M_pos_base, RM)';
|
||||
end
|
||||
end
|
25
initialize/initializeRy.m
Normal file
25
initialize/initializeRy.m
Normal file
@@ -0,0 +1,25 @@
|
||||
function [ry] = initializeRy()
|
||||
%%
|
||||
load('./mat/smiData.mat', 'smiData');
|
||||
|
||||
%%
|
||||
ry = struct();
|
||||
|
||||
ry.m = smiData.Solid(26).mass+smiData.Solid(18).mass+smiData.Solid(10).mass;
|
||||
|
||||
ry.k.h = 357e6/4; % Stiffness in the direction of the guidance [N/m]
|
||||
ry.k.rad = 555e6/4; % Stiffness in the top direction [N/m]
|
||||
ry.k.rrad = 238e6/4; % Stiffness in the side direction [N/m]
|
||||
ry.k.tilt = 1e4 ; % Rotation stiffness around y [N*m/deg]
|
||||
|
||||
ry.c.h = ry.k.h/1000;
|
||||
ry.c.rad = ry.k.rad/1000;
|
||||
ry.c.rrad = ry.k.rrad/1000;
|
||||
ry.c.tilt = ry.k.tilt/1000;
|
||||
|
||||
%% Save if no output argument
|
||||
if nargout == 0
|
||||
save('./mat/ry.mat', 'ry');
|
||||
end
|
||||
end
|
||||
|
25
initialize/initializeRz.m
Normal file
25
initialize/initializeRz.m
Normal file
@@ -0,0 +1,25 @@
|
||||
function [rz] = initializeRz()
|
||||
%%
|
||||
load('./mat/smiData.mat', 'smiData');
|
||||
|
||||
%%
|
||||
rz = struct();
|
||||
|
||||
rz.m = smiData.Solid(12).mass+6*smiData.Solid(20).mass+smiData.Solid(19).mass;
|
||||
|
||||
rz.k.ax = 2e9; % Axial Stiffness [N/m]
|
||||
rz.k.rad = 7e8; % Radial Stiffness [N/m]
|
||||
rz.k.tilt = 1e5; % TODO
|
||||
rz.k.rot = 1e5; % Rotational Stiffness [N*m/deg]
|
||||
|
||||
rz.c.ax = rz.k.ax/1000;
|
||||
rz.c.rad = rz.k.rad/1000;
|
||||
rz.c.tilt = rz.k.tilt/1000;
|
||||
rz.c.rot = rz.k.rot/1000;
|
||||
|
||||
%% Save if no output argument
|
||||
if nargout == 0
|
||||
save('./mat/rz.mat', 'rz');
|
||||
end
|
||||
end
|
||||
|
21
initialize/initializeSample.m
Normal file
21
initialize/initializeSample.m
Normal file
@@ -0,0 +1,21 @@
|
||||
function [] = initializeSample(opts_param)
|
||||
%% Default values for opts
|
||||
sample = struct('radius', 100,...
|
||||
'height', 300,...
|
||||
'mass', 50,...
|
||||
'offset', 0,...
|
||||
'color', [0.9 0.1 0.1] ...
|
||||
);
|
||||
|
||||
%% Populate opts with input parameters
|
||||
if exist('opts_param','var')
|
||||
for opt = fieldnames(opts_param)'
|
||||
sample.(opt{1}) = opts_param.(opt{1});
|
||||
end
|
||||
end
|
||||
|
||||
%% Save if no output argument
|
||||
if nargout == 0
|
||||
save('./mat/sample.mat', 'sample');
|
||||
end
|
||||
end
|
2017
initialize/initializeSmiData.m
Normal file
2017
initialize/initializeSmiData.m
Normal file
File diff suppressed because it is too large
Load Diff
29
initialize/initializeTy.m
Normal file
29
initialize/initializeTy.m
Normal file
@@ -0,0 +1,29 @@
|
||||
function [ty] = initializeTy()
|
||||
%%
|
||||
load('./mat/smiData.mat', 'smiData');
|
||||
|
||||
%%
|
||||
ty = struct();
|
||||
|
||||
ty.m = smiData.Solid(4).mass+...
|
||||
smiData.Solid(6).mass+...
|
||||
smiData.Solid(7).mass+...
|
||||
smiData.Solid(8).mass+...
|
||||
smiData.Solid(9).mass+...
|
||||
4*smiData.Solid(11).mass+...
|
||||
smiData.Solid(24).mass+...
|
||||
smiData.Solid(25).mass+...
|
||||
smiData.Solid(28).mass;
|
||||
|
||||
ty.k.ax = 1e7/4; % Axial Stiffness for each of the 4 guidance (y) [N/m]
|
||||
ty.k.rad = 9e9/4; % Radial Stiffness for each of the 4 guidance (x-z) [N/m]
|
||||
|
||||
ty.c.ax = ty.k.ax/1000;
|
||||
ty.c.rad = ty.k.rad/1000;
|
||||
|
||||
%% Save if no output argument
|
||||
if nargout == 0
|
||||
save('./mat/ty.mat', 'ty');
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user