资源简介
用MATLAB实现路径规划,采用A*算法,三维路径规划也可以。
![](http://www.nz998.com/pic/34358.jpg)
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A* ALGORITHM Demo
% Interactive A* search demo
% 04-26-2005
% Copyright 2009-2010 The MathWorks Inc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%DEFINE THE 2-D MAP ARRAY
MAX_X=10;
MAX_Y=10;
MAX_VAL=10;
%This array stores the coordinates of the map and the
%objects in each coordinate
MAP=2*(ones(MAX_XMAX_Y));
% Obtain Obstacle Target and Robot Position
% Initialize the MAP with input values
% Obstacle=-1Target = 0Robot=1Space=2
j=0;
x_val = 1;
y_val = 1;
axis([1 MAX_X+1 1 MAX_Y+1])
grid on;
hold on;
n=0;%Number of Obstacles
% BEGIN Interactive Obstacle Target Start Location selection
pause(1);
h=msgbox(‘Please Select the Target using the Left Mouse button‘);
uiwait(h5);
if ishandle(h) == 1
delete(h);
end
xlabel(‘Please Select the Target using the Left Mouse button‘‘Color‘‘black‘);
but=0;
while (but ~= 1) %Repeat until the Left button is not clicked
[xvalyvalbut]=ginput(1);
end
xval=floor(xval);
yval=floor(yval);
xTarget=xval;%X Coordinate of the Target
yTarget=yval;%Y Coordinate of the Target
MAP(xvalyval)=0;%Initialize MAP with location of the target
plot(xval+.5yval+.5‘gd‘);
text(xval+1yval+.5‘Target‘)
pause(2);
h=msgbox(‘Select Obstacles using the Left Mouse buttonto select the last obstacle use the Right button‘);
xlabel(‘Select Obstacles using the Left Mouse buttonto select the last obstacle use the Right button‘‘Color‘‘blue‘);
uiwait(h10);
if ishandle(h) == 1
delete(h);
end
while but == 1
[xvalyvalbut] = ginput(1);
xval=floor(xval);
yval=floor(yval);
MAP(xvalyval)=-1;%Put on the closed list as well
plot(xval+.5yval+.5‘ro‘);
end%End of While loop
pause(1);
h=msgbox(‘Please Select the Vehicle initial position using the Left Mouse button‘);
uiwait(h5);
if ishandle(h) == 1
delete(h);
end
xlabel(‘Please Select the Vehicle initial position ‘‘Color‘‘black‘);
but=0;
while (but ~= 1) %Repeat until the Left button is not clicked
[xvalyvalbut]=ginput(1);
xval=floor(xval);
yval=floor(yval);
end
xStart=xval;%Starting Position
yStart=yval;%Starting Position
MAP(xvalyval)=1;
plot(xval+.5yval+.5‘bo‘);
%End of obstacle-Target pickup
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%LISTS USED FOR ALGORITHM
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%OPEN LIST STRUCTURE
%--------------------------------------------------------------------------
%IS ON LIST 1/0 |X val |Y val |Parent X val |Parent Y val |h(n) |g(n)|f(n)|
%--------------------------------------------------------------------------
OPEN=[];
%CLOSED LIST STRUCTURE
%--------------
%X val | Y val |
%--------------
% CLOSED=zeros(MAX_VAL2);
CLOSED=[];
%Put all obstacles on the Closed list
k=1;%Dummy counter
for i=1:MAX_X
for j=1:MAX_Y
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 80240 2005-05-09 09:52 Astar\Astar_tutorial.pdf
文件 7397 2010-07-03 09:46 Astar\A_Star1.asv
文件 7396 2010-07-02 20:36 Astar\A_Star1.m
文件 201 2010-01-05 14:23 Astar\distance.m
文件 1824 2010-01-05 14:23 Astar\expand_array.m
文件 596 2010-01-05 14:24 Astar\insert_open.m
文件 1060 2010-01-05 14:24 Astar\min_fn.m
文件 297 2010-01-05 14:24 Astar\node_index.m
文件 1071 2010-01-02 09:50 Astar\ReadMe.txt
文件 44385 2010-01-02 09:56 Astar\screenShot.jpg
目录 0 2010-07-03 09:31 Astar
----------- --------- ---------- ----- ----
144467 11
- 上一篇:Matlab图像识别
- 下一篇:matlab材料力学剪力图弯矩图绘制程序
相关资源
- 清洁机器人路径规划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实现
- path-planning 路径规划d*算法
评论
共有 条评论