-
Notifications
You must be signed in to change notification settings - Fork 1
/
init_Minnie_Loiter_FTC.m
67 lines (55 loc) · 1.8 KB
/
init_Minnie_Loiter_FTC.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
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
% Initialize simulation of quadcopter Minnie with fault-tolerant loiter
% controller
% Disclamer:
% SPDX-License-Identifier: GPL-3.0-only
%
% Copyright (C) 2020-2023 Yannic Beyer
% Copyright (C) 2022 TU Braunschweig, Institute of Flight Guidance
% *************************************************************************
%% add to path
addPathFtc();
clc_clear;
%% rotor failure parameters
failure_time_mot_1 = 1000;
failure_time_mot_2 = 1;
failure_time_mot_3 = 1000;
failure_time_mot_4 = 1000;
%% control inputs
% fly 5m square after 5s
simin = automatedStickCommands( );
%% load physical copter parameters
copter = copterLoadParams( 'copter_params_Minnie_AIAA_JGCD_2022' );
%% environment parameters
envir = envirLoadParams('params_envir','envir',0);
%% controller parameters
% load parameters
fm_loiter = lindiCopterAutoCreate( copter, 'AgilityAtti', 0.5, ...
'AgilityPos',0.2,'FilterStrength', 0, 'CntrlEffectScaling', 1 );
fm_loiter.psc.inditype = 1;
%% initial conditions (IC)
% initial angular velocity omega_Kb, in rad/s
IC.omega_Kb = [ 0; 0; 0 ];
% initial orientation in quaternions q_bg
IC.q_bg = euler2Quat( [ 0; 0; 0 ] );
% initial velocity V_Kb, in m/s
IC.V_Kb = [ 0; 0; 0 ];
% initial position s_Kg, in m
IC.s_Kg = [ 0; 0; 0 ];
% initial motor angular velocity, in rad/s
IC.omega_mot = [ 1; 1; 1; 1 ] * 843;
%% load ground parameters (grnd)
grnd = groundLoadParams( 'params_ground_default' );
%% reference position lat, lon, alt
% initial latitude, in deg
pos_ref.lat = 37.6117;
% initial longitude, in deg
pos_ref.lon = -122.37822;
% initial altitude, in m
pos_ref.alt = 15;
%% Flight Gear settings for UDP connection
% Flight Gear URL
fg.remoteURL = '127.0.0.1';
% fdm receive port of Flight Gear
fg.remotePort = 5502;
%% Open Simulink model
open_model('QuadcopterSimModel_Loiter_FTC')