parameters_Quad.m 3.51 KB
Newer Older
1
function [params] = parameters_Quad(global_params)
mmroma's avatar
mmroma committed
2
3
4
5
6
7
8
9
%parameters_APM_Quad
    % Parameters file for a Quadrotor using APM's cascaded PID controller
    
    %% Vehicle Type
    params.numRotors = 4;   % Quadrotor = 4, Hex = 6, ...
    params.cross = true;    % Cross Configuration (as opposed to plus)
            
    %% Multirotor Physics Parameters   
10
    params.g = global_params.g; % Acc. Due to Gravity (m/s^2)
mmroma's avatar
mmroma committed
11
12
13
14
15
16
    params.m = 1.05;        % Mass of Quadrotor (kg)
    params.c1 = 5;          % Motor Force Constant
    params.c2 = 0.04;       % Motor Torque Constant
    params.Jx = 0.008;      % Moment of Inertia about x (kg m^2)
    params.Jy = 0.008;      % Moment of Inertia about y (kg m^2)
    params.Jz = 0.014;      % Moment of Inertia about z (kg m^2)
17
18
19
    params.J = [params.Jx, 0, 0;
                0, params.Jy, 0;
                0, 0, params.Jz];
mmroma's avatar
mmroma committed
20
21
22
23
24
25
26
27
    params.a = 0.165;       % Length of Rotor Arm (Radius) (m)
    params.M = makeMotorMixerMatrix(params);
    
    % Motor Command to Maintain Hover assuming 0 attitude (normalized)
    params.hoverMotorCmd = (params.m * params.g) / sum(params.M(1,:));   
    
    % Thrust Value needed to maintain hover and fight gravity (N)
    params.hoverThrust =   (params.m * params.g);
28
    params.hoverThrust = params.hoverThrust .* 1.26; % eps*m*g
mmroma's avatar
mmroma committed
29
    
30
31
32
33
34
35
36
37
38
    %% Disturbances
    params.dist_F_power = 0.1 .* [1; 1; 1];   % 0-mean Band-limited, White Gaussian Dist (Ext Force)
    params.dist_F_seed = [1 2 3];
    params.dist_M_power = 0.1 .* [1; 1; 1];   % 0-mean Band-limited, White Gaussian Dist (Ext Force)
    params.dist_M_seed = [4 5 6];
    
    %% Noise
    params.noise_power = 0.1 .* ones(12,1);
    params.noise_seed = 101:112;
mmroma's avatar
mmroma committed
39
40
41
42
43
44
45
    
    %% Controller Parameters
    % Full State lqr with integral action
    params = getLQRGainMatrixIntAct(params);
    params.controller = @(X,params) fullstate_lqr_intAct(X,params);
    
    % Controller Rate (s)
mmroma's avatar
mmroma committed
46
    params.ctlDt = 0.01;
47
48
49
    
    % rc_pilot cascaded PID controller (specify gains)
    params = setPIDgains(params);
mmroma's avatar
mmroma committed
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
        
    %% Initial Conditions         
    params.x0 = [0;...      % x position [m]
                 0;...      % y position [m]
                 0;...      % z position [m]
                 0;...      % u (m/s)
                 0;...      % v (m/s)
                 0;...      % w (m/s)
                 0;...      % phi (roll) (rad)
                 0;...      % theta (pitch) (rad)
                 0;...      % psi (yaw) (rad)
                 0;...      % p (rad/s)
                 0;...      % q (rad/s)
                 0];        % r (rad/s)
             
    %% Desired Final State        
    params.xd = [0;...      % x position [m]
                 0;...      % y position [m]
                 0;...      % z position [m]
                 0;...      % u (m/s)
                 0;...      % v (m/s)
                 0;...      % w (m/s)
                 0;...      % phi (roll) (rad)
                 0;...      % theta (pitch) (rad)
                 0;...      % psi (yaw) (rad)
                 0;...      % p (rad/s)
                 0;...      % q (rad/s)
                 0];        % r (rad/s)

    %% Tether Parameters
mmroma's avatar
mmroma committed
80
    params.l_i_last = 0;    % used for simple numerical integration
mmroma's avatar
mmroma committed
81
    params.L = 0.5;         % Unstretched Length (m)
mmroma's avatar
update    
mmroma committed
82
    params.k = 20;           % Spring Constant
mmroma's avatar
mmroma committed
83
    params.b = 1;           % Damping Coefficient
84
    params.NegTension = 0;  % Allow "Negative Tensions"? 0 = No, 1 = Yes
85
    params.r_Pi_P = [0;0;0]; % Tether Mounting Point in Payload Frame
86
    params.MaxTension = 100*params.m*params.g; 
mmroma's avatar
mmroma committed
87
88
89

end