⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 param_gutted.m

📁 A Quadrotor simulation that is performed in MATLAB and SIMULINK
💻 M
字号:
%% param.m
%%
%% Parameter file for quadrotor in the contraption, constrainted
%%  to roll only.
%%
%% Modified:
%%    10/8/07 - RWB
%%     2/7/08 - RB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all

% sample rate of controller
  C.samples_per_second = 30;
  C.Ts = 1/C.samples_per_second;

% frame rate for camera (make it a multiple of sample rate)
  C.frames_per_second = C.samples_per_second/1;
  C.Tcam = 1/C.frames_per_second;
  % number of control samples camera is delayed
  C.cam_delay = round(C.samples_per_second/C.frames_per_second); 


C.h = 1;  % height of quadrotor rails above ground (m)

% initial state
C.x0 = [...
        0.1;...        % pn:    north position (m)
        0.1;...        % pe:    east position (m)
        -C.h;...        % pd:    position down (negative of altitude) (m)
        0;...          % u:     velocity along body x-axis (m/s)
        0;...          % v:     velocity along body y-axis (m/s)
        0;...          % w:     velocity along body z-axis (m/s)
        0*pi/180;...   % phi:   roll angle
        0*pi/180;...   % theta: pitch angle
        0*pi/180;...   % psi:   yaw angle
        0;...          % p:     roll rate
        0;...          % q:     pitch rate
        0;...          % r:     yaw rate
    ];


% mass and inertia
  % inertia in kg-m^2
  C.Jx = 0.114700;
  C.Jy = 0.057600;
  C.Jz = 0.171200;
  % gravity (m/s^2)
  C.g = 9.806650;
  % mass (kg) 
  C.m = 1.56;
  
% airframe physical parameters
  C.l    = 0.3;       % wingspan (m)
  C.rho  = 1.268200;  % air density
  
% propeller characteristics  
  C.kmotor_lift = 5.45;  % F = 5.45*delta, where delta\in[0,1]
  C.kmotor_drag = 0.0549; % 
  
% bias parameters for sensors
  C.gyro_x_bias  = .025;
  C.gyro_y_bias  = .025;
  C.gyro_z_bias  = .025;
  C.accel_x_bias = .025;
  C.accel_y_bias = .025;
  C.accel_z_bias = .025;
  
% noise parameters for sensors
  C.sigma_gyro_x = 0.005;   % rad/sec
  C.sigma_gyro_y = 0.005;   % rad/sec
  C.sigma_gyro_z = 0.005;   % rad/sec
  C.sigma_accel_x = 0.005;  % m/sec
  C.sigma_accel_y = 0.005;  % m/sec
  C.sigma_accel_z = 0.005;  % m/sec
  C.sigma_altimeter = 0.02;  % m, ultrasonic ultimeter  

  
  
  
  
% dirty derivative parameter
  C.tau = 1/5;


% autopilot gains
  % roll attitude hold
  C.roll_kp      = 5;%1 %****
  C.roll_ki      = .02;%.01 %****
  C.roll_kd      = .5;%.5 %****

  % y-position hold
  C.y_kp      = 0.9;%0.9;%0.5;%.495 %****9.659
  C.y_ki      = 0.0;%-.01;%-.002; %0%****
  C.y_kd      = 1.4;%0.9;%.916 %****

  % pitch attitude hold
  C.pitch_kp      = C.roll_kp;
  C.pitch_ki      = C.roll_ki;
  C.pitch_kd      = C.roll_kd;

  % x-position hold
  C.x_kp      = 0.9;%C.y_kp;%0.5;
  C.x_ki      = 0.0;%C.y_ki;%0;%.1;
  C.x_kd      = 1.4;%C.y_kd;%0.5;
  
  % altitude hold
%   C.h_kp      = .01;
%   C.h_ki      = 0;
%   C.h_kd      = 0.1;

   C.h_kp      = -1.0;
   C.h_ki      = 0;
   C.h_kd      = -4.0;
  
  % yaw attitude hold
  C.yaw_kp      = 5;%.85 %****10.09
  C.yaw_ki      = 0;%.675 %****
  C.yaw_kd      = .5;%.85 %****
  
  
% camera parameters
  C.cam_pix = 480;         % size of (square) pixel array
  C.cam_fov   = 60*(pi/180); % field of view of camera
  C.f = (C.cam_pix/2)/tan(C.cam_fov/2); % focal range
  C.eps_s_d = 36;  % desired pixel size in image

% target parameters
  C.target_size = 0.1;  % initial location of target
  % initial conditions of the target
  C.target0 = [...
    0;...  % initial North position
    0;...  % initial East position
    0;...  % initial Down position
    0;...  % initial forward speed
    0;...  % initial heading
    ];
  % waypoints for target to follow
  C.target_waypoints = [...
    0, 0;...
    3, -1;...
    4, 0;...
    4, 3;...
    1, 5;...
    -1,3;...
    ];
  % commanded speed of target 
  C.target_speed = .2;
  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -