-
Notifications
You must be signed in to change notification settings - Fork 0
/
quadsim_wind.m
executable file
·38 lines (33 loc) · 1.15 KB
/
quadsim_wind.m
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
% quadsim_sensors.m
%
% Generation of total wind vector in NED coordinates
%
% NOTE: This is modified from fixed-wing UAVSIM method:
% To be more appropriate for hovering vehicles (like quads)
% the Dryden gusting model was modified. It is now
% provided in NED coordinates (rather than body coordinates).
%
% Inputs:
% Gusting in NED
% Time
%
% Outputs:
% Sensor Measurements
%
% Developed for JHU EP 525.461, UAV Systems & Control
% Adapted from design project in "Small Unmanned Aircraft: Theory and
% Practice", RWBeard & TWMcClain, Princeton Univ. Press, 2012
%
function out = quadsim_wind(uu, P)
% Extract variables from input vector uu
% uu = [gust_ned(1:3); time(1)];
k=0+(1:3); gust_ned=uu(k); % Gust vector, NED coordinates, m/s
k=k(end)+(1); time=uu(k); % Simulation time, s
% Generate steady wind vector in NED coordinates
ws_ned = [P.wind_n; P.wind_e; P.wind_d];
% compute wind vector in the inertial frame
% ws_ned & gust_ned -> wind_ned
wind_ned = ws_ned + gust_ned;
% Compile function output
out = [wind_ned]; % Length 3
end