【无人机】基于遗传算法实现无人机编队位置规划附matlab代码

 1 内容介绍

现代社会的无人机成本造价低、不易损耗、轻巧灵便、易躲藏、能精确打击

目标这些特点,使其在一些高危任务中发挥了不可替代的作用[5]。无人机的用处主要有两种:民用和军事。在民用方面,我们可以运用无人机对一些可能出现隐患的事物进行监控,比如对震后灾区的地面勘探、森林火灾的检测、风暴中心的气象数据等。在 2014 索契奥运会上,无人机携带的摄像拍摄的画面更贴近运动员,画质更为清晰,2018 中国新年春晚上大量无人机组成的海豚造型惊艳了世界。在军事方面,我们可以运用无人机进行一些特殊任务的执行,比如对毒贩的监视工作,边境的巡防工作,无人机侦查、搜救、预警等。无人机的运用使我们在一些事情上实现了无人员伤亡。军事无人机是当今时代无人机技术的高水准体现。伴随着日益成熟的无人机技术,对航路规划的研究也愈加深入。航路规划的前提是在一定的约束条件下,然后寻求可飞行航路。对于无人机而言它自身的主要约束条件有:最大的载重量、可以上升的门限高度、空载时耗油量、起飞时承载的重量等,在飞行时要考虑地形存在的威胁和是否存在禁飞区等。相对国外研究,我国还没有比较成熟的航路规划体系,但是对航路规划的研究热情我国日益加强.飞行过程中有时会遇到一些突发事故,无人机在此时不能按照预先规划的航迹继续进行,需要无人机能够在当前的环境下动态的规划出一条满足要求的航路,也说明了航路规划的静态和实时动态规划相结合的算法是我们未来的一个研究趋势。

随着现代社会的不断发展,电子信息技术研究不断深入,无人机航路规划越

来越智能化。现代社会由于飞机的特殊性,其安全性一直是我们最为关心的话题,因为一旦发生一点点事故,往往伴随着生命的代价,所以在面对一些内部环境比较复杂的地方时,可以使用一些有着特殊功能的无人机,它们在无人的状态下可以将性能调整到最优,在执行任务的过程中不用担心其产生人员伤亡,而且无人机的活动区域比较广泛,不限单次使用,能够执行多种任务。现代战场上无人机的威力发挥很大程度上取决于航路规划的合理性。根据模型,航路规划通常会产生很多条满足条件的航路,而我们要做的就是快速、准确找到这些满足要求航路中的最优一条。随着无人机的硬件和软件技术的不断成熟,无人机航路规划技术也必将得到更好的发展和更广泛的应用.​

2 仿真代码

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% E150 Genetic Algorithm Evolution Visualizer
% Avery Rock, UC Berkeley Mechanical Engineering, avery_rock@berkeley.edu
% Written for E150, Fall 2019.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function familyTree(Orig, parents, pop)
%%

% Inputs: 
%   Orig -- the indices of a sorted GA generation from before sorting (see sort() documentation), 
%   parents -- the number of parents, required for interpreting source
%   pop --  the number of performers to plot. Use pop >= parents. 

% Returns: 
% no variables, plots a representation of the evolution history to the current figure. 

% The function automatically ignores generations where no rank changes
% occur among the parents OR there are any repeated indices (indicating
% incorrect data). 

% Data visualization: This function can be used to visualize and interpret the performance of
% your GA iteration process. Gray lines represent "survival" with or
% without a rank change. Red lines represent breeding (e.g.,  a new string
% will be connected to its parents with red lines). New random strings have
% no connections. A surviving string will be represented with gray, a new
% string generated randomly will be a blue mark and a new string generated
% by breeding will be red.

% Performance interpretation: If your GA is working correctly, there should
% be lots of turnover (i.e., few generations where nothing happens),
% significant numbers of successful offspring and a moderate number of
% successful random strings. You can also spot stagnation (a parent
% surviving for many generations and continually producing offspring that
% stay in the top ranks). 

%%

Orig2 = Orig(:, 1:pop); % trim source to just relevant entries.
row = 0; changes = []; % initialize variables for determining relevant generations
children = parents; % assume nearest-neighbor with two children
rando = zeros(0, 2); inc = zeros(0, 2); kid = zeros(0, 2); % intialize empty storage arrays
G = size(Orig, 1); % total number of generations.
pts = 25; % number of points to plot in connections
c1 = [.6 .6 .6]; c2 = [1 .6 .6]; % line colors for surviving connections and children
lw = 1.5; % connection line weight
mw = 1.5; % marker line weight

incx = zeros(pts, 2); incy = zeros(pts, 2); % empty arrays for connecting line coordinates.
kidx = zeros(pts, 2); kidy = zeros(pts, 2);

for g = 1:G % for every generation
    if ~isequal(Orig2(g, 1:parents), 1:parents) && length(unique(Orig2(g, :))) == pop % if a change in survivors and valid data
        row = row + 1; % row on which to plot current state - counts relevant generations
        x1 = row - 1; x2 = row; % start and end points of connections
        changes = [changes; g]; % record that a change occured in this generation
        for i = 1:pop
            s = Orig2(g, i); y2 = i;
            if s == i && i <= parents && g > 1 % if the entry is a surviving parent who has not moved
                y1 = i;
                [xx, yy] = mySpline([x1 x2], [y1 y2], pts);
                incx = [incx, xx]; incy = [incy, yy];
                inc = [inc; [x2, y2]];
            elseif  s <= parents && g > 1% if the entry is a surviving parent who has been moved down
                y1 = s;
                [xx, yy] = mySpline([x1 x2], [y1 y2], pts);
                incx = [incx, xx]; incy = [incy, yy];
                inc = [inc; [x2, y2]];
            elseif s <= parents + children && g > 1 % if the entry is a child
                for n = 2:2:children
                    if s <= parents + n
                        y11 = n - 1; y12 = n;
                        [xx1, yy1] = mySpline([x1, x2], [y11, y2], pts);
                        [xx2, yy2] = mySpline([x1, x2], [y12, y2], pts);
                        kidx = [kidx, xx1, xx2]; kidy = [kidy, yy1, yy2];
                        kid = [kid; [x2, y2]];
                        break
                    end
                end
            else % if it's a new random addition.
                rando = [rando; [x2, y2]];
            end
        end
    end
end

p1 = plot(incx, incy, '-', 'Color', c1, 'LineWidth', 1.5); hold on
p2 = plot(kidx, kidy, '-', 'Color', c2, 'LineWidth', 1.5); hold on
p3 = plot(rando(:, 1), rando(:, 2), 's', 'MarkerEdgeColor', [.2 .4 .9], 'MarkerFaceColor', [.6 .6 1], 'MarkerSize', 10, 'LineWidth', mw); hold on % plot random
p4 = plot(inc(:, 1), inc(:, 2), 's', 'MarkerEdgeColor', [.3 .3 .3], 'MarkerFaceColor', [.6 .6 .6], 'MarkerSize', 10, 'LineWidth', mw); hold on % plot survival
p5 = plot(kid(:, 1), kid(:, 2), 's', 'MarkerEdgeColor', [.9 .3 .3], 'MarkerFaceColor', [1 .6 .6], 'MarkerSize', 10, 'LineWidth', mw); % plot children
h = [p3, p4, p5];
legend(h, "Random", "Incumbent", "Child")

xlabels = {};
for i = 1:numel(changes)
    xlabels{i} = num2str(changes(i));
end

ylabels = {};
for j = 1:pop
    ylabels{j} = num2str(j);
end

title("Family Tree");
set(gca, 'xtick', [1:row]); set(gca,'ytick', [1:pop]);
set(gca,'xticklabel', xlabels); set(gca,'yticklabel', ylabels);
xlabel("generation"); ylabel("Rank");
axis([0 row + 1 0 pop + 1]); view([90, 90])
end

function [xx, yy] = mySpline(x, y, pts)
% produces clamped splines between two points 

% Inputs: 
%   x -- 2-value vector containing the x coordinates of the end points
%   y -- 2-value vector containing the y coordinates of the end points
%   pts -- the number of total points to plot (ends plus intermediates)

% Returns: 
%    xx -- array of x coordinates to plot
%    yy -- array of y coordinates to plot

cs = spline(x, [0 y 0]);
xx = linspace(x(1), x(2), pts)';
yy = ppval(cs,xx);
end

UAV swarms have numerous applications in our modern world. They can facilitate mapping, observing, and overseeing large areas with ease. It is necessary for these agents to autonomously navigate potentially dangerous terrain and airspace in order to log information about areas. In this project, we simulate the motion of a swarm of drones, and their interaction with obstacles, and targets.

The goal of this project is to optimize this simulation using a Genetic Algorithm to maximize the number of targets mapped, minimize the number of crashed drones, and minimize the amount of time used in the simulation. To do this, we will use 15 design parameters to determine the dynamics and kinematics of each drone, using Forward Euler time discretization to update drone positions.

A Genetic Algorithm will be used to train this swarm of drones by generating random strings of design parameters, and breeding new strings to find the optimal string for this simulation.

In this paper, I will present relevant background information, and equations to describe the simulation. I will also describe the process by which I go about optimizing the Genetic Algorithm. Finally, I present the outcome of the simulation and Genetic Algorithm, and discuss the relevance of my results.

3 运行结果

4 参考文献

[1]杨军, 王道波, 渠尊尊,等. 基于元胞遗传算法的多无人机编队集结路径规划[J]. 机械与电子, 2018, 36(1):5.

[2]黄书召, 田军委, 乔路,等. 基于改进遗传算法的无人机路径规划[J].  2021.

[3]邵壮. 多无人机编队路径规划与队形控制技术研究[D]. 西北工业大学.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

  • 1
    点赞
  • 62
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: 无人机编队路径规划是一项重要的研究,它是指对多架无人机进行路径规划并协调它们进行飞行任务的过程。MATLAB作为一种强大的数学软件,具有丰富的函数库和工具箱,可以帮助研究者进行无人机编队路径规划仿真实验。 在MATLAB中,可以通过调用建模工具箱中的工具来模拟无人机的运动轨迹。对于路径规划的问题,可以使用一些现有的算法,如遗传算法、禁忌搜索、模拟退火等。这些算法可以被编程实现,用于优化路径规划问题。 根据无人机编队飞行的特点,路径规划算法应该考虑以下因素:避障、时间窗口管理、距离限制、速度调整等。基于这些因素,可以开发一些自适应控制策略,帮助解决无人机编队飞行和路径规划的问题。 在MATLAB中进行无人机编队路径规划仿真实验,需要先构建一个适合的模型,然后进行控制算法的测试和验证。通过仿真实验,可以比较不同的路径规划算法的性能和效果,并根据实验数据进行算法的进一步优化。 总之,无人机编队路径规划是一项相当复杂的问题,需要考虑众多因素,而MATLAB作为一种强大的数学软件,可以帮助解决这些问题。通过不断的实验和优化,可以开发出更高效、更可靠的路径规划算法,为无人机编队飞行提供更好的技术支持。 ### 回答2: 无人机编队路径规划是通过将多个无人机组合成一个编队,利用无线通讯和遥控技术实现共同完成多项任务的过程。而MATLAB作为一种功能强大的编程语言工具,可以用来实现无人机编队路径规划。 首先,无人机编队路径规划需要考虑的因素包括起始点、目标点、障碍物及其位置、飞行高度等多个方面。经过对这些因素的分析和综合考虑,可以设计出针对无人机编队路径规划的算法,并应用MATLAB进行实现。 在MATLAB实现无人机编队路径规划,需要首先确定编队中每个无人机的当前位置和目标位置,并计算各个无人机之间的互相影响。然后利用小波变换等数学方法,对路径进行优化和规划,可以最大程度地避免出现碰撞等安全隐患。 在多个无人机之间进行协同操作时,需要考虑到各个无人机之间的通讯和协调问题。可以通过利用MATLAB中的通讯库,建立起无人机群体的网络通讯,实现无人机之间的信息共享和传递,从而提高整个编队的协同能力和任务完成效率。 总之,MATLAB无人机编队路径规划中的应用,可以实现编队多项任务的高效运行和协调,从而极大地提升了无人机的实用价值和应用范围。 ### 回答3: 无人机编队路径规划是指通过一定的算法,使得多个无人机在飞行过程中以特定的编队形式进行协同飞行,完成特定的任务。MATLAB是一款常用的科学计算软件,可以对无人机编队路径规划进行控制与仿真分析。 在无人机编队路径规划中,需要考虑多个因素,例如无人机的动态学以及通讯信息、能源限制等。针对这些因素,可以采用各种算法,如虚拟结构法、基于模型预测控制的路径规划遗传算法等来实现优化。具体而言,可以分为四个主要的步骤: 1、路径规划:确定每架无人机对应的路径及速度; 2、多架无人机间的协同控制:以某种方式进行集群控制; 3、集群决策与任务分配:将任务分配给每个无人机; 4、状态估计与诊断:但无人机性能有所变化时,做出调整。 Matlab可以进行数值仿真,并在仿真结果上分析与优化无人机编队路径规划方案。仿真工具可以用MATLAB提供的Simulink或状态空间模型来建模。MATLAB还可以用户使用API对无人机数据进行分析以及将生成的控制指令发送到真实的无人机上。 总体而言,MATLAB是一种非常有效的工具,可以帮助开发者完成无人机编队路径规划以及仿真任务。更多的Matlab无人机编队路径规划方案可以通过Matlab官网获得。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

matlab科研助手

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值