Configurable Model: stages (solid/flexible)

This commit is contained in:
2020-02-17 18:21:20 +01:00
parent 9a5841f3c0
commit aa2f3254c2
50 changed files with 779 additions and 106 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
../figs/
../figs
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+361 -13
View File
@@ -42,7 +42,6 @@
:END:
* Introduction :ignore:
The full Simscape Model is represented in Figure [[fig:simscape_picture]].
#+name: fig:simscape_picture
@@ -56,6 +55,59 @@ Each stage is configured (geometry, mass properties, dynamic properties ...) usi
These functions are defined below.
* Simscape Configuration
:PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeSimscapeConfiguration.m
:header-args:matlab+: :comments none :mkdirp yes :eval no
:END:
<<sec:initializeSimscapeConfiguration>>
** Function description
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
function [] = initializeSimscapeConfiguration(args)
#+end_src
** Optional Parameters
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.gravity logical {mustBeNumericOrLogical} = true
end
#+end_src
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
conf_simscape = struct();
#+end_src
** Add Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
if args.gravity
conf_simscape.type = 1;
else
conf_simscape.type = 2;
end
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
save('./mat/conf_simscape.mat', 'conf_simscape');
#+end_src
* Ground
:PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeGround.m
@@ -87,21 +139,55 @@ The model of the Ground is composed of:
:UNNUMBERED: t
:END:
#+begin_src matlab
function [ground] = initializeGround()
function [ground] = initializeGround(args)
#+end_src
** Function content
** Optional Parameters
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'none', 'solid'})} = 'solid'
end
#+end_src
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
First, we initialize the =granite= structure.
#+begin_src matlab
ground = struct();
#+end_src
** Add Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
ground.type = 0;
case 'solid'
ground.type = 1;
end
#+end_src
** Ground Solid properties
:PROPERTIES:
:UNNUMBERED: t
:END:
We set the shape and density of the ground solid element.
#+begin_src matlab
ground.shape = [2, 2, 0.5]; % [m]
ground.density = 2800; % [kg/m3]
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =ground= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'ground', '-append');
@@ -149,6 +235,7 @@ The output =sample_pos= corresponds to the impact point of the X-ray.
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible'
args.density (1,1) double {mustBeNumeric, mustBeNonnegative} = 2800 % Density [kg/m3]
args.x0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the X direction [m]
args.y0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Y direction [m]
@@ -156,7 +243,8 @@ The output =sample_pos= corresponds to the impact point of the X-ray.
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -165,6 +253,25 @@ First, we initialize the =granite= structure.
granite = struct();
#+end_src
** Add Granite Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
granite.type = 0;
case 'rigid'
granite.type = 1;
case 'flexible'
granite.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
Properties of the Material and link to the geometry of the granite.
#+begin_src matlab
granite.density = args.density; % [kg/m3]
@@ -197,6 +304,10 @@ Z-offset for the initial position of the sample with respect to the granite top
granite.sample_pos = 0.8; % [m]
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =granite= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'granite', '-append');
@@ -247,6 +358,7 @@ The Simscape model of the Translation stage consist of:
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
args.x11 (1,1) double {mustBeNumeric} = 0 % [m]
args.z11 (1,1) double {mustBeNumeric} = 0 % [m]
args.x21 (1,1) double {mustBeNumeric} = 0 % [m]
@@ -258,7 +370,7 @@ The Simscape model of the Translation stage consist of:
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -267,6 +379,27 @@ First, we initialize the =ty= structure.
ty = struct();
#+end_src
** Add Translation Stage Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
ty.type = 0;
case 'rigid'
ty.type = 1;
case 'flexible'
ty.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
Define the density of the materials as well as the geometry (STEP files).
#+begin_src matlab
% Ty Granite frame
@@ -330,6 +463,10 @@ Equilibrium position of the joints.
ty.z0_22 = args.z22;
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =ty= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'ty', '-append');
@@ -380,6 +517,7 @@ The Simscape model of the Tilt stage is composed of:
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
args.x11 (1,1) double {mustBeNumeric} = 0 % [m]
args.y11 (1,1) double {mustBeNumeric} = 0 % [m]
args.z11 (1,1) double {mustBeNumeric} = 0 % [m]
@@ -395,7 +533,7 @@ The Simscape model of the Tilt stage is composed of:
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -404,6 +542,28 @@ First, we initialize the =ry= structure.
ry = struct();
#+end_src
** Add Tilt Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
ry.type = 0;
case 'rigid'
ry.type = 1;
case 'flexible'
ry.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
Properties of the Material and link to the geometry of the Tilt stage.
#+begin_src matlab
% Ry - Guide for the tilt stage
@@ -460,6 +620,10 @@ Z-Offset so that the center of rotation matches the sample center;
ry.z_offset = 0.58178; % [m]
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =ty= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'ry', '-append');
@@ -506,6 +670,7 @@ The Simscape model of the Spindle is composed of:
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
args.x0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
args.y0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
args.z0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
@@ -514,7 +679,7 @@ The Simscape model of the Spindle is composed of:
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -523,6 +688,26 @@ First, we initialize the =rz= structure.
rz = struct();
#+end_src
** Add Spindle Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
rz.type = 0;
case 'rigid'
rz.type = 1;
case 'flexible'
rz.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
Properties of the Material and link to the geometry of the spindle.
#+begin_src matlab
% Spindle - Slip Ring
@@ -563,6 +748,10 @@ Equilibrium position of the joints.
rz.ry0 = args.ry0;
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =rz= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'rz', '-append');
@@ -661,6 +850,10 @@ Equilibrium position of the each joint.
micro_hexapod.dLeq = args.dLeq;
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =micro_hexapod= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'micro_hexapod', '-append');
@@ -697,16 +890,20 @@ The Simscape model of the Center of gravity compensator is composed of:
:UNNUMBERED: t
:END:
#+begin_src matlab
function [axisc] = initializeAxisc()
function [axisc] = initializeAxisc(args)
#+end_src
** Optional Parameters
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -715,6 +912,25 @@ First, we initialize the =axisc= structure.
axisc = struct();
#+end_src
** Add Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
axisc.type = 0;
case 'rigid'
axisc.type = 1;
case 'flexible'
axisc.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
Properties of the Material and link to the geometry files.
#+begin_src matlab
% Structure
@@ -734,6 +950,10 @@ Properties of the Material and link to the geometry files.
axisc.gear.STEP = './STEPS/axisc/axisc_gear.STEP';
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =axisc= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'axisc', '-append');
@@ -778,12 +998,13 @@ The output =mirror_center= corresponds to the center of the Sphere and is the po
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid'})} = 'rigid'
args.shape char {mustBeMember(args.shape,{'spherical', 'conical'})} = 'spherical'
args.angle (1,1) double {mustBeNumeric, mustBePositive} = 45 % [deg]
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -792,13 +1013,41 @@ First, we initialize the =mirror= structure.
mirror = struct();
#+end_src
** Add Mirror Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
mirror.type = 0;
case 'rigid'
mirror.type = 1;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
We define the geometrical values.
#+begin_src matlab
mirror.h = 50; % Height of the mirror [mm]
mirror.thickness = 25; % Thickness of the plate supporting the sample [mm]
mirror.hole_rad = 120; % radius of the hole in the mirror [mm]
mirror.support_rad = 100; % radius of the support plate [mm]
mirror.jacobian = 150; % point of interest offset in z (above the top surfave) [mm]
% point of interest offset in z (above the top surfave) [mm]
switch args.type
case 'none'
mirror.jacobian = 200;
case 'rigid'
mirror.jacobian = 200 - mirror.h;
end
mirror.rad = 180; % radius of the mirror (at the bottom surface) [mm]
#+end_src
@@ -841,6 +1090,10 @@ Finally, we close the shape.
mirror.shape = [mirror.shape; 0 mirror.h];
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =mirror= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'mirror', '-append');
@@ -942,6 +1195,10 @@ The =mirror= structure is saved.
nano_hexapod.dLeq = args.dLeq;
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
save('./mat/stages.mat', 'nano_hexapod', '-append');
#+end_src
@@ -989,6 +1246,7 @@ The Simscape model of the sample environment is composed of:
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible'
args.radius (1,1) double {mustBeNumeric, mustBePositive} = 0.1 % [m]
args.height (1,1) double {mustBeNumeric, mustBePositive} = 0.3 % [m]
args.mass (1,1) double {mustBeNumeric, mustBePositive} = 50 % [kg]
@@ -1000,7 +1258,7 @@ The Simscape model of the sample environment is composed of:
end
#+end_src
** Function content
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
@@ -1009,6 +1267,25 @@ First, we initialize the =sample= structure.
sample = struct();
#+end_src
** Add Sample Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'none'
sample.type = 0;
case 'rigid'
sample.type = 1;
case 'flexible'
sample.type = 2;
end
#+end_src
** Function content
:PROPERTIES:
:UNNUMBERED: t
:END:
We define the geometrical parameters of the sample as well as its mass and position.
#+begin_src matlab
sample.radius = args.radius; % [m]
@@ -1038,11 +1315,82 @@ Equilibrium position of the Cartesian joint corresponding to the sample fixation
sample.z0 = args.z0; % [m]
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =sample= structure is saved.
#+begin_src matlab
save('./mat/stages.mat', 'sample', '-append');
#+end_src
* Initialize Controller
:PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeController.m
:header-args:matlab+: :comments none :mkdirp yes :eval no
:END:
<<sec:initializeController>>
** Function Declaration and Documentation
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
function [] = initializeController(args)
#+end_src
** Optional Parameters
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
arguments
args.type char {mustBeMember(args.type,{'open-loop', 'iff', 'dvf'})} = 'open-loop'
args.K (6,6) = ss(zeros(6, 6))
end
#+end_src
** Structure initialization
:PROPERTIES:
:UNNUMBERED: t
:END:
First, we initialize the =controller= structure.
#+begin_src matlab
controller = struct();
#+end_src
** Controller Type
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
switch args.type
case 'open-loop'
controller.type = 1;
case 'dvf'
controller.type = 2;
case 'iff'
controller.type = 3;
end
#+end_src
** Control Law
:PROPERTIES:
:UNNUMBERED: t
:END:
#+begin_src matlab
controller.K = args.K;
#+end_src
** Save the Structure
:PROPERTIES:
:UNNUMBERED: t
:END:
The =controller= structure is saved.
#+begin_src matlab
save('./mat/controller.mat', 'controller');
#+end_src
* Generate Reference Signals
:PROPERTIES:
:header-args:matlab+: :tangle ../src/initializeReferences.m
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+14 -1
View File
@@ -1,7 +1,20 @@
function [axisc] = initializeAxisc()
function [axisc] = initializeAxisc(args)
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
end
axisc = struct();
switch args.type
case 'none'
axisc.type = 0;
case 'rigid'
axisc.type = 1;
case 'flexible'
axisc.type = 2;
end
% Structure
axisc.structure.density = 3400; % [kg/m3]
axisc.structure.STEP = './STEPS/axisc/axisc_structure.STEP';
+21
View File
@@ -0,0 +1,21 @@
function [] = initializeController(args)
arguments
args.type char {mustBeMember(args.type,{'open-loop', 'iff', 'dvf'})} = 'open-loop'
args.K (6,6) = ss(zeros(6, 6))
end
controller = struct();
switch args.type
case 'open-loop'
controller.type = 1;
case 'dvf'
controller.type = 2;
case 'iff'
controller.type = 3;
end
controller.K = args.K;
save('./mat/controller.mat', 'controller');
+10
View File
@@ -1,6 +1,7 @@
function [granite] = initializeGranite(args)
arguments
args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible'
args.density (1,1) double {mustBeNumeric, mustBeNonnegative} = 2800 % Density [kg/m3]
args.x0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the X direction [m]
args.y0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Y direction [m]
@@ -9,6 +10,15 @@ end
granite = struct();
switch args.type
case 'none'
granite.type = 0;
case 'rigid'
granite.type = 1;
case 'flexible'
granite.type = 2;
end
granite.density = args.density; % [kg/m3]
granite.STEP = './STEPS/granite/granite.STEP';
+12 -1
View File
@@ -1,7 +1,18 @@
function [ground] = initializeGround()
function [ground] = initializeGround(args)
arguments
args.type char {mustBeMember(args.type,{'none', 'solid'})} = 'solid'
end
ground = struct();
switch args.type
case 'none'
ground.type = 0;
case 'solid'
ground.type = 1;
end
ground.shape = [2, 2, 0.5]; % [m]
ground.density = 2800; % [kg/m3]
+1 -1
View File
@@ -1,4 +1,4 @@
function [micro_hexapod] = initializeMicroHexapodNew(args)
function [micro_hexapod] = initializeMicroHexapod(args)
arguments
% initializeFramesPositions
+196
View File
@@ -0,0 +1,196 @@
function [micro_hexapod] = initializeMicroHexapod(args)
arguments
args.rigid logical {mustBeNumericOrLogical} = false
args.AP (3,1) double {mustBeNumeric} = zeros(3,1)
args.ARB (3,3) double {mustBeNumeric} = eye(3)
end
%% Stewart Object
micro_hexapod = struct();
micro_hexapod.h = 350; % Total height of the platform [mm]
micro_hexapod.jacobian = 270; % Distance from the top of the mobile platform to the Jacobian point [mm]
%% Bottom Plate - Mechanical Design
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 - Mechanical Design
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];
%% Struts
Leg = struct();
Leg.stroke = 10e-3; % Maximum Stroke of each leg [m]
if args.rigid
Leg.k.ax = 1e12; % Stiffness of each leg [N/m]
else
Leg.k.ax = 2e7; % Stiffness of each leg [N/m]
end
Leg.ksi.ax = 0.1; % Modal damping ksi = 1/2*c/sqrt(km) []
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);
%% Setup equilibrium position of each leg
micro_hexapod.L0 = inverseKinematicsHexapod(micro_hexapod, args.AP, args.ARB);
%% Save
save('./mat/stages.mat', 'micro_hexapod', '-append');
%%
function [element] = updateDamping(element)
field = fieldnames(element.k);
for i = 1:length(field)
element.c.(field{i}) = 2*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écalage par rapport à 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
+20 -1
View File
@@ -1,17 +1,36 @@
function [] = initializeMirror(args)
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid'})} = 'rigid'
args.shape char {mustBeMember(args.shape,{'spherical', 'conical'})} = 'spherical'
args.angle (1,1) double {mustBeNumeric, mustBePositive} = 45 % [deg]
end
mirror = struct();
switch args.type
case 'none'
mirror.type = 0;
case 'rigid'
mirror.type = 1;
end
mirror.h = 50; % Height of the mirror [mm]
mirror.thickness = 25; % Thickness of the plate supporting the sample [mm]
mirror.hole_rad = 120; % radius of the hole in the mirror [mm]
mirror.support_rad = 100; % radius of the support plate [mm]
mirror.jacobian = 150; % point of interest offset in z (above the top surfave) [mm]
% point of interest offset in z (above the top surfave) [mm]
switch args.type
case 'none'
mirror.jacobian = 200;
case 'rigid'
mirror.jacobian = 200 - mirror.h;
end
mirror.rad = 180; % radius of the mirror (at the bottom surface) [mm]
mirror.density = 2400; % Density of the material [kg/m3]
+10
View File
@@ -1,6 +1,7 @@
function [ry] = initializeRy(args)
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
args.x11 (1,1) double {mustBeNumeric} = 0 % [m]
args.y11 (1,1) double {mustBeNumeric} = 0 % [m]
args.z11 (1,1) double {mustBeNumeric} = 0 % [m]
@@ -17,6 +18,15 @@ end
ry = struct();
switch args.type
case 'none'
ry.type = 0;
case 'rigid'
ry.type = 1;
case 'flexible'
ry.type = 2;
end
% Ry - Guide for the tilt stage
ry.guide.density = 7800; % [kg/m3]
ry.guide.STEP = './STEPS/ry/Tilt_Guide.STEP';
+10
View File
@@ -1,6 +1,7 @@
function [rz] = initializeRz(args)
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
args.x0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
args.y0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
args.z0 (1,1) double {mustBeNumeric} = 0 % Equilibrium position of the Joint [m]
@@ -10,6 +11,15 @@ end
rz = struct();
switch args.type
case 'none'
rz.type = 0;
case 'rigid'
rz.type = 1;
case 'flexible'
rz.type = 2;
end
% Spindle - Slip Ring
rz.slipring.density = 7800; % [kg/m3]
rz.slipring.STEP = './STEPS/rz/Spindle_Slip_Ring.STEP';
+10
View File
@@ -1,6 +1,7 @@
function [sample] = initializeSample(args)
arguments
args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible'
args.radius (1,1) double {mustBeNumeric, mustBePositive} = 0.1 % [m]
args.height (1,1) double {mustBeNumeric, mustBePositive} = 0.3 % [m]
args.mass (1,1) double {mustBeNumeric, mustBePositive} = 50 % [kg]
@@ -13,6 +14,15 @@ end
sample = struct();
switch args.type
case 'none'
sample.type = 0;
case 'rigid'
sample.type = 1;
case 'flexible'
sample.type = 2;
end
sample.radius = args.radius; % [m]
sample.height = args.height; % [m]
sample.mass = args.mass; % [kg]
+15
View File
@@ -0,0 +1,15 @@
function [] = initializeSimscapeConfiguration(args)
arguments
args.gravity logical {mustBeNumericOrLogical} = true
end
conf_simscape = struct();
if args.gravity
conf_simscape.type = 1;
else
conf_simscape.type = 2;
end
save('./mat/conf_simscape.mat', 'conf_simscape');
+10
View File
@@ -1,6 +1,7 @@
function [ty] = initializeTy(args)
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible'
args.x11 (1,1) double {mustBeNumeric} = 0 % [m]
args.z11 (1,1) double {mustBeNumeric} = 0 % [m]
args.x21 (1,1) double {mustBeNumeric} = 0 % [m]
@@ -13,6 +14,15 @@ end
ty = struct();
switch args.type
case 'none'
ty.type = 0;
case 'rigid'
ty.type = 1;
case 'flexible'
ty.type = 2;
end
% Ty Granite frame
ty.granite_frame.density = 7800; % [kg/m3] => 43kg
ty.granite_frame.STEP = './STEPS/Ty/Ty_Granite_Frame.STEP';