diff options
Diffstat (limited to 'uav_model.m')
-rw-r--r-- | uav_model.m | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/uav_model.m b/uav_model.m index 2ae4d96..5650946 100644 --- a/uav_model.m +++ b/uav_model.m @@ -1,5 +1,5 @@ % Copyright (C) 2024, Naoki Sean Pross, ETH Zürich -% +% % Compute model for UAV for given set of parameters. function [model] = uav_model(params) @@ -95,7 +95,7 @@ tau_4 = cross((d * uvec_z - a/3 * uvec_y), F_4); % Total force acting on the UAV in the body frame F = R * (m * g * uvec_k) ... % gravity - k_T * omega^2 * uvec_z ... % thrust - + F_1 + F_2 + F_3 + F_4; % flaps + + F_1 + F_2 + F_3 + F_4; % flaps % Total torque acting on the UAV in the body frame tau = J_r * omega * R * cross(uvec_k, Omega) + ... % gyroscopic procession @@ -117,7 +117,7 @@ u = [alpha; omega]; f = [ Pdot; R' * F / m; % translational dynamics - U * Omega; + U * Omega; inv(J) * (tau - cross(Omega, J * Omega)); % rotational dynamics ]; @@ -184,10 +184,8 @@ D = zeros(12, 5); % Create state space object sys = ss(A, B, C, D); -% ------------------------------------------------------------------------ -% Measurement model - -% TODO: add sensor fusion delay +% T = params.actuators.MeasurementDelay; +% sys = ss(A, B, C, D, 'OutputDelay', T); % ------------------------------------------------------------------------ % Check properties of linearized model @@ -198,7 +196,7 @@ Wc = ctrb(sys); if rank(Wc) < nx fprintf('Linearized system has %d uncontrollable states!\n', ... (nx - rank(Wc))); - + % Is the system at least stabilizable? unstabilizable = 0; for i = 1:nx @@ -222,10 +220,10 @@ end % Check system observability / detectability Wo = obsv(sys); if rank(Wo) < nx - fprintf('Linearized system has %d unobservable state!\n', ... + fprintf('Linearized system has %d unobservable states!\n', ... (nx - rank(Wo))); % is the system at least detectable? - undetectable = 0 + undetectable = 0; for i = 1:nx if real(eigvals(i)) >= 0 % PBH test @@ -268,3 +266,4 @@ model.linear = struct(... ); end +% vim: ts=2 sw=2 et: |