-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit_quadcopter_Minnie_ArduPilot_SITL.m
50 lines (40 loc) · 1.38 KB
/
init_quadcopter_Minnie_ArduPilot_SITL.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
% Initialize simulation of quadcopter Minnie with ArduCopter SITL
% 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;
%% load physical copter parameters
copter = copterLoadParams( 'copter_params_Minnie_AIAA_JGCD_2022' );
%% environment parameters
envir = envirLoadParams('params_envir','envir',0);
%% 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
pos_ref = posRefLoadParams( 'reference_position_params_default' );
% initial altitude, in m
pos_ref.alt = 10;
%% Flight Gear settings for UDP connection
% Flight Gear URL
fg.remoteURL = '127.0.0.1';
% fdm receive port of Flight Gear
fg.remotePort = 5502;
%% ArduPilot SITL parameters
SITL.sample_time = 1/400;
%% Open Simulink model
open_model('QuadcopterSimModel_ArduCopter_SITL')