summaryrefslogtreecommitdiffstats
path: root/uav_params.m
blob: fb9121f6c4891ee3c9bb8b2a18ce8ef64f0b8b0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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