Robot exploration algorithm

后端 未结 8 1760
情书的邮戳
情书的邮戳 2021-02-01 05:48

I\'m trying to devise an algorithm for a robot trying to find the flag(positioned at unknown location), which is located in a world containing obstacles. Robot\'s mission is to

相关标签:
8条回答
  • 2021-02-01 06:31

    A simple Breadth First Search/Depth First Search will work, albeit slowly. Be sure to prevent the bot from checking paths that have the same square multiple times, as this will cause these algorithms to run much longer in standard cases, and indefinitely in the case of the flag being unable to be reached.

    A* is the more elegant approach, especially if you know the location of the flag relative to yourself. Wikipedia, as per usual, does a decent job with explaining it. The classic heuristic to use is the manning distance (number of moves assuming no obstacles) to the destination.

    These algorithms are useful for the return trip - not so much the "finding the flag" part.


    Edit: These approaches involve creating objects that represents squares on your map, and creating "paths" or series of square to hit (or steps to take). Once you build a framework for representing your square, the problem of what kind of search to use becomes a much less daunting task.

    This class will need to be able to get a list of adjacent squares and know if it is traversable.

    Considering that you don't have all information, try just treating unexplored tiles as traversable, and recomputing if you find they aren't.


    Edit: As for seaching an unknown area for an unknown object...

    You can use something like Pledge's algorithm until you've found the boundaries of your space, recording all information as you go. Then go have a look at all unseen squares using your favorite drift/pathfinding algorithm. If, at any point long the way, you see the flag, stop what you're doing and use your favorite pathfinding algorithm to go home.

    0 讨论(0)
  • 2021-02-01 06:31

    What you want is to find all minimal-spanning-tree in the viewport of the robot and then let the robot game which mst he wants to travel.

    0 讨论(0)
提交回复
热议问题