40 Aug2021
40 Aug2021
40 Aug2021
ABSTRACT: Human life these days has become easier with new technologies developing with respect to our
needs. Path generating techniques is one such technology, there is a significant increase in its demand for the
last few years. In this area, the most accurate and faster search algorithm is A*(A STAR) algorithm. In this
paper we discuss about A*(A STAR) algorithm, it is a path searching technique, which is an update of Dijkstra's
algorithm to find the shortest distance between two given locations/points (starting and target). A*(A STAR)
algorithm main aim is to improve the running time using heuristics. It uses the fact that all nodes generated
from spatial domains have related coordinates, these coordinates help in finding how far the target node is from
the present node by using a distance formula. Up on finding the target node exact position at regular intervals
will make A*(A STAR) work much faster and accurately in finding paths when compared to Dijkstra's
algorithm. In this paper we will generate the shortest path between the starting position and the target position
on a given image input. Initially our input image is converted into a grayscale image using image processing
technique through MATLAB. This helps in splitting the available traversing pixels and pixels with obstacles on
the image. Upon assigning starting position and target position on non-obstacle pixels, the A*(A star) algorithm
will generate the shortest path along the available traversing pixels using distance formula. This distance
formula is also known as distance function. In computer science, A* (as “A star”) is a computer algorithm that
is widely used in pathfinding and graph traversal, the process of plotting an efficiently traversable path between
points, called nodes. The A*(A STAR) algorithm combines features of uniform-cost search and pure heuristic
search to effectively compute optimal solutions. Noted for its performance and accuracy, it enjoys widespread
use. Peter Hart, Nils Nilsson and Bertram Raphael first described the algorithm in 1968. It is an extension of
Edsger Dijkstra’s 1959 algorithm. A*(A STAR) achieves better performance (with respect to time) by using
heuristics. As A*(A STAR) traverses the graph, it follows a path of the lowest known cost, Keeping a sorted
priority queue of alternate path segments along the way. If, at any point, a segment of the path being traversed
has a higher cost than another encountered path segment, it abandons the higher-cost path segment and
traverses the lower-cost path segment instead. This process continues the goal is reached.
Keywords: A*(A STAR) algorithm, Grayscale conversion, Nodes, Heuristics, Simulation, Path routing.
I. INTRODUCTION
There was a problem of finding the shortest path between two locations in real-time. There is a need to travel for
every person and as time is limited to everyone, we need to travel with minimal time possible. This intensified
when there were more and more transportation and more use of vehicles.Then came path finding algorithms, to
find the shortest distance between the nodes. Google, one of the top company in the world is the main provider
of maps which help us travel in daily life for everyone. The efficiency of the algorithms is very high, that’s what
makes it readily usable by everyone. In google maps, lot of path finding algorithms are used. Some of the path
finding algorithms are Dijkstra algorithm, Grid algorithm, A* algorithm. Google Maps uses A* algorithm for
finding the shortest path and alternating routes in real time. A* algorithm is an advanced form of Breadth first
search. It avoids costly paths and chooses the most promising path. It is a very smart algorithm. There are a lot
more constraints present in the google maps. The types of constraints are like time constraint, distance
constrained vehicle type (it shows route based on the type of vehicle like 2-wheeler or 4-wheeler). Google maps
is very better for the human needs. The way google maps routes the map is user friendly for a daily routine user.
Based on the distance and time constraint it shows the shortest and easy path. Google maps also takes calculate
the traffic present in the route. If there is more traffic, then it enroots the map. Finally, it makes the user to travel
easily. It shows the exact directions of the location, and it also gives the voice assistance for the route based on
the directions. But the path routing which we are doing in our project does not evaluate all those constraints. It
mainly focuses on the shortest path finding by distance constraint. Time constraint is not applicable. This path
routing algorithm is helpful for the smart needs in the home e.g., robots for working (this algorithm shows the
path that is needed for the robot to travel). we need to convert all the obstacles present in the home into a
grayscale format. The obstacles are captured and converted into the grayscale format. By the calculation of the
obstacles and many other we can route a shortest path for the robot. There are many applications of our project
in the daily life. Even the project is used for military applications also. A map is taken from the desired initial
position to the final position.
A*(A STAR) algorithm was first proposed by Peter Hart, Nils Nilsson and Bertram Raphael in the year 1968 at
Stanford Research Institute. Even though it is an extension of Dijkstra's algorithm it does not change the
complete structure. It also generates the two sets as Dijkstra that is a frontier and an explored set and uses these
for search on graphs. In every loop it moves a node from the frontier set to the explored set. The main difference
is A*(A star) moves the nodes with the lowest F value, whereas Dijkstra moves the node with lowest G value.
H: shortest path distance to the goal node, G: shortest path distance to the starting node and F: addition of both
H and G. The F values help us to identify the ranking order of the nodes in the frontier set. Based on the F value,
we can understand the cost of the path. This indicates that nodes having least of all F value is one which leads us
directly to the target node. To have consistency it should make sure that, if an edge is present between two of the
nodes. The difference in values of H values between those nodes are maintained such that they never exceed the
edge weight of the nodes. There are few terminologies to be known about A*(A STAR) algorithm to understand
how it works.
Node: All potential position or stops with a unique identification
Transition: The process of moving in between the nodes.
Starting Node: Initial point to start search
Goal Node: Destination/target node where search ends.
Search Space: A collection of nodes, similar to all the elements involved in a board game
Cost: Distance between a node and another node along the search path.
g(v): Represents the Exact cost between Starting node and any node v along the searched path.
h(v): Represents the Estimated heuristic cost between a node to the target node.
f(v): least cost in the adjacent node.
Each time A*(A STAR) enters a node, calculates effectively the cost of the path or route, f(n)(n being the
neighbouring node, to traverse to each and every adjacently placed nodes, and then enters the node which has
Further Jong-hyun Park and UK-Youl Huh proposed SGPP(save global path planning) combination of classical
A* with PRM (probability roadmap) algorithms. This helps to overcome the collisions at the corners and
turnings (even after use of sensors) by determining the hazardous points, risk distance and velocity control. Path
is generated using SGPP along with A* algorithm with minimum cost.They explained with a simulation and the
SGPP method showed superior performance to the other considered algorithms in terms of the safety cost and
navigation time[2]. Further Borenstein and Koren came up with a new collision free technique VFH method, In
which a two-dimensional Cartesian Histogram Grid is updated continuously and in real-time with range data
sampled by the onboard range sensors. The data in the Histogram Grid is reduced to a one-dimensional Polar
Histogram that is constructed around the robot's momentary location. This Polar Histogram represents the polar
obstacle density around the robot A sector with low obstacle density which is close to the target direction is
selected, and the robot's steering is aligned with that direction. They implemented and tested the VFH method
on a commercially available mobile platform (Cybermation, 1987), with best result [3]. Next T. Arai & J. Ota
proposed KRMP (Kinodynamic Randomized Motion Planning): They introduced the concept of motion
planning within dynamic robot networks that coordinate centralized planning. Each robot will have their own
network, whenever two or more robots enter each-others network they establish links among themselves (LAN)
to communicate with others. Each generates a new centralized paths and share among themselves among them
the best paths are opted and conformed. Then they start motion. It planned with a high probability of success,
even in cluttered environments involving robots, stationary obstacles and moving obstacles. Planning times of
less than 100 ms allowed the robots to re-plan in real-time and react quickly to changes in the environment[4].
Hasan Mujtaba & Dr. Gajendra Singh proposed a new technique combination of classical A* and virtual
objects have given satisfying results. In this method they employed a backtracking method from goal node to
starting node and by putting virtual stationary objects in the environment on a grid map. Simultaneously from
front and back helped the robot to travel along the collision free path. Size of the virtual objects plays a vital
role, if the size increases 98% of the collisions with the obstacles as well as with the other robots can be
overcome[5]. German A.Vargas et.al has proposed A* path planning algorithm using webot. The paper defines
initial or goal positions and obstacle avoidance using simulation environment and diagonal movement of a
mobile robot on cell decomposition platform [6]. Yudi Pratama and Wasolim have developed a mobile robot for
logistic transport of material in indoor. Wall following algorithm for a mobile robot has been used for the
transportation of material using the corner or sides of a room in navigation, the combination of sensor on robot
give the exact location of initial or target points. But does not satisfy the obstacle avoidance methods of a
mobile robot [7]. Jur van den Berg, Pieter Abbeel and Ken Goldberg wanted to solve the problem of path
planning in robots. They developed a technique LQG-MP(linear-quadratic Gaussian motion planning) which
characterizes in advance planning, the priori probability states of the robot on the path it is about to travel. The
results are reported using random trees(RRT) in the work done in this paper [8].
Shaung Liu, Dong sun and Changan Zhu saw the possibility of making multiple robots move in coordination
with each other along designed paths for them. While moving, they need to satisfy the formation requirement to
avoid collisions and meet parameters in movement such as velocity, acceleration. To achieve this they have used
linear interactive and general optimizer. The results are verified in simulation and experiments of group of
robots [9]. Hajduk and Marek Sukop presented some points on multiple robotic systems mainly focused on the
point of view of control. In such systems, they presented about a dynamic exchange of action of robots and their
strategic positions. This is purely implemented for the purpose of robotic soccer. The results for dynamic change
of agents while playing was brought out by software agents exchange control of robots [10].
From the literature survey, by observing all the problems and respective approaches to find a solution, showed
us to locate the problem first then to find a perfect solution for it. The main problem is finding the obstacles, as
we see to understand the working of the A*(A STAR), the algorithm is test run on simple 2D matrices of
different sizes and the results are observed. The inputs are the obstacles, vehicle position, target position. The
maximum time consumed is due to the time taken to give inputs to the program graphically with minimal human
error. Human error constitutes of errors such as wasting the time, unintentionally or intentionally, or delay in
understanding the instructions or delay in giving inputs to the code perfectly. This process is not so effective
when considered for bigger matrices or bigger problems.
To overcome this problem, there is an automatic obstacle detection equipped in the code, then and only then the
obstacles are found at faster rates that is at the rate of CPU. The CPU processing rate is must faster than the rate
at which humans give obstacles as inputs. The need for simulation of the path carried by the vehicle in the map
given as input can give a clear understanding of the implementation of A*(A STAR) algorithm in real life maps.
The inputs are real life maps and with the simulation, greater and precise results are achieved.
In the block diagram shown in figure 1, the program is written in matlab which fully implements a star
algorithm to find the optimal path. The image of the map is converted to grayscale format to detect obstacles
and understand the available space for the path planning. The locations are selected on the map graphically (the
nodes are selected). The path is formulated by calculating the shortest distance from the starting node to the
ending node. Output path is generated and the data is sent to unity. The whole program is simulated in unity 3d
by reading the data received from MATLAB.
MATLAB software is used for processing and formation of the path on the map using A*(A STAR) algorithm.
The MATLAB 2018b is used for execution of the code in the project. There are other versions as well, but
2018b offers stability and a chance to implement Simulink if needed. The software is used to manipulate the
map image and then use it with A*(A STAR) algorithm to find the shortest path between two locations. This
generates various variables and visually represented graphics which are quite helpful for the output of the
proposed system. When a map image is taken, it is of the form of RGB image. Detection of obstacles is slightly
difficult, so we convert the image to grayscale. When you open google maps, the maps shows different places
with names on it. These are called labels. These labels if contained in the image may arise logical errors of the
working of the project, so we need an image of the map without labels. This is possible from special websites
such as snazzymaps.com. From this website, we can get image of the maps without labels. As the input is in the
image format it is a RGB image. A*(A STAR) algorithm directly does not work on this RGB image, it would be
complex to find a path on it. So, to make our work simple we use an image processing technique i.e, Gray scale
conversion. This helps us to find a path on the image. Grayscale images are much easier to work within a variety
of tasks like in many morphological operation and image segmentation problems, it is easier to work with a
single layered image (Grayscale image) than a three-layered image (RGB colour image). It is also easier to
distinguish features of an image when we deal with a single layered image.
To convert RGB to grey there is a function called rgb2gray() in MATLAB. The three colours on a pixel are now
turns into a single value colour by calculating the weighted addition of all the three colour components. In figure
2, we can see that the conversion of the map image to grayscale, which is used to find the obstacles in the map.
“Vehicle.”
Following are the steps in the UNITY AND VISUAL STUDIO block:
1. Get data from MATLAB – The .csv file is accessed from the project folder by the Gridmaker.cs script
in unity when the code is run.
2. Process data and create 3D environment – The .csv file contains the MAP array, based on the values of
Figure 7:Output
:Output after execution of the code written in MATLAB
Figure 8:: Output after execution of the code written in MATLAB with different inputs
After the execution in MATLAB, the data is sent to unity. The data received is used for developing the
environment. The speed and the location of the vehicle are controlled from the code itself. The speed can be
altered during the execution of the scene, i.e in the game window. The secondary camera facing left depicts
Figure 9:: Simulation result of the above map in Unity in Game window with two perspectives
Figure 10:: Simulation result of the above map in Unity in Scene Window
VI. CONCLUSION
We can conclude from the above observations and results, which are graphically represented, which are
collected from MATLAB by the execution of the program. It is clear that the A star algorithm works perfectly
for grid maps which are of considerable sizes, that is the total number of nodes are visually understandable to
the user to be able to give the inputs graphically to form a path which is optimal.
optimal. The case where the number
of nodes in the matrix is far greater, manual effort increases. We can observe from the tables in the results of
the previous system that the time taken for the total execution increases with increasing number of obstacles.
The maximum time consumed is due to the time taken to give inputs to the program graphically with minimal
human error. Human error constitutes of errors such as wasting the time, unintentionally or intentionally, or
delay in understanding the instructions or delay in giving inputs to the code perfectly. These kinds of human
errors are terminated, and the time taken to give the inputs is considered which is the total time taken to
complete the process of finding the optimal path. It is observed that this time increases with increasing
number of obstacles and with increase in number of nodes in the map and only due to manual input. The
manual input from the mouse or joystick or keyboard is completely dependent on the person handling the
program, if human error is to be considered then the code takes a long time to complete. If the human makes a
mistake in giving an obstacle at a wrong position, the code must be run again. This wastes a lot of time. This
process is not so effective when considered for bigger matrices or bigger problems. As there is an automatic
obstacle detection equipped in the code, then and only then the obstacles are found at faster rates that is at the
rate of CPU. The CPU processing rate is must faster than the rate at which humans give obstacles as inputs.
This problem is overthrown in the proposed system and many other functionalities are added which make the
new system ready for implementation in real life projects such as Automatic Vehicle for different purposes.
The Simulation connection between MATLAB and unity is remarkably simple and not involving any servers
or tunnels or any such complications. The execution would be sightly smoother, but the output generated is
the same and the use of csv files helps us to see the values for ourselves and understand the system
extensively. In automation of vehicles or small robots in local areas, this proposed system can be used
accordingly, as it is easy to understand and easy to modify. The main advantage of the system is that even a
newbie can understand the working and they can modify according to their needs. For instance, a cleaning bot
in one’s room. The bot needs the map data of the room and the data about the obstacles to clean the room
precisely. This can be easily achieved by testing the bot through simulation after the execution of the program
in MATLAB. Furthermore, many automatic vehicles can be created for special purposes in warehouses or
such. There are many applications for the proposed system as the simulation part can detect many problems
before making a live prototype of the project.
VI. REFERENCES
[1] Richardo acatillo et.al “Implementation and assembly of a robotic module for mecabot-3 reconfigurable
system” International Journal of Applied Engineering Research 2016 vol-11 no.21 pp 10681- 10684
[2] Jong-Hun Park and Uk-Youl Huh “Path Planning for autonomous mobile robot based on safe space”
Journal Electrical Engineering Technology.2016; vol .11 pp1921-718
[3] Bornstein, J. and Y. Koren, Real-time obstacle avoidance for fast mobile robots. Systems, Man and
Cybernetics, IEEE Transactions on,1989. 19(5): p.p 1179-1187.
[4] P. E. Hart, N. J. Nilsson, and B. Raphael, “A formal basis for the heuristic determination of minimum cost
paths in graphs”, IEEE Transactions of Systems Science and Cybernetics. vol.4, no.2, pp.100-107, 1968
[5] German A. Vargas et.al “Simulation of e-puck path planning of Webot” International Journal of Applied
Engineering Research 2016 vol-11 no.19 pp 9772- 9775
[6] Yudi pratama & Wansu lim “Development application of indoor logistics transportation using amr”
International Journal of Applied Engineering research 2016 vol-11 no.20 pp 10183-10189
[7] LaValle, S. M., 2006. Planning Algorithms, Cambridge University Press, New York, USA. František
Duchoň et al. / Procedia Engineering 96 (2014) 59 – 69 69
[8] Van Den Berg, J., Abbeel, P., Goldberg, K., 2011. LQG-MP: Optimized path planning for robots with
motion uncertainty and imperfect state information. The International Journal of Robotics Research, 30(7), p.
895-913.
[9] Liu, S., Sun, D., Zhu, C, 2011. Coordinated motion planning for multiple mobile robots along designed
paths with formation requirement. Mechatronics, IEEE/ASME Transactions on, 16(6), p. 1021-1031.
[10] Hajduk, M., Sukop, M., 2009. Multiagents system with dynamic box change for Microsot. Progress in
Robotics: Communications in Computer and Information Science 44, p. 287-292.