summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--uav.m18
-rw-r--r--uav_model.m5
-rw-r--r--uav_model_uncertain.slxbin65416 -> 62438 bytes
-rw-r--r--uav_model_uncertain_clp.slxbin77006 -> 73551 bytes
-rw-r--r--uav_params.m4
-rw-r--r--uav_sim_step.m17
6 files changed, 21 insertions, 23 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
diff --git a/uav_model.m b/uav_model.m
index af0be20..c2d588d 100644
--- a/uav_model.m
+++ b/uav_model.m
@@ -9,8 +9,7 @@
% principles (equations of motion).
%
% * A linear model obtained by linearizing the the non linear plant model at
-% an operating point specified in the params struct argument. And adding
-% models for the actuators.
+% an operating point specified in the params struct argument.
%
% * A uncertain linear model with reference trcking built atop of the linear
% model using SIMULINK. The uncertain model contains the performance and
@@ -276,7 +275,7 @@ sys = pade(ss(A, B, C, D, 'OutputDelay', T), n);
% sys = ss(A, B, C, D);
% Add actuators
-sys = sys * model.actuators.StateSpace;
+% sys = sys * model.actuators.StateSpace;
% Remove unnecessary states
sys = minreal(sys, [], false); % slient
diff --git a/uav_model_uncertain.slx b/uav_model_uncertain.slx
index 4d6074a..28fea4a 100644
--- a/uav_model_uncertain.slx
+++ b/uav_model_uncertain.slx
Binary files differ
diff --git a/uav_model_uncertain_clp.slx b/uav_model_uncertain_clp.slx
index 46ee9d2..949b2e2 100644
--- a/uav_model_uncertain_clp.slx
+++ b/uav_model_uncertain_clp.slx
Binary files differ
diff --git a/uav_params.m b/uav_params.m
index 8963b02..8c73ae9 100644
--- a/uav_params.m
+++ b/uav_params.m
@@ -88,13 +88,13 @@ k_T = F_max / omega_max^2;
% https://scienceworld.wolfram.com/physics/LiftCoefficient.html
params.aerodynamics = struct(...
'ThrustOmegaProp', k_T, ... % in s^2 / (rad * N)
- 'ThrustOmegaPropUncertainty', .05, ... % in %
+ 'ThrustOmegaPropUncertainty', .01, ... % in %
'FlapArea', 23e-3 * 10e-3, ... % in m^2
'FlapAreaUncertainty', .1, ... % in %
'DragCoefficients', [0, 0], ... % TODO
'DragCoefficientsUncertainties', [.0, .0], ... % in %
'LiftCoefficient', 2 * pi, ... % TODO
- 'LiftCoefficientUncertainty', .05 ...% in %
+ 'LiftCoefficientUncertainty', .01 ...% in %
);
diff --git a/uav_sim_step.m b/uav_sim_step.m
index 7bf0f2b..d7facbf 100644
--- a/uav_sim_step.m
+++ b/uav_sim_step.m
@@ -146,11 +146,16 @@ if do_plots
to_deg = 180 / pi; % radians to degrees
to_rpm = pi / 30; % rad / s to RPM
+ delta = '';
+ if isfield(uncert, 'Delta')
+ delta = 'with $\Delta$';
+ end
+
% Figure for flaps and Euler angles
figure;
sgtitle(sprintf(...
- '\\bfseries Step Response of Flap and Euler Angles (%s)', ...
- ctrl.Name), 'Interpreter', 'latex');
+ '\\bfseries Step Response of Flap and Euler Angles (%s) %s', ...
+ ctrl.Name, delta), 'Interpreter', 'latex');
% Plot limits
alpha_max_deg = params.actuators.ServoAbsMaxAngle * to_deg;
@@ -256,8 +261,8 @@ if do_plots
% Plot step response from z to omega
figure;
sgtitle(sprintf(...
- '\\bfseries Step Response to Propeller (%s)', ...
- ctrl.Name), 'Interpreter', 'latex');
+ '\\bfseries Step Response to Propeller (%s) %s', ...
+ ctrl.Name, delta), 'Interpreter', 'latex');
hold on;
step(P_clp(idx.PlotOmega, idx.InputReference(3)) * to_rpm, T);
@@ -273,8 +278,8 @@ if do_plots
% Figure for position and velocity
figure;
sgtitle(sprintf(...
- '\\bfseries Step Response of Position and Speed (%s)', ...
- ctrl.Name), 'Interpreter', 'latex');
+ '\\bfseries Step Response of Position and Speed (%s) %s', ...
+ ctrl.Name, delta), 'Interpreter', 'latex');
% Plot step response from horizontal reference to horizontal position
subplot(2, 2, 1); hold on;