资源简介
用MATLAB实现路径规划,采用A*算法,三维路径规划也可以。
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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材料力学剪力图弯矩图绘制程序
相关资源
- RRT、RRT-Connect、LazyRRT、RRTextend、RRT*的
- 蚁群算法进行二维路径规划.zip
- 粒子群算法应用在路径规划matlab
- 蚁群算法路径规划避障MATLAB源程序
- 蚁群算法无人机路径规划
- A星算法的路径规划MATLAB实现
- 蚁群算法算法的路径规划MATLAB实现
- path-planning 路径规划d*算法
- path-planning 路径规划RRT算法
- 新的A星路径规划matlab文件合集.zip
- matlab Q-learning 无障碍路径规划仿真
- Floyd弗洛伊德算法matlab仿真代码。
- 路径规划蚁群算法
- 细化算法GUI实现 机器人路径规划
- 基于遗传算法的机器人路径规划MATL
- 基于粒子群算法机器人路径规划matl
- RRT路径规划matlab源代码
- 移动机器人路径规划 几种A*算法改进
- 路径规划算法matlab仿真
- 基于A*算法的机器人路径规划的MATLA
- 基于蚁群算法的移动机器人三维路径
- RRT* RRT star RRT 星路径规划算法的matl
- 蚁群算法实现机器人避障和路径规划
- 清扫机器人路径规划算法仿真
- 基于改进遗传算法的路径规划MATLAB实
- 人工势场法路径规划192071
- 基于蚁群算法和Dijkstra算法的二维路径
- 蚁群算法求解最短路,详细,可用于
- 基于matlab的双向A*算法
- 人工势场法matlab源码
评论
共有 条评论