一、简介

路径规划是实现移动机器人自主导航的关键技术,是指在有障碍物的环境中,按照一定的评价标准(如距离、时间、能耗等),寻找到一条从起始点到目标点的无碰撞路径,这里选取最短距离路径规划的评价标准,即最短路径规划问题。

1.路径规划数学模型的建立
将移动机器人周围环境用一组数据进行抽象表达,建立二维或三维的环境模型,得到移动机器人能够理解分析的环境数据,是机器人路径规划的基本前提。我这里用的是栅格法,其原理是将周围环境看成一个二维平面,将平面分成一个个等面积大小的具有二值信息的栅格,每个栅格中存储着周围环境信息量,下图我给出了一个栅格法地图,方便大家更好的理解栅格地图。这里设计的栅格地图为一个20×20的地形矩阵,黑色的地方表示有障碍,白色的地方表示没有障碍。

图1 栅格法地图
在用栅格法建立环境模型时,为了将环境信息转换成移动机器人可以识别的数据,一般采用序号法标记环境地图信息,即将栅格地图中一个个栅格从序号1依次累加直到标记到最后一个栅格。如图2所示。


图3 八叉树搜索策略
那么,怎么判断一个栅格点是否为另一个栅格点的相邻栅格点呢,另外,又怎么判断是否为有障碍栅格呢。这就需建立矩阵D,记录每个栅格点至其相邻栅格点的代价值。本例中栅格地图有20×20个栅格点,则D的大小为400×400,其中列是起点栅格,行是局部终点栅格,各栅格点至其各相邻无障碍栅格点的代价值非零,而有障碍栅格及非相邻栅格设为0。
这里需要说明的是,我的MATLAB程序来自于:
版权声明:本文为CSDN博主「qq_40443076」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_40443076/article/details/88179836
这里主要介绍基于蚁群算法的机器人最短路径规划的思路,以及我在运行MALTLAB程序的时候,学到的内容。

2.机器人最短路径规划的实现步骤
蚁周模型实现机器人最短路径规划的流程图

为了方便大家更好地理解蚁群算法的原理及实现过程,其流程图如图4所示。(流程图较长,我截图了两段。)


图4 基于蚁群算法的机器人最小路径规划流程图
图中公式(3)(4)的具体表达在下边的具体步骤里。

蚁周模型实现机器人最短路径规划的具体步骤

**步骤1:**给出栅格地图的地形矩阵;初始化信息素矩阵 Tau(记录每个栅格至其他栅格的信息素量),最大迭代次数K,蚂蚁个数M,表征信息素重要程度的参数 、表征启发式信息重要程度的参数 ,信息素蒸发系数 ,信息素增加强度系数Q及启发式信息矩阵
**步骤2:**构建启发式信息矩阵。按式(1)和式(2)计算每个栅格至目标点的距离,启发式信息素取为至目标点距离的倒数,距离越短,启发式因子越大,障碍物处的启发式信息为0。建立矩阵D,用以存储每个栅格点至各自相邻无障碍栅格点的代价值。
**步骤3:**对于每一只蚂蚁,初始化蚂蚁爬行的路径及路径长度,将禁忌列表全部初始化为1;蚂蚁从起始点出发开始搜索路径,找出当前栅格点的所有无障碍相邻栅格点(即矩阵D中相应元素不为0的栅格点),再根据禁忌列表筛选出当前可选择的栅格点。
**步骤4:**如果起始点是目标点,且可选栅格点个数大于等于1,则根据式(3)计算蚂蚁从当前栅格点转移到各相邻栅格点的概率,

二、部分源代码

function varargout = main_GUI_xu(varargin)
% MAIN_GUI_XU MATLAB code for main_GUI_xu.fig
%      MAIN_GUI_XU, by itself, createfunction edit26_Callback(hObject, eventdata, handles)
% hObject    handle to edit26 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit26 as text
%        str2double(get(hObject,'String')) returns contents of edit26 as a double% --- Executes during object creation, after setting all properties.
function edit26_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit26 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction edit27_Callback(hObject, eventdata, handles)
% hObject    handle to edit27 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit27 as text
%        str2double(get(hObject,'String')) returns contents of edit27 as a double% --- Executes during object creation, after setting all properties.
function edit27_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit27 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction edit28_Callback(hObject, eventdata, handles)
% hObject    handle to edit28 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit28 as text
%        str2double(get(hObject,'String')) returns contents of edit28 as a double% --- Executes during object creation, after setting all properties.
function edit28_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit28 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction edit101_Callback(hObject, eventdata, handles)
% hObject    handle to edit101 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit101 as text
%        str2double(get(hObject,'String')) returns contents of edit101 as a double% --- Executes during object creation, after setting all properties.
function edit101_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit101 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction edit102_Callback(hObject, eventdata, handles)
% hObject    handle to edit102 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit102 as text
%        str2double(get(hObject,'String')) returns contents of edit102 as a double% --- Executes during object creation, after setting all properties.
function edit102_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit102 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction edit104_Callback(hObject, eventdata, handles)
% hObject    handle to edit104 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit104 as text
%        str2double(get(hObject,'String')) returns contents of edit104 as a double% --- Executes during object creation, after setting all properties.
function edit104_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit104 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction edit105_Callback(hObject, eventdata, handles)
% hObject    handle to edit105 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit105 as text
%        str2double(get(hObject,'String')) returns contents of edit105 as a double% --- Executes during object creation, after setting all properties.
function edit105_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit105 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction edit106_Callback(hObject, eventdata, handles)
% hObject    handle to edit106 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit106 as text
%        str2double(get(hObject,'String')) returns contents of edit106 as a double% --- Executes during object creation, after setting all properties.
function edit106_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit106 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
end% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --- Executes on button press in radiobutton9.
function radiobutton9_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of radiobutton9## 三、运行结果
![在这里插入图片描述](https://img-blog.csdnimg.cn/dc24c629f32740b8a9c59c462cb5e5e9.jpg?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr5p6B56We5YWJ,size_19,color_FFFFFF,t_70,g_se,x_16#pic_center)
![在这里插入图片描述](https://img-blog.csdnimg.cn/74d111c012344158b7ceb0ed6bfc5dba.jpg?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA57Sr5p6B56We5YWJ,size_19,color_FFFFFF,t_70,g_se,x_16#pic_center)## 四、matlab版本及参考文献
**1 matlab版本**
2014a**2 参考文献**
[1] 包子阳,余继周,杨杉.智能优化算法及其MATLAB实例(第2版)[M].电子工业出版社,2016.
[2]张岩,吴水根.MATLAB优化算法源代码[M].清华大学出版社,2017.

【路径规划】基于matlab蚁群算法机器人栅格地图路径规划【含Matlab源码 119期】相关推荐

  1. 【路径规划】基于matlab蚁群算法机器人栅格地图最短路径规划【含Matlab源码 1618期】

    ⛄一.蚁群算法及栅格地图简介 1 蚁群算法 1.1 蚁群算法的提出 蚁群算法(ant colony optimization, ACO),又称蚂蚁算法,是一种用来寻找优化路径的机率型算法.它由Marc ...

  2. 【路径规划】基于matlab蚁群算法机器人栅格地图最短路径规划【含Matlab源码 119期】

    ⛄一.简介 路径规划是实现移动机器人自主导航的关键技术,是指在有障碍物的环境中,按照一定的评价标准(如距离.时间.能耗等),寻找到一条从起始点到目标点的无碰撞路径,这里选取最短距离路径规划的评价标准, ...

  3. 【路径规划】基于matlab蚁群算法机器人栅格地图最短路径规划【含Matlab源码 1580期】

    ⛄一.简介 路径规划是实现移动机器人自主导航的关键技术,是指在有障碍物的环境中,按照一定的评价标准(如距离.时间.能耗等),寻找到一条从起始点到目标点的无碰撞路径,这里选取最短距离路径规划的评价标准, ...

  4. 【路径规划】基于matlab GUI蚁群算法机器人栅格地图最短路径规划【含Matlab源码 927期】

    ⛄一.蚁群算法简介 1 引言 在自然界中各种生物群体显现出来的智能近几十年来得到了学者们的广泛关注,学者们通过对简单生物体的群体行为进行模拟,进而提出了群智能算法.其中, 模拟蚁群觅食过程的蚁群优化算 ...

  5. 【ACO TSP】基于matlab蚁群算法求解31城市旅行商问题【含Matlab源码 1147期】

    一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[TSP]基于matlab蚁群算法求解31城市旅行商问题[含Matlab源码 1147期] 点击上面蓝色字体,直接付费下载,即可. 获取代码 ...

  6. 【路径规划】基于matlab帝国企鹅算法机器人栅格地图最短路径规划【含Matlab源码 1262期】

    ⛄一.帝企鹅算法简介 目前,关于帝企鹅算法在国内外研究较少,在中对该算法进行了分析,并且与常见的粒子群算法.萤火虫算法进行了对比分析. 帝企鹅从事各种活动,如狩猎.群体觅食,是群居性动物.每当恶劣的气 ...

  7. 【路径规划】基于matlab蚁群算法机器人大规模栅格地图最短路径规划【含Matlab源码 1860期】

    ⛄一.蚁群算法及栅格地图简介 随着机器人技术在诸多领域的应用, 如机器人协作焊接.灾后搜救.军事.太空探索.深海勘探.家用和服务行业等, 机器人的发展正向智能化方向延伸, 要求其具有自组织.自学习.自 ...

  8. 3.蚁群算法求解格栅地图路径规划matlab代码

    往期: 1.Dijkstra算法求解格栅地图路径matlab代码_墨叔叔的博客-CSDN博客 2.A*搜索算法原理及matlab代码_墨叔叔的博客-CSDN博客 一.蚁群算法原理 原理:蚁群系统(An ...

  9. 【Matlab路径规划】A_star算法机器人栅格地图路径规划【含源码 116期】

    一.代码运行视频(哔哩哔哩) [Matlab路径规划]A_star算法机器人栅格地图路径规划[含源码 116期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1] ...

  10. 【Matlab图像融合】小波变换遥感图像融合【含GUI源码 744期】

    一.代码运行视频(哔哩哔哩) [Matlab图像融合]小波变换遥感图像融合[含GUI源码 744期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1] 包子阳,余 ...

最新文章

  1. [No000017F]如何监控注册表的修改
  2. 转]SQLServerDBA十大必备工具
  3. java中的md5加密_java中的MD5加密
  4. 计算机应用大一题,大一计算机应用基础习题与答案(精选).doc
  5. Tomcat一步步实现反向代理、负载均衡、内存复制
  6. java 中的点_java————形参中的点点点 | 学步园
  7. SSM 框架整合 spring 发送邮件功能实现!
  8. Eclipse 插件ibeetl
  9. java中synized_ConcurrentHashMap和Collection s.SynizedMap(Map)
  10. insert执行成功 没有数据_Python—接口测试数据库封装实现原理
  11. mySQL数据库学习的一些心得
  12. 解决-win10软件默认安装路径为C盘——修改注册表
  13. phpnow mysql升级,phpnow升级apache版本
  14. BlackBerry手机应用上网的通道列表
  15. 盘点苹果电脑上那些不错的cpu优化工具
  16. [CF1132D]Stressful Training
  17. Beautiful Songs
  18. led的伏安特性曲线 matlab实现_灯泡伏安特性仿真实验的实现算法
  19. Centos 修改镜像源为阿里云
  20. 计算机页面里的坚果云删不了怎么回事,我的坚果云文件夹为什么无法删除

热门文章

  1. Windows10应用Docker部署DoNet Core
  2. 修改Apache配置文件开启gzip压缩传输
  3. codeforces 212E IT Restaurants(树形dp+背包思想)
  4. ubuntu中Ruby开发集成环境
  5. 测试VGA12H直接写屏速度 V1.1
  6. WSS2.0 服务器启用SQL代理的解决过程
  7. 190817每日一句
  8. 将类实现分开以及代码块
  9. Python安装时0x80070642问题解决
  10. Atitit php读取数据库记录集合并循环修改展示//------------------------ini db sys$dbstr = “mysql:host=“ . $mysql_con