Java教程

【无人机导航】复杂环境下的无人机编队路径规划matlab源码

本文主要是介绍【无人机导航】复杂环境下的无人机编队路径规划matlab源码,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!


 

 

clear; matlabrc; clc; close all;
addpath(genpath('controllers'))
addpath(genpath('dynamics'))
addpath(genpath('tools'))

% Initial Control gains:
k_ria = 20;  %(inter-agent position)
k_via = .26;  %(inter-agent velocities)
k_rvl = .5; %(virtual-leader position)
k_vvl = .25;  %(virtual-leader velocity)
k_obs = 10;   %(obstacle position)
exp = 4;
gains = [k_ria,k_via,k_rvl,k_vvl,k_obs]';

% Optimize:
options = optimoptions('fmincon','FiniteDifferenceStepSize',1e-1);
% A = [4 0 0 0 30/31.5];
% b = 0;
A =[];
b = [];
Aeq = [];
beq = [];
lb = [0 0 0 0 0];
ub = [];
x = fmincon(@simulate, gains, A,b,Aeq,beq,lb,ub,[], options);

%%
gains = x;
[ts, total_error, broke] = simulate_dev(gains,1);

total_error(total_error == 0) = [];
dt = 1e-1;
num_steps = length(total_error);
tfinal = num_steps*dt;
tspan = dt:dt:tfinal;

%%
figure()
plot(tspan,total_error); hold on
xlabel('Time (sec)')
ylabel('Total Error')
yl = ylim;
plot([broke broke],[yl(1) yl(2)],'--k')

 

 

 

这篇关于【无人机导航】复杂环境下的无人机编队路径规划matlab源码的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!