因為項目的原因又去了解了一下路徑規(guī)劃算法银觅,包括A和RRT首繁。
由于項目中使用的全局SBPL算法是基于A的變種坞琴,小白稍微了解了一下A*算法哨查,簡單來說是一種啟發(fā)式搜索算法,通過計算損失函數(shù)找到最優(yōu)解剧辐,具體如下:https://blog.csdn.net/zhulichen/article/details/78786493寒亥。
SBPL中還需要獲取機器人的基礎(chǔ)運動元,以及相應(yīng)的代價荧关。通過SBPL給出的Matlab可生成.mprim文件溉奕,具體如下:
resolution = 0.01;%像素
numberofangles = 8; %360度中離散化成8個方向的運動
numberofprimsperangle = 16;%每個方向中有16種運動基礎(chǔ)方式
%不同運動方式的損失函數(shù)
forwardcostmult = 1;
backwardcostmult = 5;
forwardandturncostmult = 1;
sidestepcostmult = 50;
turninplacecostmult = 50;
% 以0度為例
basemprimendpts0_c(1,:) = [1 0 0 forwardcostmult];
basemprimendpts0_c(2,:) = [4 0 0 forwardcostmult];
basemprimendpts0_c(3,:) = [8 0 0 forwardcostmult];
basemprimendpts0_c(4,:) = [6 2 0 sidestepcostmult];
basemprimendpts0_c(5,:) = [6 -2 0 sidestepcostmult];
basemprimendpts0_c(6,:) = [2 3 0 sidestepcostmult];
basemprimendpts0_c(7,:) = [2 -3 0 sidestepcostmult];
basemprimendpts0_c(8,:) = [-5 0 0 backwardcostmult];
basemprimendpts0_c(9,:) = [6 2 1 forwardandturncostmult];
basemprimendpts0_c(10,:) = [6 -2 -1 forwardandturncostmult];
%2/32 theta change
basemprimendpts0_c(11,:) = [4 3 2 forwardandturncostmult];
basemprimendpts0_c(12,:) = [4 -3 -2 forwardandturncostmult];
%turn in place
basemprimendpts0_c(13,:) = [0 0 1 turninplacecostmult];
basemprimendpts0_c(14,:) = [0 0 -1 turninplacecostmult];
basemprimendpts0_c(15,:) = [0 0 3 turninplacecostmult];
basemprimendpts0_c(16,:) = [0 0 -3 turninplacecostmult];
其中括號里表示x,y,theta,cost。生成8*16=128中運動方式忍啤,考慮到整體的可行性加勤,每個運動元的終點在網(wǎng)格上。(對數(shù)據(jù)進行四舍五入)有了運動元就容易全局規(guī)劃了同波。