nass-simscape/demonstration/sample_pos_init.m
Thomas Dehaeze 7575aee987 Add metrology element (change of base, computation of error)
Lot's of new things:
- try to use less .mat files
- computation of setpoint and error in the cartesian frame fixed to the granite
- change of base to have the errors w.r.t. the NASS base
- add script to plot setpoint, position and error
2018-10-24 15:08:23 +02:00

73 lines
1.3 KiB
Matlab

%%
clear; close all; clc;
%% Initialize simulation configuration
opts_sim = struct(...
'Tsim', 1 ...
);
initializeSimConf(opts_sim);
%% Initialize Inputs
load('./mat/sim_conf.mat', 'sim_conf')
time_vector = 0:sim_conf.Ts:sim_conf.Tsim;
% Translation Stage
ty = 0.05*ones(length(time_vector), 1);
% Tilt Stage
ry = 2*pi*(3/360)*ones(length(time_vector), 1);
% ry = 2*pi*(3/360)*sin(2*pi*time_vector);
% Spindle
rz = 2*pi*1*(time_vector);
% rz = 2*pi*(190/360)*ones(length(time_vector), 1);
% Micro Hexapod
u_hexa = zeros(length(time_vector), 6);
% Gravity Compensator system
mass = zeros(length(time_vector), 2);
mass(:, 2) = pi;
opts_inputs = struct(...
'ty', ty, ...
'ry', ry, ...
'rz', rz, ...
'u_hexa', u_hexa, ...
'mass', mass ...
);
initializeInputs(opts_inputs);
%% Initialize SolidWorks Data
initializeSolids();
%% Initialize Ground
initializeGround();
%% Initialize Granite
initializeGranite();
%% Initialize Translation stage
initializeTy();
%% Initialize Tilt Stage
initializeRy();
%% Initialize Spindle
initializeRz();
%% Initialize Hexapod Symétrie
initializeMicroHexapod();
%% Initialize Center of Gravity compensation
initializeAxisc();
%% Initialize NASS
initializeNanoHexapod(struct('actuator', 'piezo'));
%% Initialize Sample
initializeSample(struct('mass', 20));