user1785307
user1785307

Reputation: 21

A star path finding in corridor

I am implementing A* for path finding of a mobile robot inside the corridor. As of now the path is produced inside the corridor but it slides over to the right following all the edges of the obstacles, but I prefer the path should lie in the middle of the corridor. 1.Is there any smoothing algo to do it? 2. How to include the steering constraints so that i can get realistic/feasible path? 3. How to give penalty for 'turn' so as to avoid zig-zag paths.

Since I am new to A* algo, I find difficlty in the above issues. Ref to any link, book is also welcome.. Thanks..

Upvotes: 1

Views: 962

Answers (2)

Vesper
Vesper

Reputation: 18747

You can pre-form the field on which you run A* by say shrinking it by 1 tile, so that a cell that borders impassable cell in 4-way neighborhood will become impassable. Then your resultant A* path will be closer to the center of the corridor. Of course, several corridors might become impassable completely, but this is what's expected as we are practically simulating a 3x3 cross-shaped robot to walk around the grid, and 3x3 cross can't go through 2xN path.

About adding cost to turn - you have to add current direction to the array that holds A* data, and implement a two-argument function that will return a non-negative value for (old direction, new direction) pair of arguments. Say, "if old_direction is not equal to new direction, return 1, else return 0". Then add the result of that function to whatever cost you computed for each step of A* iteration.

Upvotes: 1

Karoly Horvath
Karoly Horvath

Reputation: 96258

You could simply limit the usable area to the middle of the corridor.

Upvotes: 0

Related Questions