diff options
author | Nao Pross <np@0hm.ch> | 2024-04-01 14:00:16 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-04-01 14:00:16 +0200 |
commit | 47ce5760b1c45fc5513e56dce92e29b9363bb03e (patch) | |
tree | 8494b4f43f7b5da3615cc9b973726e69a3d5e5c5 /uav_model.m | |
parent | Whitespace (diff) | |
download | uav-47ce5760b1c45fc5513e56dce92e29b9363bb03e.tar.gz uav-47ce5760b1c45fc5513e56dce92e29b9363bb03e.zip |
Update a lot of small things and add SIMULINK model
Diffstat (limited to '')
-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: |