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
This commit is contained in:
Thomas Dehaeze
2018-10-24 15:08:23 +02:00
parent baedb9b571
commit 7575aee987
36 changed files with 447 additions and 135 deletions

View File

@@ -0,0 +1,50 @@
%% Plot all 6 errors expressed in the NASS base
figure;
%% Tx
subaxis(2, 3, 1);
hold on;
plot(error_nass.Time, error_nass.Data(:, 1), 'k-', 'DisplayName', '$\epsilon_x$');
legend();
hold off;
xlabel('Time (s)'); ylabel('Position (m)');
%% Ty
subaxis(2, 3, 2);
hold on;
plot(error_nass.Time, error_nass.Data(:, 2), 'k-', 'DisplayName', '$\epsilon_y$');
legend();
hold off;
xlabel('Time (s)'); ylabel('Position (m)');
%% Tz
subaxis(2, 3, 3);
hold on;
plot(error_nass.Time, error_nass.Data(:, 3), 'k-', 'DisplayName', '$\epsilon_z$');
legend();
hold off;
xlabel('Time (s)'); ylabel('Position (m)');
%% Rx
subaxis(2, 3, 4);
hold on;
plot(error_nass.Time, error_nass.Data(:, 4), 'k-', 'DisplayName', '$\epsilon_{\theta_x}$');
legend();
hold off;
xlabel('Time (s)'); ylabel('Rotation (rad)');
%% Ry
subaxis(2, 3, 5);
hold on;
plot(error_nass.Time, error_nass.Data(:, 5), 'k-', 'DisplayName', '$\epsilon_{\theta_y}$');
legend();
hold off;
xlabel('Time (s)'); ylabel('Rotation (rad)');
%% Rz
subaxis(2, 3, 6);
hold on;
plot(error_nass.Time, error_nass.Data(:, 6), 'k-', 'DisplayName', '$\epsilon_{\theta_z}$');
legend();
hold off;
xlabel('Time (s)'); ylabel('Rotation (rad)');

View File

@@ -3,7 +3,7 @@ clear; close all; clc;
%% Initialize simulation configuration
opts_sim = struct(...
'Tsim', 2 ...
'Tsim', 1 ...
);
initializeSimConf(opts_sim);
@@ -14,19 +14,22 @@ load('./mat/sim_conf.mat', 'sim_conf')
time_vector = 0:sim_conf.Ts:sim_conf.Tsim;
% Translation Stage
ty = 0*ones(length(time_vector), 1);
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, ...

View File

@@ -0,0 +1,56 @@
%%
figure;
%% Tx
subaxis(2, 3, 1);
hold on;
plot(pos.Time, pos.Data(:, 1), 'k-');
plot(setpoint.Time, setpoint.Data(:, 1), 'k--');
legend({'x - pos', 'x - setpoint'});
hold off;
xlabel('Time (s)'); ylabel('Position (m)');
%% Ty
subaxis(2, 3, 2);
hold on;
plot(pos.Time, pos.Data(:, 2), 'k-');
plot(setpoint.Time, setpoint.Data(:, 2), 'k--');
legend({'y - pos', 'y - setpoint'});
hold off;
xlabel('Time (s)'); ylabel('Position (m)');
%% Tz
subaxis(2, 3, 3);
hold on;
plot(pos.Time, pos.Data(:, 3), 'k-');
plot(setpoint.Time, setpoint.Data(:, 3), 'k--');
legend({'z - pos', 'z - setpoint'});
hold off;
xlabel('Time (s)'); ylabel('Position (m)');
%% Rx
subaxis(2, 3, 4);
hold on;
plot(pos.Time, pos.Data(:, 4), 'k-');
plot(setpoint.Time, setpoint.Data(:, 4), 'k--');
legend({'$\theta_x$ - pos', '$\theta_x$ - setpoint'});
hold off;
xlabel('Time (s)'); ylabel('Rotation (rad)');
%% Ry
subaxis(2, 3, 5);
hold on;
plot(pos.Time, pos.Data(:, 5), 'k-');
plot(setpoint.Time, setpoint.Data(:, 5), 'k--');
legend({'$\theta_y$ - pos', '$\theta_y$ - setpoint'});
hold off;
xlabel('Time (s)'); ylabel('Rotation (rad)');
%% Rz
subaxis(2, 3, 6);
hold on;
plot(pos.Time, pos.Data(:, 6), 'k-');
plot(setpoint.Time, setpoint.Data(:, 6), 'k--');
legend({'$\theta_z$ - pos', '$\theta_z$ - setpoint'});
hold off;
xlabel('Time (s)'); ylabel('Rotation (rad)');