summaryrefslogtreecommitdiffstats
path: root/uav_params.m
blob: 8c73ae9fee93c6c6cb5c90188af7f61801d7a1e6 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
% Retrieve or compute parameters for ducted-fan VTOL micro-UAV.
%
% Copyright (C) 2024, Naoki Sean Pross, ETH Zürich
% This work is distributed under a permissive license, see LICENSE.txt

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
% Uncertainty / measurement errors in percentage (between 0 and 1)

params = struct();

% ------------------------------------------------------------------------
% Physical constants

params.physics = struct(...
  'Gravity', 9.81, ...
  'AirDensity', 1.204 ... % kg / m^3
);

% ------------------------------------------------------------------------
% Mechanical measurements

% Inertia marix at center of mass,
% numbers from CAD are in g * mm^2, convert to kg * m^2
J = [
  5.856E+08, 1.121E+06, -3.506E+05;
  1.121E+06, 4.222E+08, 6.643E+06;
  -3.506E+05, 6.643E+06, 4.678E+08
] * 1e-9;

% Approximate propeller with a disk
m_prop = 500e-3; % mass of propeller
r_prop = 85e-3; % radius of propeller
J_prop = .5 * m_prop * r_prop^2;

params.mechanical = struct(...
  'Mass', 3.5, ...
  'DuctRadius', 46e-3, ...
  'DuctHeight', 171e-3, ...
  'FlapZDistance', 98e-3, ... % flap distance along z from center of mass
  'InertiaTensor', J, ...
  'GyroscopicInertiaZ', J_prop, ... % assume small angle
  'GyroscopicInertiaZUncertainty', .05 ... % in %
);

% ------------------------------------------------------------------------
% Actuator limits and measurements

% Servos usually give a "speed" in seconds / 60 degrees without load
params.actuators = struct(...
  'PropellerMaxAngularVelocity', 620.7, ... % in rad / s
  'ServoAbsMaxAngle', 20 * pi / 180, ... % in radians
  'ServoMaxTorque', 4.3 * 1e-2, ... % in kg / m
  'ServoSecondsTo60Deg', 0.13 ... % in s / 60 deg
);

% IMU runs in NDOF mode
params.measurements = struct(...
  'SensorFusionDelay', 10e-3, ... % in s, from 100 Hz sampling rate
  'LIDARAccuracy', 10e-3, ... % in m
  'LIDARMaxDistance', 40, ... % inm
  'LIDARBandwidth', 100, ... % in Hz for z position
  'IMUBandwidth', 100 ... % in Hz
);

% ------------------------------------------------------------------------
% 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.PropellerMaxAngularVelocity;
F_max = 38.637; % in N (measured)
k_T = F_max / omega_max^2;

% Lift coefficient from data
% flap_stair = readtable('meas/Flap_Force_Stair.csv');
% [~, istart] = min(abs(flap.Force));
% [~, iend] = min(abs(flap.Force - 3));

% FIXME: LiftCoefficient comes from
% https://scienceworld.wolfram.com/physics/LiftCoefficient.html
params.aerodynamics = struct(...
  'ThrustOmegaProp', k_T, ... % in s^2 / (rad * N)
  'ThrustOmegaPropUncertainty', .01, ... % in %
  'FlapArea', 23e-3 * 10e-3, ... % in m^2
  'FlapAreaUncertainty', .1, ... % in %
  'DragCoefficients', [0, 0], ... % TODO
  'DragCoefficientsUncertainties', [.0, .0], ... % in %
  'LiftCoefficient', 2 * pi, ... % TODO
  'LiftCoefficientUncertainty', .01 ...% in %
);


% ------------------------------------------------------------------------
% Linearization point of non-linear dynamics.

% Compute theoretical thrust required to make the UAV hover
% from the relation mg = k * omega^2
% FIXME: This value should probably be replaced with a measurement
g = params.physics.Gravity;
m = params.mechanical.Mass;
k = params.aerodynamics.ThrustOmegaProp;

omega_hover = sqrt(m * g / k);

params.linearization = struct(...
  'PadeApproxOrder', 3, ...
  'Position', [0; 0; -2], ... % in inertial frame, z points down
  'Velocity', [0; 0; 0], ... % in inertial frame
  'Angles', [0; 0; pi / 4], ...   % in body frame
  'AngularVelocities', [0; 0; 0], ... % in body frame
  'Inputs', [0; 0; 0; 0; omega_hover] ... % Flaps at rest and turbine at X
);

% ------------------------------------------------------------------------
% Normalization (maximum values)

params.normalization = struct(...
  'FlapAngle', params.actuators.ServoAbsMaxAngle, ...
  'ThrustAngularVelocity', params.actuators.PropellerMaxAngularVelocity, ...
  'HPosition', .5, ... % m
  'VPosition', .5, ...% m
  'HSpeed', .5, ... % m / s
  'VSpeed', .5, ... % m / s
  'PitchRollAngle', 10 * pi / 180, ... % rad
  'YawAngle', 5 * pi / 180, ... % rad
  'AngularRate', 1 * pi / 180, ... % rad / s
  'WindSpeed', .01 ... % m / s
);
end
% vim: ts=2 sw=2 et: