“在代码的海洋里,有无尽的知识等待你去发现。我就是那艘领航的船,带你乘风破浪,驶向代码的彼岸。
💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
💥1 概述
在现代自动化和机器人技术中,多机器人系统的协同工作成为研究热点。为了使这些机器人高效且安全地执行任务,路径规划变得至关重要。A*(A-Star)算法因其在寻找最优路径方面的效率而广受欢迎。然而,在多机器人场景下,简单的A算法无法直接解决机器人之间的碰撞问题。因此,需要一种扩展的A算法来处理多机器人路径规划。A算法是一种启发式搜索算法,它结合了图的最短路径算法Dijkstra和启发式搜索,能够在有向图中找到两个节点之间的最短路径。A算法使用一个评估函数f(n) = g(n) + h(n),其中g(n)是从起始节点到当前节点n的实际代价,h(n)是启发式估计从n到目标节点的代价。
📚2 运行结果
主函数部分代码:
clear all
clc
close all
% this demo is based on nxn grid graph as the paper shows
% robots are on the grid and they can move just 4 basic direction.
% this demo runs just for any number of robot.
ngrid=3;
nrobot=9;
% create bidirectional grid as the same example in the paper in fig1
[Graph Loc Edge]=GridGraph(ngrid);
% plot the created grid-graph
figure; plot(Loc(:,1),Loc(:,2),'bo');
axis([0 ngrid+1 0 ngrid+1]);
hold on;
for i=1:2:size(Edge,1)
x1=Loc(Edge(i,1),1);
x2=Loc(Edge(i,2),1);
y1=Loc(Edge(i,1),2);
y2=Loc(Edge(i,2),2);
line([x1;x2],[y1;y2]);
end
% set the maximum time step
ts=7;
% r1 is 3nd cell, r2 is 5th cell and r3 is 6th cell ,..., r9 is in 1st cell
sp=[3 5 6 2 9 7 8 4 1];
% r1 1st cell, r2 2nd cell and r3 3th cell, r9 is 9th cell as end positions
ep=[1 2 3 4 5 6 7 8 9] + ngrid*ngrid*(ts-1);
% create time based graph which has ts times more node in figure 5 in paper
[tG,tedge,tloc]= createtimegraph(Graph,Edge,Loc,ts);
% solve the problem with a*, it is not the same with paper since they used
% ILP solver.
[route] = astar3(tG,tloc,sp,ep,ts);
% show the reults on the screen
i=1;
frm=0;
h=figure; hold on;
for j=1:nrobot
pl(j,:)=[tloc(route(i,j),2) ngrid+1-tloc(route(i,j),1)];
end
axis([0 ngrid+1 0 ngrid+1]);
axis off;
set(gcf,'color','w');
for i=1:2:size(Edge,1)
x1=Loc(Edge(i,1),1);
x2=Loc(Edge(i,2),1);
y1=Loc(Edge(i,1),2);
y2=Loc(Edge(i,2),2);
line([x1;x2],[y1;y2]);
end
hold off;
🎉3 参考文献
文章中一些内容引自网络,会注明出处或引用为参考文献,难免有未尽之处,如有不妥,请随时联系删除。
[1]王亦晨,刘雪梅.基于冲突搜索增强深度强化学习的多AGV路径规划方法[J/OL].机电工程技术:1-7[2024-07-16].http://kns.cnki.net/kcms/detail/44.1522.TH.20240715.1114.002.html.
[2]徐雯清,顾大德,刘有志,等.基于自适应金豺狼优化算法的巡检机器人路径规划[J/OL].核电子学与探测技术:1-7[2024-07-16].https://doi.org/10.20173/j.cnki.ned.20240714.002.