⛄一、获取代码方式

获取代码方式1: 完整代码已上传我的资源:【路径规划】基于matlab A_star算法机器人避障最短路径规划【含Matlab源码 2522期】 点击上面蓝色字体,直接付费下载,即可。

获取代码方式2: 付费专栏Matlab路径规划(初级版)

备注: 点击上面蓝色字体付费专栏Matlab路径规划(初级版),扫描上面二维码,付费29.9元订阅海神之光博客付费专栏Matlab路径规划(初级版),凭支付凭证,私信博主,可免费获得1份本博客上传CSDN资源代码(有效期为订阅日起,三天内有效); 点击CSDN资源下载链接:1份本博客上传CSDN资源代码

⛄二、部分源代码

function My_RRT clc clear close all %% color map load maze.mat map [map_height,map_width]=size(map); %行是高y,列是宽x q_start = [206, 198]; %q s t a r t ( 1 ) : x宽 , q s t a r t ( 2 ) : y高 q_goal = [416, 612]; colormap=[1 1 1 0 0 0 1 0 0 0 1 0 0 0 1]; imshow(uint8(map),colormap) hold on %% rrt tree %行是y坐标,列是x坐标 %initial vertices=q_start; edges = []; K=10000; delta_q=50; p=0.3; q_rand=[]; q_near=[]; q_new=[]; %main loop plot(q_start(2),q_start(1),‘*b’) plot(q_goal(2),q_goal(1),‘*y’) for k = 1:K arrived=is_goal_arrived(vertices,q_goal,delta_q); if arrived vertices=[vertices;q_goal]; edges = [edges;[size(vertices,1),size(vertices,1)-1]]; break; end if rand <= p q_rand = q_goal;%q(1)宽x,q(2)高y else q_rand = [randi(map_height),randi(map_width)]; end if map( q_rand(1,1),q_rand(1,2) ) == 1 %map(1)height,map(2)width continue; end

⛄三、运行结果

⛄四、matlab版本及参考文献

1 matlab版本 2014a

2 参考文献 [1]李克玉,陆永耕,鲍世通,徐培真.基于改进RRT算法的无人机三维避障规划[J].计算机仿真. 2021,38(08)

3 备注 简介此部分摘自互联网,仅供参考,若侵权,联系删除

推荐阅读

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: