36 KiB
Stewart Platform - Simscape Model
- Introduction
- Procedure
- Matlab Code
initializeFramesPositions
: Initialize the positions of frames {A}, {B}, {F} and {M}generateCubicConfiguration
: Generate a Cubic ConfigurationcomputeJointsPose
: Compute the Pose of the JointsinitializeStrutDynamics
: Add Stiffness and Damping properties of each strut
Introduction ignore
Stewart platforms are generated in multiple steps.
We define 4 important frames:
- $\{F\}$: Frame fixed to the Fixed base and located at the center of its bottom surface. This is used to fix the Stewart platform to some support.
- $\{M\}$: Frame fixed to the Moving platform and located at the center of its top surface. This is used to place things on top of the Stewart platform.
- $\{A\}$: Frame fixed to the fixed base. It defined the center of rotation of the moving platform.
- $\{B\}$: Frame fixed to the moving platform. The motion of the moving platforms and forces applied to it are defined with respect to this frame $\{B\}$.
Then, we define the location of the spherical joints:
- $\bm{a}_{i}$ are the position of the spherical joints fixed to the fixed base
- $\bm{b}_{i}$ are the position of the spherical joints fixed to the moving platform
We define the rest position of the Stewart platform:
- For simplicity, we suppose that the fixed base and the moving platform are parallel and aligned with the vertical axis at their rest position.
- Thus, to define the rest position of the Stewart platform, we just have to defined its total height $H$. $H$ corresponds to the distance from the bottom of the fixed base to the top of the moving platform.
From $\bm{a}_{i}$ and $\bm{b}_{i}$, we can determine the length and orientation of each strut:
- $l_{i}$ is the length of the strut
- ${}^{A}\hat{\bm{s}}_{i}$ is the unit vector align with the strut
The position of the Spherical joints can be computed using various methods:
- Cubic configuration
- Circular configuration
- Arbitrary position
- These methods should be easily scriptable and corresponds to specific functions that returns ${}^{F}\bm{a}_{i}$ and ${}^{M}\bm{b}_{i}$. The input of these functions are the parameters corresponding to the wanted geometry.
For Simscape, we need:
- The position and orientation of each spherical joint fixed to the fixed base: ${}^{F}\bm{a}_{i}$ and ${}^{F}\bm{R}_{a_{i}}$
- The position and orientation of each spherical joint fixed to the moving platform: ${}^{M}\bm{b}_{i}$ and ${}^{M}\bm{R}_{b_{i}}$
- The rest length of each strut: $l_{i}$
- The stiffness and damping of each actuator: $k_{i}$ and $c_{i}$
- The position of the frame $\{A\}$ with respect to the frame $\{F\}$: ${}^{F}\bm{O}_{A}$
- The position of the frame $\{B\}$ with respect to the frame $\{M\}$: ${}^{M}\bm{O}_{B}$
Procedure
The procedure to define the Stewart platform is the following:
- Define the initial position of frames {A}, {B}, {F} and {M}.
We do that using the
initializeFramesPositions
function. We have to specify the total height of the Stewart platform $H$ and the position ${}^{M}O_{B}$ of {B} with respect to {M}. -
Compute the positions of joints ${}^{F}a_{i}$ and ${}^{M}b_{i}$. We can do that using various methods depending on the wanted architecture:
generateCubicConfiguration
permits to generate a cubic configuration
- Compute the position and orientation of the joints with respect to the fixed base and the moving platform.
This is done with the
computeJointsPose
function. - Define the dynamical properties of the Stewart platform. The output are the stiffness and damping of each strut $k_{i}$ and $c_{i}$. This can be done we simply choosing directly the stiffness and damping of each strut. The stiffness and damping of each actuator can also be determine from the wanted stiffness of the Stewart platform for instance.
- Define the mass and inertia of each element of the Stewart platform.
By following this procedure, we obtain a Matlab structure stewart
that contains all the information for the Simscape model and for further analysis.
Matlab Code
Simscape Model
open('stewart_platform.slx')
Test the functions
stewart = initializeFramesPositions(struct('H', 90e-3, 'MO_B', 50e-3));
stewart = generateCubicConfiguration(stewart, struct('Hc', 60e-3, 'FOc', 50e-3, 'FHa', 15e-3, 'MHb', 15e-3));
stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart, struct('Ki', 1e6*ones(6,1), 'Ci', 1e2*ones(6,1)));
initializeFramesPositions
: Initialize the positions of frames {A}, {B}, {F} and {M}
<<sec:initializeFramesPositions>>
This Matlab function is accessible here.
Function description
function [stewart] = initializeFramesPositions(opts_param)
% initializeFramesPositions - Initialize the positions of frames {A}, {B}, {F} and {M}
%
% Syntax: [stewart] = initializeFramesPositions(H, MO_B)
%
% Inputs:
% - opts_param - Structure with the following fields:
% - H [1x1] - Total Height of the Stewart Platform [m]
% - MO_B [1x1] - Height of the frame {B} with respect to {M} [m]
%
% Outputs:
% - stewart - A structure with the following fields:
% - H [1x1] - Total Height of the Stewart Platform [m]
% - FO_M [3x1] - Position of {M} with respect to {F} [m]
% - MO_B [3x1] - Position of {B} with respect to {M} [m]
% - FO_A [3x1] - Position of {A} with respect to {F} [m]
Optional Parameters
Default values for opts.
opts = struct( ...
'H', 90e-3, ... % [m]
'MO_B', 50e-3 ... % [m]
);
Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
end
Initialize the Stewart structure
stewart = struct();
Compute the position of each frame
stewart.H = opts.H; % Total Height of the Stewart Platform [m]
stewart.FO_M = [0; 0; stewart.H]; % Position of {M} with respect to {F} [m]
stewart.MO_B = [0; 0; opts.MO_B]; % Position of {B} with respect to {M} [m]
stewart.FO_A = stewart.MO_B + stewart.FO_M; % Position of {A} with respect to {F} [m]
generateCubicConfiguration
: Generate a Cubic Configuration
<<sec:generateCubicConfiguration>>
This Matlab function is accessible here.
Function description
function [stewart] = generateCubicConfiguration(stewart, opts_param)
% generateCubicConfiguration - Generate a Cubic Configuration
%
% Syntax: [stewart] = generateCubicConfiguration(stewart, opts_param)
%
% Inputs:
% - stewart - A structure with the following fields
% - H [1x1] - Total height of the platform [m]
% - opts_param - Structure with the following fields:
% - Hc [1x1] - Height of the "useful" part of the cube [m]
% - FOc [1x1] - Height of the center of the cute with respect to {F} [m]
% - FHa [1x1] - Height of the plane joining the points ai with respect to the frame {F} [m]
% - MHb [1x1] - Height of the plane joining the points bi with respect to the frame {M} [m]
%
% Outputs:
% - stewart - updated Stewart structure with the added fields:
% - Fa [3x6] - Its i'th column is the position vector of joint ai with respect to {F}
% - Mb [3x6] - Its i'th column is the position vector of joint bi with respect to {M}
Optional Parameters
Default values for opts.
opts = struct( ...
'Hc', 60e-3, ... % [m]
'FOc', 50e-3, ... % [m]
'FHa', 15e-3, ... % [m]
'MHb', 15e-3 ... % [m]
);
Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
end
Position of the Cube
We define the useful points of the cube with respect to the Cube's center. ${}^{C}C$ are the 6 vertices of the cubes expressed in a frame {C} which is located at the center of the cube and aligned with {F} and {M}.
sx = [ 2; -1; -1];
sy = [ 0; 1; -1];
sz = [ 1; 1; 1];
R = [sx, sy, sz]./vecnorm([sx, sy, sz]);
L = opts.Hc*sqrt(3);
Cc = R'*[[0;0;L],[L;0;L],[L;0;0],[L;L;0],[0;L;0],[0;L;L]] - [0;0;1.5*opts.Hc];
CCf = [Cc(:,1), Cc(:,3), Cc(:,3), Cc(:,5), Cc(:,5), Cc(:,1)]; % CCf(:,i) corresponds to the bottom cube's vertice corresponding to the i'th leg
CCm = [Cc(:,2), Cc(:,2), Cc(:,4), Cc(:,4), Cc(:,6), Cc(:,6)]; % CCm(:,i) corresponds to the top cube's vertice corresponding to the i'th leg
Compute the pose
We can compute the vector of each leg ${}^{C}\hat{\bm{s}}_{i}$ (unit vector from ${}^{C}C_{f}$ to ${}^{C}C_{m}$).
CSi = (CCm - CCf)./vecnorm(CCm - CCf);
We now which to compute the position of the joints $a_{i}$ and $b_{i}$.
stewart.Fa = CCf + [0; 0; opts.FOc] + ((opts.FHa-(opts.FOc-opts.Hc/2))./CSi(3,:)).*CSi;
stewart.Mb = CCf + [0; 0; opts.FOc-stewart.H] + ((stewart.H-opts.MHb-(opts.FOc-opts.Hc/2))./CSi(3,:)).*CSi;
computeJointsPose
: Compute the Pose of the Joints
<<sec:computeJointsPose>>
This Matlab function is accessible here.
Function description
function [stewart] = computeJointsPose(stewart)
% computeJointsPose -
%
% Syntax: [stewart] = computeJointsPose(stewart, opts_param)
%
% Inputs:
% - stewart - A structure with the following fields
% - FO_A [3x1] - Position of {A} with respect to {F}
% - MO_B [3x1] - Position of {B} with respect to {M}
% - FO_M [3x1] - Position of {M} with respect to {F}
%
% Outputs:
% - stewart - A structure with the following added fields
% - Aa [3x6] - The i'th column is the position of ai with respect to {A}
% - Ab [3x6] - The i'th column is the position of bi with respect to {A}
% - Ba [3x6] - The i'th column is the position of ai with respect to {B}
% - Bb [3x6] - The i'th column is the position of bi with respect to {B}
% - l [6x1] - The i'th element is the initial length of strut i
% - As [3x6] - The i'th column is the unit vector of strut i expressed in {A}
% - Bs [3x6] - The i'th column is the unit vector of strut i expressed in {B}
% - FRa [3x3x6] - The i'th 3x3 array is the rotation matrix to orientate the bottom of the i'th strut from {F}
% - MRb [3x3x6] - The i'th 3x3 array is the rotation matrix to orientate the top of the i'th strut from {M}
Compute the position of the Joints
stewart.Aa = stewart.Fa - repmat(stewart.FO_A, [1, 6]);
stewart.Bb = stewart.Mb - repmat(stewart.MO_B, [1, 6]);
stewart.Ab = stewart.Bb - repmat(-stewart.MO_B-stewart.FO_M+stewart.FO_A, [1, 6]);
stewart.Ba = stewart.Aa - repmat( stewart.MO_B+stewart.FO_M-stewart.FO_A, [1, 6]);
Compute the strut length and orientation
stewart.As = (stewart.Ab - stewart.Aa)./vecnorm(stewart.Ab - stewart.Aa); % As_i is the i'th vector of As
stewart.l = vecnorm(stewart.Ab - stewart.Aa)';
stewart.Bs = (stewart.Bb - stewart.Ba)./vecnorm(stewart.Bb - stewart.Ba);
Compute the orientation of the Joints
stewart.FRa = zeros(3,3,6);
stewart.MRb = zeros(3,3,6);
for i = 1:6
stewart.FRa(:,:,i) = [cross([0;1;0], stewart.As(:,i)) , cross(stewart.As(:,i), cross([0;1;0], stewart.As(:,i))) , stewart.As(:,i)];
stewart.FRa(:,:,i) = stewart.FRa(:,:,i)./vecnorm(stewart.FRa(:,:,i));
stewart.MRb(:,:,i) = [cross([0;1;0], stewart.Bs(:,i)) , cross(stewart.Bs(:,i), cross([0;1;0], stewart.Bs(:,i))) , stewart.Bs(:,i)];
stewart.MRb(:,:,i) = stewart.MRb(:,:,i)./vecnorm(stewart.MRb(:,:,i));
end
initializeStrutDynamics
: Add Stiffness and Damping properties of each strut
<<sec:initializeStrutDynamics>>
This Matlab function is accessible here.
Function description
function [stewart] = initializeStrutDynamics(stewart, opts_param)
% initializeStrutDynamics - Add Stiffness and Damping properties of each strut
%
% Syntax: [stewart] = initializeStrutDynamics(opts_param)
%
% Inputs:
% - opts_param - Structure with the following fields:
% - Ki [6x1] - Stiffness of each strut [N/m]
% - Ci [6x1] - Damping of each strut [N/(m/s)]
%
% Outputs:
% - stewart - updated Stewart structure with the added fields:
% - Ki [6x1] - Stiffness of each strut [N/m]
% - Ci [6x1] - Damping of each strut [N/(m/s)]
Optional Parameters
Default values for opts.
opts = struct( ...
'Ki', 1e6*ones(6,1), ... % [N/m]
'Ci', 1e2*ones(6,1) ... % [N/(m/s)]
);
Populate opts with input parameters
if exist('opts_param','var')
for opt = fieldnames(opts_param)'
opts.(opt{1}) = opts_param.(opt{1});
end
end
Add Stiffness and Damping properties of each strut
stewart.Ki = opts.Ki;
stewart.Ci = opts.Ci;