Skip to main content
. 2023 Aug 25;23(17):7421. doi: 10.3390/s23177421
Algorithm 1 Obstacle detection
  •   1:

    Input: laserRanges, pc, PP, SPP

  •   2:

    Output: nextGoal

  •   3:

    for laserRanges do

  •   4:

        transform laserRanges from the local robot frame to the global map frame

  •   5:

    end for

  •   6:

    if global<do then

  •   7:

        nextGoalX=xc+global·cos(φc)

  •   8:

        nextGoalY=yc+global·sin(φc)

  •   9:

    end if

  • 10:

    for psSPP do

  • 11:

        for laserRanges do

  • 12:

            if SPPglobal1<dmin and globalpc1<do then

  • 13:

               replanning=1

  • 14:

            end if

  • 15:

        end for

  • 16:

    end for

  • 17:

    if replanning then

  • 18:

        for piPP do

  • 19:

            sd = pi+1pi1

  • 20:

            sd1 = pcpi1

  • 21:

            sd2 = pi+1pc1

  • 22:

            if (sd1+sd2)(sd0.5,sd+0.5) then

  • 23:

               if sd2<do then

  • 24:

                   nextGoal=PP[i+2]

  • 25:

               else

  • 26:

                   nextGoal=PP[i+1]

  • 27:

               end if

  • 28:

            end if

  • 29:

        end for

  • 30:

    end if