Skip to main content
. 2020 Mar 18;20(6):1698. doi: 10.3390/s20061698
Algorithm 1 Cleaning Path Generation
  • 1:

    Step 1

  • 2:

    N is an array holds all the nodes position

  • 3:

    P is an array used to store the cleaning path

  • 4:

    qstart = leftmost(N);     Set uppermost left nodes as qstart

  • 5:

    load qn = N1

  • 6:

    qgoal = def_goal(litter collection point);   the function load the litter collection point as qgoal

  • 7:

    Step 2

  • 8:

    while cleaning path between qstart to qn not discovered do

  • 9:

    Q, backtracknode, internodesandPath are variable used for store the temporary value

  • 10:

    for n=0;n<qn;n++ do

  • 11:

      Q= dfs_paths(qstart, qn);        Explore the path between qstart and N1 nodes

  • 12:

    end for

  • 13:

    backtracknode = backtrack.find(Q);     the function find the backtrack node in the explored path

  • 14:

    internodes = group.find(qstart, backtracknode);     the function collect intermediate node between qstart and backtracknode

  • 15:

     Path = def_PRM_node_connect(qstart, internodes, backtracknode, qgoal, R);   PRM function connect the nodes according to threshold function R

  • 16:

    plt.plot (Path)

  • 17:

    end while

  • 18:

    visited.add(Path);   Mark all path identified node in N

  • 19:

    Store the path in P

  • 20:

    load qn = NPath;   exclude path generate node from N

  • 21:

    set.new(qstart,N);   set new qstart from updated N

  • 22:

    Run the Step 2 up-to generate the path for remaining nodes