Skip to main content
. 2026 Jan 13;26(2):520. doi: 10.3390/s26020520
Algorithm 2 ComputeReferenceHorizon: Nominal or Re-Entry (arc-length resampling)
Require: State xk=[xk,yk,θk], nominal path P={(xi,yi,θi)}i=1M, horizon Np, band δ=0.05m, look-ahead Lsmooth
1: Find closest point pc=(xc,yc,θc)P to (xk,yk); compute ey
2: if |ey| δthen ▹ Inside band
3:     Hk{xc+1ref,xc+2ref,,xc+Npref}
4:     if |Hk| <Np then
5:         Pad with xMref until |Hk| =Np
6:     return Hk ▹ Outside band: re-entry
7: Select smoothing point ps=(xs,ys,θs)P such that pspc Lsmooth
8: Define first point (robot): pr=(xk,yk,θr) with θr=tan1ysykxsxk
9: Build seed S={pr,ps,xs+1ref,,xs+Np2ref}
10: Compute cumulative arc-length s0=0, sj=sj1+[xj,yj][xj1,yj1]
11: Fit interpolants x(s),y(s),θ(s) (cubic if |S|4, else linear)
12: Resample at uniform arc steps: s=·Δs,=0,,L/Δs
13: Define Hk={(x(s),y(s),θ(s))}=1Np
14: if |Hk| <Np  then
15:       Pad with xMref until |Hk| =Np
16: return Hk