✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
四旋翼飞行器具有机械设计简单,坚固耐用,体积小成本低,易于携带传感器,相机等优点.特有的悬停能力和垂直起降的特点使其在军用领域和民用邻域的使用愈加普遍化.在四旋翼飞行器路径规划过程中,由于三维环境的复杂程度比二维环境高,且目前大多数路径规划算法都基于二维平面,因此在三维环境下进行路径规划会导致难度陡增.由于四旋翼飞行器是一个高度非线性的多变量系统,其具有六个自由度和四个执行器,是一个欠驱动非线性系统.造成了四旋翼飞行器控制系统的轨迹跟踪能力和稳定性较差.根据存在的问题,本文对四旋翼的路径规划与控制展开以下研究.本文基于多元宇宙算法实现多无人机避障航迹规划。
⛄ 部分代码
function [ paths,CurrentNode,NVNodes ] = getPath(CollisionTest, StartNode,GoalNode,AllPoints,nodes,Boundaryinitial,Boundaryfinal,s1,s2,s3,visited_nodes )
%GETPATH Summary of this function goes here
% Detailed explanation goes here
MaxNoofNodes = size(AllPoints,1);
NodesEvaluated = zeros(MaxNoofNodes,1);
% if size(visited_nodes,1) > 1
% NodesEvaluated(visited_nodes) = 1;
% end
NodesEvaluated(StartNode) = 1;
CurrentNode = StartNode;
paths = StartNode;
curNodeIndex = 1;
NVNodes = 0;
prevNode = GoalNode;
while le(NVNodes,nodes) && ~isequal(CurrentNode,GoalNode)
hor = AllPoints(CurrentNode,1)>AllPoints(GoalNode,1);
ver = AllPoints(CurrentNode,2)>AllPoints(GoalNode,2);
plan = AllPoints(CurrentNode,3)>AllPoints(GoalNode,3);
if(isequal(AllPoints(CurrentNode,1),AllPoints(GoalNode,1)))
hor = 2;
end
if(isequal(AllPoints(CurrentNode,2),AllPoints(GoalNode,2)))
ver = 2;
end
if(isequal(AllPoints(CurrentNode,3),AllPoints(GoalNode,3)))
plan = 2;
end
directions = [ver;hor;plan];
[CurrentNeighbours,ViableNeighbours] = Neighbours(CurrentNode,s1,s2,s3, Boundaryinitial, Boundaryfinal,AllPoints,directions);
CurrentNeighbours = CurrentNeighbours(~CollisionTest(CurrentNeighbours));
ViableNeighbours = ViableNeighbours(~CollisionTest(ViableNeighbours));
CurrentNeighboursABS = CurrentNeighbours(NodesEvaluated(CurrentNeighbours) == 0 );
ViableNeighbours = ViableNeighbours(ViableNeighbours ~= prevNode);
ViableNeighboursABS = ViableNeighbours(NodesEvaluated(ViableNeighbours) == 0);
flag = 0;
if ~isempty(ViableNeighboursABS)
pos = ceil(rand*size(ViableNeighboursABS,1));
pos = ViableNeighboursABS(pos);
elseif isempty(ViableNeighboursABS) && ~isempty(CurrentNeighboursABS)
pos = ceil(rand*size(CurrentNeighboursABS,1));
pos = CurrentNeighboursABS(pos);
flag = 1;
elseif isempty(CurrentNeighboursABS) && ~isempty(ViableNeighbours)
pos = ceil(rand*size(ViableNeighbours,1));
pos = ViableNeighbours(pos);
elseif isempty(ViableNeighbours)
pos = ceil(rand*size(CurrentNeighbours,1));
pos = CurrentNeighbours(pos);
flag = 1;
else
break;
end
if flag == 1
NVNodes = NVNodes + 1;
%fprintf('%d %d %d\n',AllPoints(pos,:));
end
paths = [paths;pos];
NodesEvaluated(pos) = 1;
prevNode = CurrentNode;
CurrentNode = pos;
curNodeIndex = curNodeIndex + 1;
%fprintf('%d %d %d\n',curNodeIndex,nodes,~isequal(CurrentNode,GoalNode));
end
end
⛄ 运行结果
⛄ 参考文献
[1] 史志远. 无人机三维路径规划与控制算法研究.
[2] 陈洋, 张道辉, 赵新刚,等. 基于自主学习框架的无人机三维路径规划[C]// 中国自动化大会暨钱学森诞辰一百周年及中国自动化学会五十周年会庆. 中国自动化学会, 2011.
[3] 凌兴雨. 无人机三维航迹规划算法研究[D]. 大连理工大学, 2016.
[4] 陈冬, 周德云, 冯琦. 基于粒子群优化算法的无人机航迹规划[J]. 弹箭与制导学报, 2007, 027(004):340-342.