summaryrefslogtreecommitdiffstats
path: root/uav_performance_musyn.m
diff options
context:
space:
mode:
Diffstat (limited to 'uav_performance_musyn.m')
-rw-r--r--uav_performance_musyn.m57
1 files changed, 39 insertions, 18 deletions
diff --git a/uav_performance_musyn.m b/uav_performance_musyn.m
index 57237fa..5ad5fa5 100644
--- a/uav_performance_musyn.m
+++ b/uav_performance_musyn.m
@@ -19,32 +19,32 @@ function [perf] = uav_performance_musyn(params, do_plots)
s = tf('s');
% Bandwitdhs
-bw_alpha = .7 * params.actuators.ServoNominalAngularVelocity;
-bw_omega = 8;
+T_alpha = params.actuators.ServoSecondsTo60Deg;
+T_omega = 0.1;
-bw_xy = .1;
-bw_z = .4;
+T_xy = 8;
+T_z = 10;
-bw_xydot = .5;
-bw_zdot = .1;
+% Inverse performance functions
-bw_phitheta = bw_xy;
-bw_psi = .08;
+W_Palpha = make_weight(1/T_alpha, 10, 4);
+W_Pomega = make_weight(1/T_omega, 10, 2);
-% Inverse performance functions
-W_Palpha = .25 / (s / bw_alpha + 1);
-W_Pomega = .1 / (s / bw_omega + 1);
+W_Rxy = 1 / ((s * T_xy)^2 + 2 * T_xy * .8 * s + 1);
+W_Rz = 1 / (s * T_z + 1);
+
+W_Pxy = tf(5);
+W_Pz = tf(1);
-W_Pxy = 2 * bw_xy^2 / (s^2 + 2 * .9 * bw_xy * s + bw_xy^2);
-W_Pz = bw_z^2 / (s^2 + 2 * 1 * bw_z * s + bw_z^2);
+W_Pxydot = tf(.01);
+W_Pzdot = tf(.1);
-W_Pxydot = tf(.1); % .2 / (s / bw_xydot + 1);
-W_Pzdot = tf(.1); % .5 / (s / bw_zdot + 1);
-
-W_Pphitheta = .01 / (s / bw_phitheta + 1);
-W_Ppsi = tf(.1); % .1 / (s / bw_psi + 1);
+W_Pphitheta = .001 / (s * T_xy + 1);
+W_Ppsi = tf(.1);
% Construct performance vector by combining xy and z
+W_ref = blkdiag(W_Rxy * eye(2), W_Rz);
+
W_PP = blkdiag(W_Pxy * eye(2), W_Pz);
W_PPdot = blkdiag(W_Pxydot * eye(2), W_Pzdot);
W_PTheta = blkdiag(W_Pphitheta * eye(2), W_Ppsi);
@@ -52,6 +52,7 @@ W_PTheta = blkdiag(W_Pphitheta * eye(2), W_Ppsi);
perf = struct(...
'FlapAngle', W_Palpha * eye(4), ...
'Thrust', W_Pomega, ...
+ 'ReferenceFilter', W_ref, ...
'Position', W_PP, ...
'Velocity', W_PPdot, ...
'Angles', W_PTheta);
@@ -100,4 +101,24 @@ if do_plots
end
end
+
+% Make a n-order performance weight function
+%
+% Arguments:
+% OMEGA Cutting frequency (-3dB)
+% A Magnitude at DC, i.e. |Wp(0)|
+% M Magnitude at infinity, i.e. |Wp(inf)|
+% ORD Order
+function [Wp] = make_weight(omega, A, M, ord)
+
+if nargin > 3
+ n = ord;
+else
+ n = 1;
+end
+
+s = tf('s');
+Wp = (s / (M^(1/n)) + omega)^n / (s + omega * A^(1/n))^n;
+
+end
% vim: ts=2 sw=2 et: