Add DRAWER to index.org

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

107
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,54 +170,70 @@
: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
Default values for opts
#+begin_src matlab
opts = struct(... opts = struct(...
'height', 90, ... % Height of the platform [mm] 'height', 90, ... % Height of the platform [mm]
'jacobian', 150, ... % Jacobian offset [mm] 'jacobian', 150, ... % Jacobian offset [mm]
'density', 8000, ... % Density of hexapod [mm] 'density', 8000, ... % Density of hexapod [mm]
'name', 'stewart' ... % Name of the file 'name', 'stewart' ... % Name of the file
); );
#+end_src
%% Populate opts with input parameters 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
#+begin_src matlab
stewart = struct(); stewart = struct();
stewart.h = opts.height; % Total height of the platform [mm] stewart.h = opts.height; % Total height of the platform [mm]
stewart.jacobian = opts.jacobian; % distance from the center of the top platform stewart.jacobian = opts.jacobian; % Distance from the center of the top platform
% where the jacobian is computed [mm] % where the jacobian is computed [mm]
#+end_src
%% Bottom Plate Bottom Plate
#+begin_src matlab
BP = struct(); 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
#+begin_src matlab
TP = struct(); 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
#+begin_src matlab
Leg = struct(); Leg = struct();
Leg.stroke = 80e-6; % Maximum Stroke of each leg [m] Leg.stroke = 80e-6; % Maximum Stroke of each leg [m]
@ -193,8 +257,10 @@
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
#+begin_src matlab
SP = struct(); SP = struct();
SP.height.bottom = 15; % [mm] SP.height.bottom = 15; % [mm]
@ -213,8 +279,14 @@
%% %%
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;
@ -227,11 +299,10 @@
%% %%
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