nass-simscape/demonstration/setpoint_vs_position.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

57 lines
1.3 KiB
Matlab

%%
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)');