基于鹈鹕优化算法POA的复杂城市地形下无人机避障三维航迹规划,可以修改障碍物及起始点(Matlab代码)

作品简介

一、部分代码

close all
clear 
clc
rng('default');
%% 载入数据
data.S=[50,950,12];     %起点位置 横坐标与纵坐标需为50的倍数
data.E=[950,50,1]; %终点点位置 横坐标与纵坐标需为50的倍数
data.Obstacle=xlsread('data1.xls');
data.numObstacles=length(data.Obstacle(:,1));
%% 画图
figure
hold on
plot(curve,'r','LineWidth',2)
xlabel('迭代次数')
ylabel('路径长度')
legend(str);
[~,result]=fobj(Best_pos);
drawPc(result,option,data,str)
result.path(:,1)=result.path(:,1).*data.unit(1);
result.path(:,2)=result.path(:,2).*data.unit(2);
result.path(:,3)=result.path(:,3).*data.unit(3);
%% 显示路径信息
fprintf("路径坐标:\n");
display(result.path)
fprintf("路径长度:%f\n",result.fit);

二、部分结果

路径坐标:

  50  950  12

  50  900  12

  50  850  13

  50  800  14

  50  750  13

  100  700  12

  150  650  12

  200  650  13

  200  650  14

  250  650  13

  250  600  12

  250  550  11

  250  500  12

  250  450  11

  300  400  12

  350  400  11

  400  350  11

  400  350  10

  450  350   9

  500  400   8

  500  400   7

  500  350   7

  550  300   6

  600  300   6

  650  300   6

  700  250   5

  750  200   4

  800  150   4

  850  150   4

  850  100   3

  900  50   2

  950  50   1


路径长度:1610.286263

三、完整MATLAB代码


创作时间: