为了对小型无人机全过程飞行仿真进行研究,根据无人机飞行控制回路和制导回路,搭建了模块化的系统仿真结构,将Matlab/Simulink和Stateflow有机结合起来,建立了易于维护和扩展的仿真环境.利用仿真环境对无人机的控制规律和制导规律进行了仿真,结果表明了控制规律和制导规律的合理性,以及全过程仿真环境的实用性.
close all;clear;
close all
addpath 'data'
addpath 'uavA1'
% addpath 'uavShow'
% If you want to use other planning 5 trajectories files
% You should change as followws:
% 1. getWpp.m load '5jia.mat'
% 2. para_chap1.m load '5jia.mat'
% Change the name of '5jia.mat'
% And the simulink time also needs to adjusted if too long or long short
%----------------
uavW = 1;
save('uavW.mat','uavW');
sim('New_mavsim_chap12');
ii = 1;
eval(['x' num2str(ii) '= x;'])
eval(['path' num2str(ii) '= path;'])
eval(['waypoints' num2str(ii) '= waypoints;'])
save('x1.mat','x1','path1','waypoints1');
%----------------
clear;
uavW = 2;
uavi = uavW;
save('uavW.mat','uavW');
sim('New_mavsim_chap12');
ii = 2;
eval(['x' num2str(ii) '= x;'])
eval(['path' num2str(ii) '= path;'])
eval(['waypoints' num2str(ii) '= waypoints;'])
save('x2.mat','x2','path2','waypoints2');
%----------------
clear;
uavW = 3;
save('uavW.mat','uavW');
sim('New_mavsim_chap12');
ii = 3;
eval(['x' num2str(ii) '= x;'])
eval(['path' num2str(ii) '= path;'])
eval(['waypoints' num2str(ii) '= waypoints;'])
save('x3.mat','x3','path3','waypoints3');
%----------------
clear;
uavW = 4;
save('uavW.mat','uavW');
sim('New_mavsim_chap12');
ii = 4;
eval(['x' num2str(ii) '= x;'])
eval(['path' num2str(ii) '= path;'])
eval(['waypoints' num2str(ii) '= waypoints;'])
save('x4.mat','x4','path4','waypoints4');
%----------------
clear;
uavW = 5;
save('uavW.mat','uavW');
sim('New_mavsim_chap12');
ii = 5;
eval(['x' num2str(ii) '= x;'])
eval(['path' num2str(ii) '= path;'])
eval(['waypoints' num2str(ii) '= waypoints;'])
save('x5.mat','x5','path5','waypoints5');
% Show part
%----------------
close all;clear;
load 'x1'
load 'x2'
load 'x3'
load 'x4'
load 'x5'
addpath 'uavShow'
sim('mavsim_show');
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删