Skip to main content
. 2022 Nov 22;22(23):9036. doi: 10.3390/s22239036
Algorithm 3 APF method implementation procedure.
Input: Scene map maze, random start position (x0,y0), random destination position (xd,yd), positions set Λpositions.
Output: A path between (x0,y0) and (xd,yd).
1: initialization: Set current position (x,y)=(x0,y0), gray processing and binarization for the map maze.
2: Confirm the location of obstacles and calculate potential energy of each position.
3: while |(xd,yd)(x,y)|>ϵ do
4:  Record current position into Λpositions.
5:  Find the position (x,y) with the smallest potential energy among the eight positions around (x,y).
6:  Perform (x,y)=(xt+1,yt+1).
7: end while
8: return A path with all positions in Λpositions.