Add DRAWER to index.org

This commit is contained in:
Thomas Dehaeze 2019-03-21 15:56:28 +01:00
parent 057ac440aa
commit 54109bf1d7

245
index.org
View File

@ -1,4 +1,52 @@
#+TITLE: Stewart Platform with Simscape #+TITLE: Stewart Platform with Simscape
:DRAWER:
#+STARTUP: overview
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="css/readtheorg.css"/>
#+HTML_HEAD: <script src="js/jquery.min.js"></script>
#+HTML_HEAD: <script src="js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="js/readtheorg.js"></script>
#+LATEX_CLASS: cleanreport
#+LaTeX_CLASS_OPTIONS: [tocnp, secbreak, minted]
#+LaTeX_HEADER: \newcommand{\authorFirstName}{Thomas}
#+LaTeX_HEADER: \newcommand{\authorLastName}{Dehaeze}
#+LaTeX_HEADER: \newcommand{\authorEmail}{dehaeze.thomas@gmail.com}
#+PROPERTY: header-args:matlab :session *MATLAB*
#+PROPERTY: header-args:matlab+ :comments org
#+PROPERTY: header-args:matlab+ :exports both
#+PROPERTY: header-args:matlab+ :eval no-export
#+PROPERTY: header-args:matlab+ :output-dir figs
#+PROPERTY: header-args:matlab+ :mkdirp yes
:END:
#+begin_src matlab :results none
<<matlab-init>>
addpath('src');
addpath('library');
#+end_src
#+begin_src matlab :results none
open stewart_identification
#+end_src
#+begin_src matlab :results output
initializeSample(struct('mass', 50));
initializeHexapod(struct('actuator', 'piezo'));
#+end_src
#+RESULTS:
: initializeSample(struct('mass', 50));
: initializeHexapod(struct('actuator', 'piezo'));
#+begin_src matlab
G = identifyPlant();
#+end_src
#+RESULTS:
* Functions * Functions
:PROPERTIES: :PROPERTIES:
@ -122,116 +170,139 @@
:PROPERTIES: :PROPERTIES:
:HEADER-ARGS:matlab+: :tangle src/initializeHexapod.m :HEADER-ARGS:matlab+: :tangle src/initializeHexapod.m
:END: :END:
The =initializeHexapod= function takes one structure that contains configurations for the hexapod and returns one structure representing the hexapod.
#+begin_src matlab #+begin_src matlab
function [stewart] = initializeHexapod(opts_param) function [stewart] = initializeHexapod(opts_param)
%% Default values for opts #+end_src
opts = struct(...
'height', 90, ... % Height of the platform [mm]
'jacobian', 150, ... % Jacobian offset [mm]
'density', 8000, ... % Density of hexapod [mm]
'name', 'stewart' ... % Name of the file
);
%% Populate opts with input parameters Default values for opts
#+begin_src matlab
opts = struct(...
'height', 90, ... % Height of the platform [mm]
'jacobian', 150, ... % Jacobian offset [mm]
'density', 8000, ... % Density of hexapod [mm]
'name', 'stewart' ... % Name of the file
);
#+end_src
Populate opts with input parameters
#+begin_src matlab
if exist('opts_param','var') if exist('opts_param','var')
for opt = fieldnames(opts_param)' for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1}); opts.(opt{1}) = opts_param.(opt{1});
end end
end end
#+end_src
%% Stewart Object Stewart Object
stewart = struct(); #+begin_src matlab
stewart.h = opts.height; % Total height of the platform [mm] stewart = struct();
stewart.jacobian = opts.jacobian; % distance from the center of the top platform stewart.h = opts.height; % Total height of the platform [mm]
% where the jacobian is computed [mm] stewart.jacobian = opts.jacobian; % Distance from the center of the top platform
% where the jacobian is computed [mm]
#+end_src
%% Bottom Plate Bottom Plate
BP = struct(); #+begin_src matlab
BP = struct();
BP.rad.int = 0; % Internal Radius [mm] BP.rad.int = 0; % Internal Radius [mm]
BP.rad.ext = 150; % External Radius [mm] BP.rad.ext = 150; % External Radius [mm]
BP.thickness = 10; % Thickness [mm] BP.thickness = 10; % Thickness [mm]
BP.leg.rad = 100; % Radius where the legs articulations are positionned [mm] BP.leg.rad = 100; % Radius where the legs articulations are positionned [mm]
BP.leg.ang = 5; % Angle Offset [deg] BP.leg.ang = 45; % Angle Offset [deg]
BP.density = opts.density; % Density of the material [kg/m3] BP.density = opts.density; % Density of the material [kg/m3]
BP.color = [0.7 0.7 0.7]; % Color [rgb] 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]; BP.shape = [BP.rad.int BP.thickness; BP.rad.int 0; BP.rad.ext 0; BP.rad.ext BP.thickness];
#+end_src
%% Top Plate Top Plate
TP = struct(); #+begin_src matlab
TP = struct();
TP.rad.int = 0; % Internal Radius [mm] TP.rad.int = 0; % Internal Radius [mm]
TP.rad.ext = 100; % Internal Radius [mm] TP.rad.ext = 100; % Internal Radius [mm]
TP.thickness = 10; % Thickness [mm] TP.thickness = 10; % Thickness [mm]
TP.leg.rad = 90; % Radius where the legs articulations are positionned [mm] TP.leg.rad = 90; % Radius where the legs articulations are positionned [mm]
TP.leg.ang = 5; % Angle Offset [deg] TP.leg.ang = 45; % Angle Offset [deg]
TP.density = opts.density; % Density of the material [kg/m3] TP.density = opts.density; % Density of the material [kg/m3]
TP.color = [0.7 0.7 0.7]; % Color [rgb] 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]; TP.shape = [TP.rad.int TP.thickness; TP.rad.int 0; TP.rad.ext 0; TP.rad.ext TP.thickness];
#+end_src
%% Leg Leg
Leg = struct(); #+begin_src matlab
Leg = struct();
Leg.stroke = 80e-6; % Maximum Stroke of each leg [m] Leg.stroke = 80e-6; % Maximum Stroke of each leg [m]
if strcmp(opts.actuator, 'piezo') if strcmp(opts.actuator, 'piezo')
Leg.k.ax = 1e7; % Stiffness of each leg [N/m] Leg.k.ax = 1e7; % Stiffness of each leg [N/m]
Leg.c.ax = 500; % [N/(m/s)] Leg.c.ax = 500; % [N/(m/s)]
elseif strcmp(opts.actuator, 'lorentz') elseif strcmp(opts.actuator, 'lorentz')
Leg.k.ax = 1e4; % Stiffness of each leg [N/m] Leg.k.ax = 1e4; % Stiffness of each leg [N/m]
Leg.c.ax = 200; % [N/(m/s)] Leg.c.ax = 200; % [N/(m/s)]
elseif isnumeric(opts.actuator) elseif isnumeric(opts.actuator)
Leg.k.ax = opts.actuator; % Stiffness of each leg [N/m] Leg.k.ax = opts.actuator; % Stiffness of each leg [N/m]
Leg.c.ax = 100; % [N/(m/s)] Leg.c.ax = 100; % [N/(m/s)]
else else
error('opts.actuator should be piezo or lorentz or numeric value'); error('opts.actuator should be piezo or lorentz or numeric value');
end end
Leg.rad.bottom = 12; % Radius of the cylinder of the bottom part [mm] 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.rad.top = 10; % Radius of the cylinder of the top part [mm]
Leg.density = opts.density; % Density of the material [kg/m3] Leg.density = opts.density; % Density of the material [kg/m3]
Leg.color.bottom = [0.5 0.5 0.5]; % Color [rgb] Leg.color.bottom = [0.5 0.5 0.5]; % Color [rgb]
Leg.color.top = [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.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.sphere.top = Leg.rad.top; % Size of the sphere at the end of the leg [mm]
#+end_src
%% Sphere Sphere
SP = struct(); #+begin_src matlab
SP = struct();
SP.height.bottom = 15; % [mm] SP.height.bottom = 15; % [mm]
SP.height.top = 15; % [mm] SP.height.top = 15; % [mm]
SP.density.bottom = opts.density; % [kg/m^3] SP.density.bottom = opts.density; % [kg/m^3]
SP.density.top = opts.density; % [kg/m^3] SP.density.top = opts.density; % [kg/m^3]
SP.color.bottom = [0.7 0.7 0.7]; % [rgb] SP.color.bottom = [0.7 0.7 0.7]; % [rgb]
SP.color.top = [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.k.ax = 0; % [N*m/deg]
SP.c.ax = 0; % [N*m/deg] SP.c.ax = 0; % [N*m/deg]
SP.thickness.bottom = SP.height.bottom-Leg.sphere.bottom; % [mm] SP.thickness.bottom = SP.height.bottom-Leg.sphere.bottom; % [mm]
SP.thickness.top = SP.height.top-Leg.sphere.top; % [mm] SP.thickness.top = SP.height.top-Leg.sphere.top; % [mm]
SP.rad.bottom = Leg.sphere.bottom; % [mm] SP.rad.bottom = Leg.sphere.bottom; % [mm]
SP.rad.top = Leg.sphere.top; % [mm] SP.rad.top = Leg.sphere.top; % [mm]
%% %%
Leg.support.bottom = [0 SP.thickness.bottom; 0 0; SP.rad.bottom 0; SP.rad.bottom SP.height.bottom]; Leg.support.bottom = [0 SP.thickness.bottom;
Leg.support.top = [0 SP.thickness.top; 0 0; SP.rad.top 0; SP.rad.top SP.height.top]; 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];
%% %%
stewart.BP = BP; stewart.BP = BP;
stewart.TP = TP; stewart.TP = TP;
stewart.Leg = Leg; stewart.Leg = Leg;
stewart.SP = SP; stewart.SP = SP;
%% %%
stewart = initializeParameters(stewart); stewart = initializeParameters(stewart);
%% %%
save('./mat/stewart.mat', 'stewart') save('./mat/stewart.mat', 'stewart')
#+end_src
%% ==============================================================
% Additional Functions
% ===============================================================
Additional Functions
#+begin_src matlab
%% Initialize Parameters %% Initialize Parameters
function [stewart] = initializeParameters(stewart) function [stewart] = initializeParameters(stewart)
%% Connection points on base and top plate w.r.t. World frame at the center of the base plate %% Connection points on base and top plate w.r.t. World frame at the center of the base plate
@ -320,8 +391,10 @@
stewart.K = stewart.Leg.k.ax*stewart.J'*stewart.J; stewart.K = stewart.Leg.k.ax*stewart.J'*stewart.J;
end end
#+end_src
%% Compute the Jacobian Matrix Compute the Jacobian Matrix
#+begin_src matlab
function J = getJacobianMatrix(RM, M_pos_base) function J = getJacobianMatrix(RM, M_pos_base)
% RM - [3x6] unit vector of each leg in the fixed frame % 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 % M_pos_base - [3x6] vector of the leg connection at the top platform location in the fixed frame