summaryrefslogtreecommitdiffstats
path: root/uav_sim_step.m
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-24 11:06:18 +0200
committerNao Pross <np@0hm.ch>2024-05-24 11:06:18 +0200
commit1c844e165055fca5253ed885af8c036619e9fef0 (patch)
treeba53c8b6560b8189a52131fe69a9616f4c8e0b53 /uav_sim_step.m
parentUpdate DK-iteration and clean up (diff)
downloaduav-1c844e165055fca5253ed885af8c036619e9fef0.tar.gz
uav-1c844e165055fca5253ed885af8c036619e9fef0.zip
Add more checks, update DK iteration
Diffstat (limited to 'uav_sim_step.m')
-rw-r--r--uav_sim_step.m16
1 files changed, 13 insertions, 3 deletions
diff --git a/uav_sim_step.m b/uav_sim_step.m
index 973a928..82c05e9 100644
--- a/uav_sim_step.m
+++ b/uav_sim_step.m
@@ -22,6 +22,16 @@ P_nom_clp = minreal(usys_clp(...
model.uncertain.index.OutputPlots], ...
model.uncertain.index.InputExogenous), [], false);
+% Check that closed loop is actually stable
+eigvals = eig(P_nom_clp.A);
+nx = size(P_nom_clp.A, 1);
+
+for i = 1:nx
+ if real(eigvals(i)) >= 0
+ error('Closed loop is not stable!');
+ end
+end
+
% Indices for exogenous inputs
Iwwind = (1:3)';
Iwalpha = (4:7)';
@@ -236,10 +246,10 @@ if do_plots
hold on;
step(P_nom_clp(Iomega, Ir(3)) * to_rpm, T);
- plot([0, T], [1, 1] * omega_min_rpm, 'r--');
- plot([0, T], [1, 1] * omega_max_rpm, 'r--');
+ % plot([0, T], [1, 1] * omega_min_rpm, 'r--');
+ % plot([0, T], [1, 1] * omega_max_rpm, 'r--');
grid on;
- ylim([omega_min_rpm - 1, omega_max_rpm + 1]);
+ % ylim([omega_min_rpm - 1, omega_max_rpm + 1]);
title('Vertical $z$ to Thruster $\omega$', 'Interpreter', 'latex');
ylabel('Angular Velocity (RPM)', 'Interpreter', 'latex');
xlabel('Time (seconds)', 'Interpreter', 'latex');