资源简介
RRT 快速扩展随机树 路径规划,无需更改即可使用
代码片段和文件信息
%% pathRRT
%% - create a path from a start node to an end node
%% using the RRT algorithm.
%% - RRT = Rapidly-exploring Random Tree
%%
%% 赵燕江修改版
function pathRRT
% create random world
Size = 100;
NumObstacles = 100;
world = createWorld(NumObstacles[Size; Size][0;0]);
% standard length of path segments
segmentLength = 5;
% randomly select start and end nodes
start_node =[0 0 0 0 0 ];
end_node = [100 100 0 0 0];
% establish tree starting with the start node
tree = start_node;
% check to see if start_node connects directly to end_node
if ( (norm(start_node(1:2)-end_node(1:2)) &&(collision(start_nodeend_nodeworld)==0) )
path = [start_node; end_node];
else
numPaths = 0;
while numPaths<1
[treeflag] = extendTree(treeend_nodesegmentLengthworld);
numPaths = numPaths + flag;
end
end
% find path with minimum cost to end_node
path = findMinimumPath(treeend_node);
plotWorld(worldpathtree);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% createWorld
%% - create random world with obstacles
%% the first element is the north coordinate
%% the second element is the south coordinate
function world = createWorld(NumObstacles NEcorner SWcorner)
% check to make sure that the region is nonempty
% create world data structure
world.NumObstacles = NumObstacles;
world.NEcorner = NEcorner;
world.SWcorner = SWcorner;
% create NumObstacles
maxRadius = min(NEcorner(1)- SWcorner(1) NEcorner(2)-SWcorner(2));
maxRadius = 5*maxRadius/NumObstacles/2;
for i=1:NumObstacles
% randomly pick radius
world.radius(i) = maxRadius*rand;
% randomly pick center of obstacles
cn = SWcorner(1) + world.radius(i)...
+ (NEcorner(1)-SWcorner(1)-2*world.radius(i))*rand;
ce = SWcorner(2) + world.radius(i)...
+ (NEcorner(2)-SWcorner(2)-2*world.radius(i))*rand;
world.cn(i) = cn;
world.ce(i) = ce;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% generateRandomNode
%% create a random node (initialize)
function node=generateRandomNode(world)
% randomly pick configuration
pn = (world.NEcorner(1)-world.SWcorner(1))*rand;
pe = (world.NEcorner(2)-world.SWcorner(2))*rand;
chi = 0;
cost = 0;
node = [pn pe chi cost 0];
% check collision with obstacle
while collision(node node world)
pn = (world.NEcorner(1)-world.SWcorner(1))*rand;
pe = (world.NEcorner(2)-world.SWcorner(2))*rand;
chi = 0;
cost = 0;
node = [pn pe chi cost 0];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% collision
%% check to see if a node is in collsion with obstacles
function collision_flag = collision(node parent world);
collision_fla
相关资源
- 清洁机器人路径规划matlab仿真程序
- 基于遗传算法的机器人路径规划matl
- 单机器人的多任务路径规划GUI
- 针对栅格路径规划的蚁群算法MATLAB
- 蚁群算法实现三维路径规划Matlab源码
- 路径规划算法MATLAB仿真合集
- 三种不同路径规划的仿真
- 基于栅格地图的蚁群算法路径规划
- 基于智能优化的机器人路径规划matl
- 自主移动机器人路径规划新方法含m
- 多机器人路径规划-matlab
- 多机器人路径及避障规划——Matlab
- 路径规划MATLAB版代码
- 基于matlab的机器人最优路径规划仿真
- 基于栅格地图的A-星算法路径规划
- 基于栅格地图的A星算法路径规划
- A*路径规划算法
- 多种蚁群算法在机器人路径规划中的
- 基于A-Star算法的机器人路径规划.rar
- 路径规划算法Matlab仿真更新
- 路径规划随机地图建立MATLAB源码
- 用A*算法路径规划, matlab程序
- RRT、RRT-Connect、LazyRRT、RRTextend、RRT*的
- 蚁群算法进行二维路径规划.zip
- 粒子群算法应用在路径规划matlab
- 蚁群算法路径规划避障MATLAB源程序
- 蚁群算法无人机路径规划
- A星算法的路径规划MATLAB实现
- 蚁群算法算法的路径规划MATLAB实现
- mclmcrrt710.dll
评论
共有 条评论