In this project, we will explore real-time path planning in the grid-based environment for autonomous robots using only one ultrasonic sensor to detect obstacles and re-design the path i
Trang 1Hanoi University of Science and
Member:
Tran Ngoc Danh Chinh 20208002
Trang 2In this project, we will explore real-time path planning in the grid-based environment for autonomous robots using only one ultrasonic sensor to detect obstacles and re-design the path if encounter obstacles.
Our algorithm will be tested on a 6x6 grid environment due to the limit of technological components and storage capabilities of microcontroller which
is ARDUINO UNO Also, we are going to build a robot that can perform very simple movements which are moving forward, backward, turning left or right ,all movements will be in the same distance to maintain the size of each grid
The aim of the project is to acknowledge the academic algorithm and to gain experience to implement them in realistic products
Trang 3I Introduction.
II General concept.
III Required components.
Trang 5II General concept
Pathfinding or pathing is the plotting, by a computer application, of the shortest route between two points It is a more practical variant on solving mazes This field of research is based heavily on Dijkstra's algorithm for finding the shortest path on
a weighted graph
Pathfinding is closely related to the shortest path problem, within graph theory, which examines how to identify the path that best meets some criteria (shortest, cheapest, fastest, etc) between two points in a large network
-Some of the best-known methods is Dijkstra’s algorithm, which computes the cost of going through a cell, and every cell surrounding the current position, until it reaches the goal position A second familiar method is the A-Star, improved this intensive search by adding a heuristic constant that directs the search only towards cells that are in the direction of the goal position A third way, the D-Star, further improved the search process by adding a second heuristic to minimize the recalculation in case of meeting unforeseen obstacles A fourth less-known, AD-Star uses an inflation factor to get to a sub-optimal solution quickly, meeting real-time requirements
-Out project will apply the A* algorithm which is commonly used in games as mentioned previously A* is a search or pathfinding algorithm that will formulate weighted graphs
by starting from a specific staring node of a graph, and its mission is to find a path to thegiven destination or goal node at the smallest cost A* assigns a cost to each open nodeequal to the cost of the edge to that node plus the approximate distance between that node and the finish This approximate distance is found by the heuristic, and represents
a minimum possible distance between that node and the end This allows it to eliminate longer paths once an initial path is found If there is a path of length x between the start and finish, and the minimum distance between a node and the finish is greater than x, that node need not be examined
-Explanation Consider a square grid having many obstacles and we are given a starting cell and a target cell We want to reach the target cell (if possible) from the starting cell
as quickly as possible Here A* Search Algorithm comes to the rescue What A* Search Algorithm does is that at each step it picks the node according to a value- ‘f’ which is a parameter equal to the sum of two other parameters – ‘g’ and ‘h’ At each step it picks the node/cell having the lowest ‘f’, and processes that node/cell We define ‘g’ and ‘h’ assimply as possible below
g = the movement cost to move from the starting point to a given square on the grid, following the path generated to get there
h = the estimated movement cost to move from that given square on the grid to the final destination This is often referred to as heuristic, which is nothing but a kind of smart guess We really don’t know the actual distance until we find the path, because all sorts
of things can be in the way (walls, water, etc.) There can be many ways to calculate this ‘h’ which are discussed in the later sections
Trang 6Last but not least, A* should be also admissible and is related to the path efficiency or cost previously mentioned Optimal efficiency is the classification of the algorithm being able to determine a set of possible solutions from the expansion of each node making it
a set of nodes in order to find the most efficient path Since every movement opens a new set of nodes, the algorithm is expected to connect the nodes and make a decision that is proved to be optimal points (origin and destination) It is commonly used when solving mazes to judge or determine its efficiency and speed Most path finding algorithms rely on trying to solve the shortest path problem in graph theory Graph theory is a mathematical structure used to model pairwise relationships between objects
A graph consists of nodes/vertices/points that are connected edges/links/lines shown below is an example
Trang 7The letters and numbers in the circles represent the nodes name and status respectively The number on every line connected to each node represents the cost to move from one node to another.
Trang 8III Required components.
1 Electrical component
i Arduino Uno
Arduino UNO is a microcontroller board based on the ATmega328P It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHzceramic resonator, a USB connection, a power jack, an ICSP header and a reset button It contains everything needed to support the microcontroller
ii Geared Motor GA12-N20 200 RPM
Trang 9Name: GA12-N20 DC Geared Motor
Encoder Test Wire Length: 150mm
Shaft Size: 3mm x 9mm
Output Shaft type: D type
Total Size: 40 x 12 x 17mm
iii L298N MOTOR DRIVER BOARD
The L298N is a dual H-Bridge motor driver which allows speed and direction control of two DC motors at the same time
iv. Two 12V DC MOTORS
Trang 10 Measuring Angle: 15 degree
Trigger Input Signal: 10µS TTL pulse
Echo Output Signal Input TTL lever signal and the range in proportion
Dimensions: 45 * 20 * 15mm
vi PWM speed controller module
Trang 11vii Battery source
viii Bread board
Trang 122 Mechanical components:
i Fomex:
ii Chassis
Trang 133 Circuit Diagram
Trang 144 Final product
Trang 15IV Problem analysis and development
4.1 Problem analysis
- During the research for this project, there are two main problems that we have to solve
o How to localize the mobile robot
o How to detect and avoid obstacles
- The mobile robot should be able to design an optimal path from the current position
to the given destination
- When encountering an obstacle, the robot can re-generate the path to the goal point that user has set before
- The user can observe the path that the mobile robot generates in senior monitor after entering the target point
4.2 Development
4.2.1 A* algorithm
1.We created two lists: OPEN List and CLOSE List
OPEN: consists of nodes that have been visited but not yet expanded (the robot has not been explored)
CLOSE: consists of nodes that have been visited and already expanded (the robot has explored already and stored in the open list
2.put the starting node on the OPEN list (you can leave its f at zero)
3.while the open list is not empty
3.1 find the node with the least f on the open list, call it "q"
3.2 pop q off the open list
3.3 generate q's 8 successors and set their parents to q
3.4 for each successor
If successor is the goal, stop searching
Else, check for obstacles
If yes, then re-path by checking OPEN and CLOSE list Else compute both g and h for successor Successor.g = q.g + distance between successor and q Successor.h = distance from goal to successor (This can be done using many ways, we will discuss three heuristics-Manhattan, Diagonal and Euclidean Heuristics)
successor.f = successor.g + successor.
If a node with the same position as successor is in the OPEN list which has a lower f than successor, skip this successor
If a node with the same position as successor is in the CLOSE list which has a lower f than successor, skip this successor otherwise, add the node to the open list
End (for loop)
3.5 push q on the closed list
end (while loop)
Trang 16So, suppose as in the below figure if we want to reach the target cell from the source cell, then the A* Search algorithm would follow path as shown below Note that the below figure is made by considering Euclidean Distance as a heuristic.
We can calculate g but how to calculate h ?
Here we use Manathan distance heuristics function to calculate value of H
H=abs (current_cell.x – goal.x) + abs(current_cell.y-goal.y)
Trang 17Snapshot of Arduino code for H and G calculation and the sum FV
Trang 18Re-path Plan code
By using Ultrasonic-sensor HC-SR04 the robot will be capable of detecting obstacle while working, if the distance from the robot to the obstacle is below 30 the robot will automatically re-generate the optimal path and keep on moving until the goal is reached
Trang 19As can be seen, the robot will list the optimal path and perform movements to achieve the goal point It also presents the distance that is measured by ultrasonic sensor in specific position.
Trang 20We tested our prototype in well-known environments in the video shown above and the dimensions of abstract grid 30cmx30cm
As we can see, the robot has achieved:
+Successfully generate the optimal path to move from initial point to goal point.+Successfully re-design the path when encountering obstacles
Trang 21On the other hand, another problem that we must solve is motor drifting Although we limit the speed of motor and the size of grid, the robot still drifts oversteps due to voltagecontrol There are two efficient solutions that we think will enhance the results that are using stepper motor with high accuracy of rotation angle and high capability of providingtorque at low speed, the other method is applying PID control which is commonly equipped in high end robot
In summary, our robot meets the requirements that set at the beginning and solve the problem of applying Path planning algorithms in autonomous robot Thus, it needs implementing essentially function such as wireless control and PID control
Trang 22A* Search Algorithm - GeeksforGeeks
Ví dụ chi tiết cho giải thuật A* (A star) - Mạnh 60PM1 - YouTube
Step by step Guide: A* algorithm | A star for 2D Path Planning - YouTube
Giải thuật tìm kiếm A* – Wikipedia tiếng Việt
A* algorithm explanation with example - YouTube
jeremiahe00/A-star-PathFinding -Makeblock-Mbot -Arduino: Mbot uses A* algorithm in order
to perform path finding (github.com)