Skip to main content
. 2025 Oct 6;25(19):6181. doi: 10.3390/s25196181
Algorithm 2 Improved-DWA (Local Planning with Hard/Soft Safety and Multi-Objective)
Input Input: Current state x=(x,y,θ,v,ω), local goal, static map, predicted dynamic obstacles, DWA parameters.
Output Control u=v,ϕ, best trajectory trajj.
1 Build dynamic window: vmaxvmin,vk+aminΔt,minvmax,vk+amaxΔt;ϕmaxϕmin,ϕk+ϕ˙minΔt,minϕmax,ϕk+ϕ˙maxΔt.
2 Prune samples with |ϕ|>ϕmax or v<vε;
3 bestScore; u; traj;
4 For each sample (v,ϕ) in dynamic window do
5 Predict Np-step trajectory Γ=xl,yl,θll=1Np.
6 dminminlminoxl,ylxo,yo over static + predicted obstacles.
7 If dmin<D then continue.
8 Compute desired heading θdes=atan2ygyNp,xgxNp.
9 Heading=1+cosθNpθdes2.
10 Smooth=1Np1l1Np11+cosθl+1θl2
11 Clear=K11+expcdmindlim12
12 Velocity=vvminvmaxvmin.
13 RelAngle=1+cosθdesθk2.
14 J=αHeading+βSmooth+δClear+γVelocity+μRelAngle.
15 If J>bestScore then update bestScore, u=(v,ϕ),traj=Γ.
16 Return u,traj.