⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 D星算法
💻
字号:
***************** DSTAR Class  **   README     *****************This software is an implementation of the D*-Lite algorithm asexplained in [Koenig, 2002]. This is the non-optimized version asexplained in Figure 5 of the paper. There are a few minor improvementsthat were made to this algorithm explained in section 3 below. This source isreleased under the GNU GENERAL PUBLIC LICENSE Version 3, 29 June2007 available at: http://www.gnu.org/licenses/gpl.html. Please notethis is an early release and the software still has small bugs.Contents:1. Compiling and Running2. Integration3. Modifications4. References5. Author Info1. Running the dstar test program:you will need to have the openGL/GLUT libraries installed for this towork. But you do not need them to use the Dstar class in your ownprogram. $ tar -xzf dstar.tgz$ cd dstar$ make$ ./dstarCommands:[q/Q] - Quit[r/R] - Replan[a/A] - Toggle Auto Replan[c/C] - Clear (restart)left mouse click - make cell untraversable (cost -1)middle mouse click - move goal to cellright mouse click - move start to cellThe cell colors are as follows: Red - untraversable Green - traversable but with changed costRed/Green with small purple square - The cell is on the openListYellow - start cellPurple - goal cell2. Using in your own source: Here is a simple working test program that uses the Dstar class:#include "Dstar.h"int main() { Dstar *dstar = new Dstar(); list<state> mypath; dstar->init(0,0,10,5);         // set start to (0,0) and goal to (10,5) dstar->updateCell(3,4,-1);     // set cell (3,4) to be non traversable dstar->updateCell(2,2,42.432); // set set (2,2) to have cost 42.432 dstar->replan();               // plan a path mypath = dstar->getPath();     // retrieve path dstar->updateStart(10,2);      // move start to (10,2) dstar->replan();               // plan a path mypath = dstar->getPath();     // retrieve path dstar->updateGoal(0,1);        // move goal to (0,1) dstar->replan();               // plan a path mypath = dstar->getPath();     // retrieve path  return 0;}3. Implementational Details: Here is a list of the more interesting tweaks that we applied toimprove the D* Lite algorithm explained in [Koenig, 2002].3.1 The Open Hash and Lazy Remove:  In order to speed up the time it takes to add/remove/search on theopen list we used both a stl::priority_queue and a "stl"::hash_map tostore states. The queue keeps the states in sorted order so it is easyto find the next best state while the hash is used to quicklydetermine what states are in the queue. When a cell is inserted intothe openlist it is pushed onto the queue and put into the hashtable. In order to check if a cell is on the open list one can justcheck if it is in the hash table. The hash table also stores a hash ofthe cells key so cells that are outdated in the queue can still beremoved. Any time a cell is popped off the queue we check if it is inthe hash, if not it is discarded an a new one is chosen. 3.2 Euclidean Path Optimization Obtaining a path from the D* generated cost map is generally done bystarting at the start node and doing a greedy search by expandingsuccessor nodes with the lowest cost to  goal. This approach cangenerate a path that starts heading out 45 degrees toward the goalinstead of straight at it. This happens because the 8-way connecteddistance is an approximation and there is no difference between takingall of the angular moves first and taking all of the straightmoves. In order to generate a path that is closer to the true shortestcost we added a simple modification to the greedy search. When wecompare the costs to all of the successor cells we choose the one thatminimizes:(cellA.g != cellB.g) return (cellA.g <  cellB.g)return ((euclidean_dist(cellA,start) + euclidean_dist(cellA,goal))        < (euclidean_dist(cellB,start) + euclidean_dist(cellB,goal)))This means we break ties by choosing the cell that lies closest to thestraight line between the start and goal states. 3.3 Goal Changes The D* Lite algorithm explained in [Koenig, 2002] doesn't includecode to handle the goal changing locations. To do this we simply clearthe map, change the location of the goal, re-add all the obstacles,and replan. There is probably a more efficient way of dealing withthis but this modification worked great for our purposes. 3.4 Max Steps If there is no path to the goal D* can have a hard time detecting itand will likely loop forever. In order to partially deal with thisissue the search will automatically return after a set number of nodeexpansions (set to 'maxsteps'). After the search returns it can startagain where it left off with another call to replan(). 4. References:Improved Fast Replanning for Robot Navigation in Unknown TerrainSven Koenig, Maxim LikhachevTechnical Report GIT-COGSCI-2002/3, Georgia Institute of Technology, 2002.5. Author InfoPlease report any bugs or comments to:James NeufeldUniversity of Alberta, Canadaneufeld@cs.ualberta.cathanks, and I hope this code is helpful.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -