summaryrefslogtreecommitdiffstats
path: root/uav.m
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-31 15:31:02 +0200
committerNao Pross <np@0hm.ch>2024-05-31 15:31:02 +0200
commitd2d174694099a2e9e88124287e2fd32c3cc4e808 (patch)
tree5bb4a53a820ec32d175845a9062888fdb26b4f96 /uav.m
parentAdd worst case (diff)
downloaduav-d2d174694099a2e9e88124287e2fd32c3cc4e808.tar.gz
uav-d2d174694099a2e9e88124287e2fd32c3cc4e808.zip
Update model and weightsHEADmaster
Diffstat (limited to 'uav.m')
-rw-r--r--uav.m18
1 files changed, 6 insertions, 12 deletions
diff --git a/uav.m b/uav.m
index 4155e93..ac766bb 100644
--- a/uav.m
+++ b/uav.m
@@ -9,7 +9,7 @@
clear; clc; close all; s = tf('s');
do_plots = true; % runs faster without
-do_hinf = false;
+do_hinf = true;
do_musyn = true;
fprintf('Controller synthesis for ducted fan VTOL micro-UAV\n')
@@ -80,7 +80,7 @@ if do_hinf
);
ctrl.hinf = struct( ...
- 'Name', '$\mathcal{H}_{\infty}$', ...
+ 'Name', 'Nominal $\mathcal{H}_{\infty}$', ...
'K', K_inf, ...
'index', index ...
);
@@ -142,7 +142,7 @@ drawnow;
if do_musyn
fprintf('Generating system model for mu-synthesis design...\n');
- model = uav_model(params, perf_musyn, uncert);
+ model = uav_model(params, perf_hinf, uncert);
fprintf('Performing mu-synthesis controller design...\n')
@@ -175,7 +175,7 @@ if do_musyn
d_scales_max_degree = 5;
d_scales_max_err = 15;
d_scales_max_err_p = .05; % in percentage
- d_scales_improvement_p = .25; % in percentage, avoid diminishing returns
+ d_scales_improvement_p = .1; % in percentage, avoid diminishing returns
% Limit order of scaled plant
scaled_plant_reduce_ord = 100;
@@ -208,7 +208,7 @@ if do_musyn
% according to parameters given above
d_scales_degrees = {
0, 0, 0, 0, 0, inf, inf; % alpha
- 5, 1, inf, inf, inf, inf, inf; % omega
+ 3, inf, inf, inf, inf, inf, inf; % omega
0, 0, 0, 0, 0, inf, inf; % state
0, 0, 0, 0, 0, inf, inf; % perf
};
@@ -346,10 +346,6 @@ if do_musyn
error('Failed to synethesize H-infinity controller');
end
- if it == 1
- K_hinf = K;
- end
-
% Calculate frequency response of closed loop
N = minreal(lft(P, K), [], false);
M = minreal(N(idx.OutputUncertain, idx.InputUncertain), [], false);
@@ -623,8 +619,6 @@ if do_musyn
Delta = Delta / norm(Delta, inf);
% Save controllers
- ctrl.hinf = struct('Name', '$\mathcal{H}_{\infty}$', 'K', K_hinf);
-
ctrl.musyn = struct('Name', '$\mu$-Synthesis', ...
'K', K, 'Delta', Delta, ...
'mu_rp', mu_rp, 'mu_rs', mu_rs);
@@ -696,6 +690,6 @@ if do_musyn
uncert.Delta = ctrl.musyn.Delta;
simout = uav_sim_step(params, model, ctrl.musyn, uncert, nsamples, T, do_plots, do_noise);
- simout = uav_sim_step(params, model, ctrl.hinf, uncert, nsamples, 5, do_plots, do_noise);
+ simout = uav_sim_step(params, model, ctrl.hinf, uncert, nsamples, T, do_plots, do_noise);
uncert = rmfield(uncert, 'Delta');
end