Skip to main content
. 2019 Jul 29;19(15):3331. doi: 10.3390/s19153331
Algorithm 1 AGM-AMCL
Input:St1={xt1[i],et1[i],ωt1[i]i=1Nt1},ut,zt,mg,ma
Output: St={xt[i],et[i],ωt[i]i=1Nt}
1:  St,Nx0,n0,β0   // Initialization
2:  Ct={xhit[i],dhit[i],tag[i]i=1Nt1}   //For storing RAYCAST result
3:  for i1,,Nt1 do   //Initialize Ct
4:   tag[i]0
5:  end for
6:  do
7:   j RESAMPLING (St1)   //Resampling according to particle weight
8:   drange=et1[j]
9:   if tag[j]==0 then
10:    (μhit,dhit)RAYCAST(xt1[j],drange,ma)
11:    Ct[j](xhit,dhit,1)
12:   else
13:    (μhit,dhit)Ct[j]
14:   end if
15:   α COMPUTEALPHA (dhit,drange)
16:   sample c according to Bernoulli_Distribution( α)
17:   if  c==1
18:    Σhit COMPUTESIGMAHITT (drange,dhit,xt1[j])
19:    Create Pportal(xt|xt1[j],et1[i],ma) according to N(μhit,Σhit)
20:    Sample    xt[n] according to Pportal(xt|xt1[j],et1[i],ma)
21:   else
22:    Sample xt[n] according to Podo(xt|xt1[j],ut)
23:   end if
24:   et[n] PREDICTAMBIGUITYERROR (xt[n],et1[j],ma)
25:   ωt[n]P(zt|xt[n],ma) //Compute weight according to observation
26:   ββ+ωt
27:   StSt{xt[n],et[n],ωt}
28:   NxADPTINGSAMPLESIZE(xt[n])
29:   nn+1
30:  while n<Nx and n<Nmin
31:  for i1,,n do   //Normalize particle weight
32:   ωt[i]ωt[i]/β
33:  end for
34:  return St