Add index.org file with matlab functions included
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
function [K] = getStiffnessMatrix(k, J)
 | 
			
		||||
    % k - leg stiffness
 | 
			
		||||
    % J - Jacobian matrix
 | 
			
		||||
% k - leg stiffness
 | 
			
		||||
% J - Jacobian matrix
 | 
			
		||||
    K = k*(J'*J);
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
function [sys] = identifyPlant(opts_param)
 | 
			
		||||
    %% Default values for opts
 | 
			
		||||
%% Default values for opts
 | 
			
		||||
    opts = struct();
 | 
			
		||||
 | 
			
		||||
    %% Populate opts with input parameters
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
function [stewart] = initializeHexapod(opts_param)
 | 
			
		||||
    %% Default values for opts
 | 
			
		||||
%% Default values for opts
 | 
			
		||||
    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
 | 
			
		||||
    if exist('opts_param','var')
 | 
			
		||||
@@ -54,10 +54,10 @@ function [stewart] = initializeHexapod(opts_param)
 | 
			
		||||
    elseif strcmp(opts.actuator, 'lorentz')
 | 
			
		||||
        Leg.k.ax = 1e4; % Stiffness of each leg [N/m]
 | 
			
		||||
        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.c.ax = 100;           % [N/(m/s)]
 | 
			
		||||
   else
 | 
			
		||||
    else
 | 
			
		||||
        error('opts.actuator should be piezo or lorentz or numeric value');
 | 
			
		||||
    end
 | 
			
		||||
    Leg.rad.bottom = 12;   % Radius of the cylinder of the bottom part [mm]
 | 
			
		||||
@@ -109,7 +109,7 @@ function [stewart] = initializeHexapod(opts_param)
 | 
			
		||||
 | 
			
		||||
    %% Initialize Parameters
 | 
			
		||||
    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
 | 
			
		||||
        stewart.pos_base = zeros(6, 3);
 | 
			
		||||
        stewart.pos_top = zeros(6, 3);
 | 
			
		||||
 | 
			
		||||
@@ -188,18 +188,18 @@ function [stewart] = initializeHexapod(opts_param)
 | 
			
		||||
 | 
			
		||||
        %% Compute Jacobian Matrix
 | 
			
		||||
        % TODO
 | 
			
		||||
%         aa = stewart.pos_top_tranform + (stewart.jacobian - stewart.TP.thickness - stewart.SP.height.top)*1e-3*[zeros(6, 2),ones(6, 1)];
 | 
			
		||||
        %         aa = stewart.pos_top_tranform + (stewart.jacobian - stewart.TP.thickness - stewart.SP.height.top)*1e-3*[zeros(6, 2),ones(6, 1)];
 | 
			
		||||
        bb = stewart.pos_top_tranform - (stewart.TP.thickness + stewart.SP.height.top)*1e-3*[zeros(6, 2),ones(6, 1)];
 | 
			
		||||
        bb = bb - stewart.jacobian*1e-3*[zeros(6, 2),ones(6, 1)];
 | 
			
		||||
        stewart.J = getJacobianMatrix(leg_vectors', bb');
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        stewart.K = stewart.Leg.k.ax*stewart.J'*stewart.J;
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    %% Compute the Jacobian Matrix
 | 
			
		||||
    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
 | 
			
		||||
    % 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';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
function [] = initializeSample(opts_param)
 | 
			
		||||
    %% Default values for opts
 | 
			
		||||
%% Default values for opts
 | 
			
		||||
    sample = struct( ...
 | 
			
		||||
        'radius',     100, ... % radius of the cylinder [mm]
 | 
			
		||||
        'height',     300, ... % height of the cylinder [mm]
 | 
			
		||||
@@ -7,7 +7,7 @@ function [] = initializeSample(opts_param)
 | 
			
		||||
        'measheight', 150, ... % measurement point z-offset [mm]
 | 
			
		||||
        'offset',     [0, 0, 0],   ... % offset position of the sample [mm]
 | 
			
		||||
        'color',      [0.9 0.1 0.1] ...
 | 
			
		||||
    );
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
    %% Populate opts with input parameters
 | 
			
		||||
    if exist('opts_param','var')
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user