中文说明:
规定扫地机器人的尺寸为1×1的网格,地图尺寸为20×15(参数可修改),在利用矩阵Tag储存障碍物信息(障碍物标1,非障碍物标0),barrier_generate函数随即生成障碍物
路径规划考虑采用深度优先搜索算法,根据标记矩阵Tag的信息,找到网格之间可达性关系,建立图的邻接压缩表,深度优先搜索求出路径(深度优先所搜算法是在别人的代码上进行修改) 深度优先搜索源码地址
可视化过程中首先建立起地图网格,利用网格着色体现扫地机器人的运动过程,白色表示未清扫过,黑色表示障碍物,蓝色表示清扫过一次,红色表示反复清扫过。
随机游走采用向上下左右四个方向等可能地游走,可视化过程和路径规划的一样
主函数返回的是路径规划和随机游走所花的总步数
English Description:
& nbsp; The size of sweeping robot is 1 × 1 grid, the map size is 20 × 15 (parameters can be modified), in the use of matrix tag to store obstacle information (obstacle mark 1, non obstacle mark 0), barrier_ The generate function generates an obstacle < / P > < p > & nbsp& nbsp; The depth first search algorithm is used in path planning. According to the information of tag matrix, the reachability relationship between grids is found, the adjacency compression table of graph is established, and the depth first search algorithm is used to find the path (the depth first search algorithm is modified on other people's code). The depth first search source address is < / P > < p > & nbsp& nbsp; In the visualization process, the map grid is first established, and the motion process of the sweeping robot is reflected by grid coloring. White means not swept, black means obstacles, blue means once swept, and red means repeatedly swept p>
& nbsp; Random walk uses up, down, left, right directions and other possible walks. The visualization process is the same as path planning < / P > < p > the main function returns the total steps taken by path planning and random walk < / P > < p > < br / >