SHORTENING THE OUTPUT PATH OF A* ALGORITHM: OMNI ...

5
International Journal of Industrial Electronics and Electrical Engineering, ISSN: 2347-6982 Volume-4, Issue-4, Apr.-2016 Shortening The Output Path Of A* Algorithm: Omni-Directional Adaptive A* 82 SHORTENING THE OUTPUT PATH OF A* ALGORITHM: OMNI- DIRECTIONAL ADAPTIVE A* 1 IBRAHIM BAAJ, 2 TOLGAY KARA 1,2 Department of Electrical and Electronics Engineering, University of Gaziantep,Turkey E-mail: 1 [email protected], 2 [email protected] Abstract- The problem of path planning on a grid has been widely discussed for applications like robotics and computer games, several path planning algorithms have been developed in the last decades, including A* which is recommended for real time applications. Traditional A* algorithm finds the path on Grid represented as discrete steps on Cartesian coordinates, this will increase the time of execution when applied in robot path planning especially with Omni-directional robots which are able to move in all directions, the time consumed between sending orders makes the difference, and the path can be longer than real shortest paths in the grid. This paper presents a new method based on traditional A* algorithm, in the first stage the developed algorithm will represent the path found by A* algorithm as polar coordinates instead of Cartesian coordinates, in the second stage Omni-Directional Adaptive A* will shorten the path building on the flexibility of polar representation of the path. The method can be applied on the output of variety of other path planning algorithms, it is a reshaping of the output of traditional path planning algorithms. The experiments in this paper demonstratethe resulted path with the time saved in each case. Keywords- Path Planning, Robotics, A* Algorithm, Obstacle Detection, Shortest Path, Search Algorithm. I. INTRODUCTION A* Algorithm searches for the shortest path between start point and end point, and it gives the route as steps represented by Cartesian coordinates (x,y) for the robot to move until reaching the target. The movement that depends on discreet steps will increase the total execution time, because of the time loss between sending two orders during the movement on the route, this is one of the problems that we solved. Another problem is that the path produced by traditional A* is guaranteed to be the shortest only when applied as discrete steps in Cartesian graph, but still the path can be shorten if it can be represented in different way as we will prove in this paper. In order to solve the last two problems we are going to develop the algorithm on two stages: First development: we seek to reduce the number of discreet steps by transforming from Cartesian coordinates (x,y) to polar coordinates (r,θ) which is going to reduce the total number of movement orders so it will reduce to total execution time of the movement on the path. Second development: by developing new heuristic function applied on the output of the first stage, so we will get new routes shorter than the ones produced by traditional A*. II. DETAILS EXPERIMENTAL 2.1. Materials and Procedures The two changes on A* algorithm demonstrated in this paper has been applied as a computer program written in C++, the experiments were done usingOmni-Directional robot, it is able to move in all directions, and it receives the orders from computer program using Wi-Fi network. Similar to all computer orientated robots, latency between sending each two consecutive orders should be taken into consideration when sending the orientation orders from computer to robot, in our case it is 0.5 second, all the experiments have been applied on a grid with 25 cells or 30 cells, the cell dimensions in all the grids are considered as 10 measuring units, and the time consumed for the robot to cross the distance of 10 measuring units is 5 seconds. 2.2. Minimizing the total execution time by exchanging from Cartesian coordinates to polar coordinates The path formed by A* algorithm is a discrete steps represented by Cartesian coordinates (x,y), if we abbreviate the total number of steps by deleting unnecessary steps without changing the path we can reduce the total execution time. In order to know the steps that can be removed lets study the steps in the path produced by A* as shown in Fig.1. and described in table 1. Fig.1. The path found using A* algorithm.

Transcript of SHORTENING THE OUTPUT PATH OF A* ALGORITHM: OMNI ...

Page 1: SHORTENING THE OUTPUT PATH OF A* ALGORITHM: OMNI ...

International Journal of Industrial Electronics and Electrical Engineering, ISSN: 2347-6982 Volume-4, Issue-4, Apr.-2016

Shortening The Output Path Of A* Algorithm: Omni-Directional Adaptive A*

82

SHORTENING THE OUTPUT PATH OF A* ALGORITHM: OMNI-DIRECTIONAL ADAPTIVE A*

1IBRAHIM BAAJ, 2TOLGAY KARA

1,2Department of Electrical and Electronics Engineering, University of Gaziantep,Turkey

E-mail: [email protected], [email protected]

Abstract- The problem of path planning on a grid has been widely discussed for applications like robotics and computer games, several path planning algorithms have been developed in the last decades, including A* which is recommended for real time applications. Traditional A* algorithm finds the path on Grid represented as discrete steps on Cartesian coordinates, this will increase the time of execution when applied in robot path planning especially with Omni-directional robots which are able to move in all directions, the time consumed between sending orders makes the difference, and the path can be longer than real shortest paths in the grid. This paper presents a new method based on traditional A* algorithm, in the first stage the developed algorithm will represent the path found by A* algorithm as polar coordinates instead of Cartesian coordinates, in the second stage Omni-Directional Adaptive A* will shorten the path building on the flexibility of polar representation of the path. The method can be applied on the output of variety of other path planning algorithms, it is a reshaping of the output of traditional path planning algorithms. The experiments in this paper demonstratethe resulted path with the time saved in each case. Keywords- Path Planning, Robotics, A* Algorithm, Obstacle Detection, Shortest Path, Search Algorithm. I. INTRODUCTION A* Algorithm searches for the shortest path between start point and end point, and it gives the route as steps represented by Cartesian coordinates (x,y) for the robot to move until reaching the target. The movement that depends on discreet steps will increase the total execution time, because of the time loss between sending two orders during the movement on the route, this is one of the problems that we solved. Another problem is that the path produced by traditional A* is guaranteed to be the shortest only when applied as discrete steps in Cartesian graph, but still the path can be shorten if it can be represented in different way as we will prove in this paper. In order to solve the last two problems we are going to develop the algorithm on two stages: First development: we seek to reduce the

number of discreet steps by transforming from Cartesian coordinates (x,y) to polar coordinates (r,θ) which is going to reduce the total number of movement orders so it will reduce to total execution time of the movement on the path.

Second development: by developing new heuristic function applied on the output of the first stage, so we will get new routes shorter than the ones produced by traditional A*.

II. DETAILS EXPERIMENTAL 2.1. Materials and Procedures The two changes on A* algorithm demonstrated in this paper has been applied as a computer program written in C++, the experiments were done usingOmni-Directional robot, it is able to move in all directions, and it receives the orders from computer

program using Wi-Fi network. Similar to all computer orientated robots, latency between sending each two consecutive orders should be taken into consideration when sending the orientation orders from computer to robot, in our case it is 0.5 second, all the experiments have been applied on a grid with 25 cells or 30 cells, the cell dimensions in all the grids are considered as 10 measuring units, and the time consumed for the robot to cross the distance of 10 measuring units is 5 seconds. 2.2. Minimizing the total execution time by exchanging from Cartesian coordinates to polar coordinates The path formed by A* algorithm is a discrete steps represented by Cartesian coordinates (x,y), if we abbreviate the total number of steps by deleting unnecessary steps without changing the path we can reduce the total execution time. In order to know the steps that can be removed lets study the steps in the path produced by A* as shown in Fig.1. and described in table 1.

Fig.1. The path found using A* algorithm.

Page 2: SHORTENING THE OUTPUT PATH OF A* ALGORITHM: OMNI ...

International Journal of Industrial Electronics and Electrical Engineering, ISSN: 2347-6982 Volume-4, Issue-4, Apr.-2016

Shortening The Output Path Of A* Algorithm: Omni-Directional Adaptive A*

83

Table1: The steps of the path generated by A*

In Fig.1. we can notice that the steps located on straight line (the steps in red color) would not affect the length of the path if we replace it with one step, so we suggest transforming all path steps from Cartesian coordinates to polar coordinates and compare the angle for each twoconsecutive steps to know if they are on straight line, and then deleting one of the two steps in the path. Transforming from Cartesian coordinates to polar coordinates facilitates the process of directing the omni-directional robots, as the orders in such systems are usually sent as a length and angle rather than Cartesian coordinates. Algorithm execution: We are going to add the following steps to A* algorithm:

Table2: Transforming to polar coordinates

Table3: Compact Polar Coordinates

Table4: Cartesian path motion time and total steps

Table5: Polar Path motion time and total steps

Table6: Comparing Cartesian path with polar path

As shown in Table6 we were able to reduce the total motion time by 6.7% and also the total number of steps has been reduced with high percentage up to 81.8%, it is worth mentioning here that reducing the total number of steps doesn’t necessarily reduce the length of the path, and in our example in Fig.1.we were able to reduce the total number of steps without reducing the path length, The following C++ programming code shows the algorithm:

Page 3: SHORTENING THE OUTPUT PATH OF A* ALGORITHM: OMNI ...

International Journal of Industrial Electronics and Electrical Engineering, ISSN: 2347-6982 Volume-4, Issue-4, Apr.-2016

Shortening The Output Path Of A* Algorithm: Omni-Directional Adaptive A*

84

2.3. Omni Directional Adaptive A* After the change of transferring the steps representation in the path provided by A*from Cartesian to polar coordinates, and decreasing the number of steps, we still can think about finding a shorter path depending on the path we already found, Let’s study the case in Fig.2.where the path provided with traditional A* would be 8 steps or with the edited one we explained before is only 4 steps with same path length, we still can shorten the path as shown in Fig.3.by selecting the route PQ then QT, but how can we search and produce these routes?

Fig.2. The path found using A* algorithm.

Fig.3. The path found using Omni-Directional Adaptive A*

algorithm.

The algorithm depends on finding the resulting vector of the summation of the two vectorsproduced by two consecutive steps, taking into consideration the safety of the path, so we have to restudy the entire map after applying traditional A*. For example if we set an obstacle in cell (5-3) as shown in Fig.4.the traditional A* will produce the same path produced in Fig.3. while if we produce the path with the vector PQ according to the new suggested method the path will be unaccepted because it passes through an obstacle cell, so even if the path produced by A* can be shortened we have to take into consideration all obstacles in the map before producing the new path.

Fig.4. Considering the obstacle when changing the path on

Omni-Directional Adaptive A* 2.4. How the Safe Paths can be discovered by the algorithm. In order to discover the safety of the new path we developed a method to discover any intersection between the new path and obstacle cells, this new obstacles detector consist of two diagonals D1 & D2 in each obstacle cell, as in Fig.5.A.those two diagonals will cover all passible crossing routes among the cell, we didn’t choose the line segments L1 & L2 shown in Fig.5.B.because in this case we will lose the ability to crosscheck the path in small pieces of the cell, and this is not acceptable for producing the safe paths, Fig.5. shows the difference between the two detectors, and how diagonal detectors can cover all the possible crossings in the obstacle areas with any direction while the median line segments fail to do so.

Fig.5. Obstacle Detector

Page 4: SHORTENING THE OUTPUT PATH OF A* ALGORITHM: OMNI ...

International Journal of Industrial Electronics and Electrical Engineering, ISSN: 2347-6982 Volume-4, Issue-4, Apr.-2016

Shortening The Output Path Of A* Algorithm: Omni-Directional Adaptive A*

85

Also using one diagonal only, may not intersect with the path passing from the cell in some cases, as described in Fig.6.

Fig.6. Fail obstacle detector

To determine whether there are an intersection points between the line segment of the path and the diagonals of the obstacle cell we have the following equations: Considering P: Y=mX + c is the equation representing the line segment of the path, and the equations representing the two detectors are: D1: Y1 = X1 + c1 where m=1 D2: Y2 = -X2 + c2 where m=-1 By solving the two sets of equations (P & D1) and (P & D2) we can find any existing intersection points n1,n2 and then we move to the next step which is forming the paths with the developed algorithm. 2.5. Forming the Safe Paths by the developed algorithm After producing the shorten path between two consecutive steps we study the intersection of the new formed shorten path with the two detectors of every obstacle cell, and we test the coordinates of the intersection points n1, n2 with the following two conditions:

1- If the intersection point is inside the borders of an obstacle cell, then the change in the path would be refused, because it means that there is an obstacle in the new path.

2- If the intersection is outside the boundaries of the obstacle cell, we can shortern the path according to the folloing steps:

Delete the step represents the interection between the tow segments of the path.

Find the length of the new path segment according to folloing law:

Calculate the new orientation angle θ from

the slope of the new line P.

Fig.7. Considering the obstacle with obstacle detector when

changing the path on Omni-Directional Adaptive A*

III. RESULTS AND DISCUSSION The following tables show the results of applying Omni-directional adaptive A*, we were able to save 6.6% of the total path length and 11.7% of the total execution time.

Table7: comparison between traditional A* and developed algorithms

Table8: Improved Traditional A* Steps and Total

Motion Time

Table9: Omni-Directional Adaptive A* Steps and

Total Motion Time

Table10: Comparison Between Improved Traditional A* andOmni-Directional Adaptive A*

in Steps and Total Motion Time

Page 5: SHORTENING THE OUTPUT PATH OF A* ALGORITHM: OMNI ...

International Journal of Industrial Electronics and Electrical Engineering, ISSN: 2347-6982 Volume-4, Issue-4, Apr.-2016

Shortening The Output Path Of A* Algorithm: Omni-Directional Adaptive A*

86

Fig.8. the final path calculations using Omni-Directional

Adaptive A* CONCLUSIONS The improved traditional A* algorithm decreases the total motion time by decreasing the total number of orders sent to the robot so it decreases the effect of latency between sending each two consecutive orders, whereas Omni-Directional Adaptive A* uses the output of the improved traditional A* and shorten the path which reflects on decreasing the total motion time as well, we can illustrate the advantages of each one building on the examples studied in this paper as following:

1. After transforming to polar coordinates, the improved traditional A* managed to decrease the total motion time by 6.7% by decreasing the total number of steps by 81% from 11 moving orders to 2 moving orders, as in Fig.1.but the case can be different in more complicated paths.

2. Applying Omni-Directional Adaptive A* decreased the total motion time by 11.7% by both decreasing the total number of steps by 50% and path length by 6.6%.

REFERENCES

[1] STRANDBERG M., "Robot Path Planning: An Object-Oriented Approach", Dept. of Signals – Sensors and Systems, Royal Institute of Technology (KTH), Sweden, ISBN 91-7283-868-X, 2004.

[2] Stuart J. Russell and Peter Norving, "Artificial intelligence A modern approach", Printice Hall, ISBN 0-13-103805-2, 1995.

[3] BAEDE T.A., “Motion Control of an Omnidirectional Mobile Robot”, Eindhoven University of Technology, Dynamic & Control Technology Group, DCT 2006.084, September 18, 2006. 179

[4] CROUS B., "Autonomous Robot Path Planning", Degree of Master thesis fulfillment, University of Stellenbosch, 129, 2009.

[5] BARRERA A., "MOBILE ROBOTS NAVIGATION", In-TEH Publisher, ISBN 978-953-307-076-6, 2010.

[6] Kim, Hongjun, and B. Kim. "Online Minimum-Energy Trajectory Planning and Control on a Straight Line Path for Three-Wheeled Omni-Directional Mobile Robots." (2014): 1-1.

[7] Siddiqi, Umair F., et al. "A memory efficient stochastic evolution based algorithm for the multi-objective shortest path problem." Applied Soft Computing14 (2014): 653-662.

[8] Zeng, W., and R. L. Church. "Finding shortest paths on real road networks: the case for A*." International Journal of Geographical Information Science 23.4 (2009): 531-543.

[9] Hart, Peter E., Nils J. Nilsson, and Bertram Raphael. "A formal basis for the heuristic determination of minimum cost paths." Systems Science and Cybernetics, IEEE Transactions on 4.2 (1968): 100-107.

[10] Pearl, Judea, and Jin H. Kim. "Studies in semi-admissible heuristics." Pattern Analysis and Machine Intelligence, IEEE Transactions on 4 (1982): 392-399.

[11] Goldberg, Andrew V., Haim Kaplan, and Renato F. Werneck. "Reach for A*: Efficient Point-to-Point Shortest Path Algorithms." ALENEX. Vol. 6. No. 2. 2006.

[12] Huang, Hsin-Hsiung, et al. "Implementation of the line maze robot with diagonal motion control." Control and Decision Conference (2014 CCDC), The 26th Chinese. IEEE, 2014.

[13] Botea, Adi, Martin Müller, and Jonathan Schaeffer. "Near optimal hierarchical path-finding." Journal of game development 1.1 (2004): 7-28.

[14] Daniel, Kenny, et al. "Theta*: Any-Angle Path Planning on Grids." arXiv preprint arXiv:1401.3843 (2014).

[15] Ferguson, Dave, and Anthony Stentz. "Using interpolation to improve path planning: The Field D* algorithm." Journal of Field Robotics 23.2 (2006): 79-101.