summaryrefslogtreecommitdiffstats
path: root/uav_params.m
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-03-29 21:17:40 +0100
committerNao Pross <np@0hm.ch>2024-03-29 21:17:40 +0100
commit98e1a3bc15560a206eb31f02dd2fcacf51ff19b8 (patch)
tree31504c8630414d0a4f28e34377a43f70b8357ae8 /uav_params.m
downloaduav-98e1a3bc15560a206eb31f02dd2fcacf51ff19b8.tar.gz
uav-98e1a3bc15560a206eb31f02dd2fcacf51ff19b8.zip
Add MATLAB code
Diffstat (limited to '')
-rw-r--r--uav_params.m81
1 files changed, 81 insertions, 0 deletions
diff --git a/uav_params.m b/uav_params.m
new file mode 100644
index 0000000..fb9121f
--- /dev/null
+++ b/uav_params.m
@@ -0,0 +1,81 @@
+% Copyright (C) 2024, Naoki Sean Pross, ETH Zürich
+%
+% Retrieve / compute parameters for UAV.
+
+function [params] = uav_params()
+
+% Unit of measurements unless specified otherwise are
+% Mass in kg
+% Lenghts in m
+% Time in s
+% Frequencies in Hz
+% Angular velocities in rad / s
+
+params = struct();
+
+% ------------------------------------------------------------------------
+% Physical constants
+
+params.physics = struct(...
+ 'Gravity', 9.81, ...
+ 'AirDensity', 1.204 ... % kg / m^3
+);
+
+% ------------------------------------------------------------------------
+% Mechanical measurements
+
+params.mechanical = struct(...
+ 'Mass', 4.0, ...
+ 'DuctRadius', 46e-3, ...
+ 'DuctHeight', 171e-3, ...
+ 'FlapZDistance', 98e-3, ... % flap distance along z from center of mass
+ 'InertiaTensor', 5e-3 * eye(3), ... % TODO, assume diagonal
+ 'GyroscopicInertiaZ', 0 ... % assume no gyroscopic effects for now
+);
+
+% ------------------------------------------------------------------------
+% Actuator limits
+
+params.actuators = struct(...
+ 'TurbineMaxSpeed', 620.7, ... % In Hz
+ 'ServoAbsMaxAngleDeg', 25, ... % in Degrees
+ 'MeasurementDelay', 8e-3 ... % delay caused by sensor fusion algorithm
+);
+
+% ------------------------------------------------------------------------
+% Aerodynamics modelling
+
+% Compute thrust proportionality factor from actuator limits
+% from thrust relation F = k * omega^2.
+% FIXME: this is not ideal, need better measurements
+omega_max = params.actuators.TurbineMaxSpeed;
+F_max = 38.637; % in N (measured)
+k_T = sqrt(F_max / omega_max);
+
+params.aerodynamics = struct(...
+ 'ThrustOmegaProp', k_T, ...
+ 'FlapArea', 23e-3 * 10e-3 * 1.5, ... % FIXME factor 150% was chosen at random
+ 'DragCoefficients', [1, 1] .* 1e-3, ... % TODO
+ 'LiftCoefficient', 1e-3 ... % TODO
+);
+
+% ------------------------------------------------------------------------
+% Linearization point of non-linear dynamics.
+
+% Compute theoretical thrust required to make the UAV hover
+% from the relation mg = k * omega^2
+g = params.physics.Gravity;
+m = params.mechanical.Mass;
+k = params.aerodynamics.ThrustOmegaProp;
+
+omega_hover = sqrt(m * g / k);
+
+params.linearization = struct(...
+ 'Position', [0; 0; -3], ... % in inertial frame, z points down
+ 'Velocity', [0; 0; 0], ... % in inertial frame
+ 'Angles', [0; 0; 0], ... % in body frame
+ 'AngularVelocities', [0; 0; 0], ... % in body frame
+ 'Inputs', [0; 0; 0; 0; omega_hover] ... % Flaps at rest and turbine at X
+);
+
+end \ No newline at end of file