基于成长优化算法GO的复杂城市地形下无人机避障三维航迹规划,可以修改障碍物及起始点(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

  100  900  11

  100  900  10

  50  900   9

  50  900   8

  50  850   8

  50  800   8

  100  750   9

  150  750   8

  200  700   7

  250  650   7

  250  600   6

  250  550   5

  250  550   4

  250  600   3

  250  550   2

  250  550   1

  250  500   1

  250  450   2

  250  400   3

  300  350   3

  350  300   4

  350  250   5

  400  200   4

  450  150   3

  500  100   2

  550  100   2

  550  50   1

  600  50   1

  650  50   2

  700  50   2

  750  50   1

  800  50   1

  850  50   1

  850  50   2

  900  50   2

  950  50   1


路径长度:1741.575585

三、完整MATLAB代码


创作时间: