👨🎓个人主页:研学社的博客
💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
💥1 概述
用于路径规划的快速探索随机树(RRT)算法的工作原理是构建一棵探索机器人配置空间的树,根节点代表初始配置,新节点通过随机抽样和连接到现有树迭代添加。该算法使用距离度量来标识树中离每个新采样点最近的节点,如果它们之间的连接不与障碍物相交,则向树添加新节点和边。随着树的生长,它会探索配置空间的更多区域并接近目标配置。当达到目标或达到定义的迭代次数限制时,算法将终止。
📚2 运行结果
部分代码:
plot(x_start(1,1)-0.5*resolution, x_start(1,2)-0.5*resolution,'b^','MarkerFaceColor','b','MarkerSize',4*resolution); % 璧风偣
plot(goal(1,1)-0.5*resolution, goal(1,2)-0.5*resolution,'m^','MarkerFaceColor','m','MarkerSize',4*resolution); % 缁堢偣
set(gca,'XLim',[x_left_limit x_right_limit]);
set(gca,'XTick',[x_left_limit:resolution:x_right_limit]);
set(gca,'YLim',[y_left_limit y_right_limit]);
set(gca,'YTick',[y_left_limit:resolution:y_right_limit]);
grid on
title('RRT');
xlabel(' x');
ylabel(' y');
pause(0.05);
if (sqrt((new_node_x - goal(1,1))^2 + (new_node_y- goal(1,2))^2) <= goal_radius) %
tree.child(end+1,:) = goal;
tree.parent(end+1,:) = new_node;
disp('find goal!');
break
end
end
toc
temp = tree.parent(end,:);
trajectory = [tree.child(end,1)-0.5*resolution, tree.child(end,2)-0.5*resolution];
for i=size(tree.child,1):-1:2
if(size(tree.child(i,:),2) ~= 0 & tree.child(i,:) == temp)
temp = tree.parent(i-1,:);
trajectory(end+1,:) = tree.child(i,:);
if(temp == x_start)
trajectory(end+1,:) = [temp(1,1) - 0.5*resolution, temp(1,2) - 0.5*resolution];
end
end
end
plot(trajectory(:,1), trajectory(:,2), '-r','LineWidth',2);
pause(2);
k = 4;
P = trajectory';
n = size(P,2) - 1;
flag = 2;
path=[];
if (flag == 1)
NodeVector = linspace(0, 1, n+k+1);
for u = (k-1)/(n+k+1) : 0.001 : (n+2)/(n+k+1)
for i = 0 : 1 : n
Bik(i+1, 1) = BaseFunction(i, k-1 , u, NodeVector);
end
p_u = P * Bik;
path = [path; [p_u(1,1),p_u(2,1)]];
end
else
NodeVector = U_quasi_uniform(n, k-1);
for u = 0 : 0.005 : 1-0.005
for i = 0 : 1 : n
Bik(i+1, 1) = BaseFunction(i, k-1 , u, NodeVector);
end
p_u = P * Bik;
path=[path; [p_u(1),p_u(2)]];
end
end
plot(path(:,1),path(:,2),'-r','LineWidth',2);hold on
🎉3 参考文献
部分理论来源于网络,如有侵权请联系删除。
[1]Lixing Liu (2023) Rapidly-exploring Random Tree (RRT) is a probabilistic algorithm for path planning that constructs a tree to explore the configuration space and samples random points to grow the tree towards unexplored regions.
[2]马新国,马希青.融合改进RRT和Dijkstra算法的机器人动态路径规划[J].组合机床与自动化加工技术,2023(02):5-9.DOI:10.13462/j.cnki.mmtamt.2023.02.002.