# Make robot drive as far from obstacles as possible

I am trying to make robot drive around the room, avoiding obstacles with pathfinding. The problem is I get few waypoints from pathfinding algorithm for robot to drive to (green dots), but it drive a bit too close to corners. I try avoiding that by using blur and threshold, to make walls thicker for the algorithm, but it causes problems with different size walls(as in example picture, blur is these black dots). How do I make my robot drive in the middle as possible of room, to avoid walls and be as far as poosible (the orange line) from the obstacles?

• just add a potential field cost in your path optimizer where cost is lowest in the center. – C.O Park Nov 27 '19 at 23:37
• Comments are for helping to improve questions and answers, and are distracting, so we try to keep them to a minimum. Partial answers, or answers you aren't confident about should still be posted as answers, since they can be improved by future edits @C.OPark . Comments should be considered ephemeral, any comment which no longer actively helps to improve a question or answer may be deleted at any time to tidy up a post. – Mark Booth Nov 28 '19 at 11:09
• The first step towards a better robot navigation is to avoid grounded natural language like “close to the corner” and “drive in the middle”. A robot pathplanner isn't a chatbot and doesn't need to interpret probabilistic speech. The better idea is to focus only on numerical values. A trajectory contains of nodes with (x,y) position and a cost function is used to plan a path from A to B. – Manuel Rodriguez Nov 29 '19 at 12:14

Some hints:

Use Minskowski sums to "grow" the obstacles taking into account the shape/orientation of the robot.

• Not easy to understand and implement, BUT already implemented in geometrical algorithm libraries.

After finding the path, postprocess the output. Try to use a smoother for the path, like voronoi diagram in order to go to the middle of the corridor.