資源簡介
matlab實現的用A星算法進行柵格法路徑規劃,且路徑不固定
代碼片段和文件信息
function?astardemo
%ASTARDEMO?Demonstration?of?ASTAR?algorithm
n?=?20;???%?柵格為20x20的環境模型
wallpercent?=?0.5;??%?this?percent?of?field?is?walls
%?create?the?n?x?n?FIELD?with?wallpercent?walls?containing?movement?costs?
%?a?starting?position?STARTPOSIND?a?goal?position?GOALPOSIND?the?costs?
%?A?star?will?compute?movement?cost?for?each?tile?COSTCHART?
%?and?a?matrix?in?which?to?store?the?pointers?FIELDPOINTERS
%[field?startposind?goalposind?costchart?fieldpointers]?=?...
?%?initializeField(nwallpercent);
[field?startposind?goalposind?costchart?fieldpointers]?=?...
initializeField(nwallpercent);
%?initialize?the?OPEN?and?CLOSED?sets?and?their?costs
setOpen?=?[startposind];?setOpenCosts?=?[0];?setOpenHeuristics?=?[Inf];
setClosed?=?[];?setClosedCosts?=?[];
movementdirections?=?{‘R‘‘L‘‘D‘‘U‘‘UR‘‘UL‘‘DL‘‘DR‘};
%?keep?track?of?the?number?of?iterations?to?exit?gracefully?if?no
%?solution(如果沒有解決方案保留迭代數目然后退出)
counterIterations?=?1;
%?create?figure?so?we?can?witness?the?ma
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????13504??2020-11-15?06:37??astardemo.m
- 上一篇:matlab EMD 降噪方法
- 下一篇:雙目視覺下的三維重建
評論
共有 條評論