Combining turning point detection and Dijkstra's ... - SAGE Journals

8 downloads 0 Views 2MB Size Report
In the second part, a modified Dijkstra's algorithm was used to turn vertices of convex-shaped ..... neighbor scan, and the previous pixel q is set as back-.
Research Article

Combining turning point detection and Dijkstra’s algorithm to search the shortest path

Advances in Mechanical Engineering 2017, Vol. 9(2) 1–12 Ó The Author(s) 2017 DOI: 10.1177/1687814016683353 journals.sagepub.com/home/ade

Ter-Feng Wu1, Pu-Sheng Tsai2, Nien-Tsu Hu3 and Jen-Yang Chen4

Abstract In this study, image processing was combined with path-planning object-avoidance technology to determine the shortest path to the destination. The content of this article comprises two parts: in the first part, image processing was used to establish a model of obstacle distribution in the environment, and boundary sequence permutation method was used to conduct orderly arrangement of edge point coordinates of all objects, to determine linking relationship between each edge point, and to individually classify objects in the image. Then, turning point detection method was used to compare the angle size between vectors before and after each edge point and to determine vertex coordinates of polygonal obstacles. In the second part, a modified Dijkstra’s algorithm was used to turn vertices of convex-shaped obstacles into network nodes, to determine the shortest path by a cost function, and to find an obstacle avoidance path connecting the start and end points. In order to verify the feasibility of the proposed architecture, an obstacle avoidance path simulation was made by the graphical user interface of the programming language MATLAB. The results show that the proposed method in path planning not only is feasible but can also obtain good results. Keywords Path planning, boundary sequence permutation method, turning point detection method, Dijkstra’s algorithm, obstacle avoidance

Date received: 31 May 2016; accepted: 17 October 2016 Academic Editor: Stephen D Prior

Introduction Mobile robot navigation involves finding a reasonable path in a limited working environment, to connect the initial configuration (including location point and azimuth angle) to the final configuration, and successful avoidance of the obstacle. Some recent literature works1–6 have discussed about this issue, and how to use image processing techniques to create an obstacle distribution model plays a key role in such matters. The turning point detection methods discussed in the literature can be broadly divided into two types: edge-based shape detection methods, which include Medioni– Yasumoto’s method,7 Beus–Tiu’s method,8 Rosenfeld– Johnston’s method,9 Rosenfeld–Weszka’s method,10 and weight type k-curvature method;11 these methods

calculate the curvature value at each point of the edge coordinates after edge detection processing, thus

1

Department of Electrical Engineering, National Ilan University, Yilan, Taiwan 2 Department of Electronic Engineering, China Institute of Technology, Taipei, Taiwan 3 Chemical Systems Research Division, National Chung-Shan Institute of Science and Technology, Taoyuan, Taiwan 4 Department of Electronic Engineering, Ming Chuan University, Taoyuan, Taiwan Corresponding author: Ter-Feng Wu, Department of Electrical Engineering, National Ilan University, No. 1, Sec. 1, Shennong Rd, Yilan City, Yilan County 26047, Taiwan. Email: [email protected]

Creative Commons CC-BY: This article is distributed under the terms of the Creative Commons Attribution 3.0 License (http://www.creativecommons.org/licenses/by/3.0/) which permits any use, reproduction and distribution of the work without further permission provided the original work is attributed as specified on the SAGE and Open Access pages (https://us.sagepub.com/en-us/nam/ open-access-at-sage).

2 determining the turning point of all objects in an image; and grayscale value–based detection methods.12 This article adopted Rosenfeld–Johnston’s method to detect the turning points in an image. The practice compares the angle of edge point vectors of each object to determine the position of the turning point and calculates approximate curvature values. So far, research on path planning has reached the mature stage. An optimal path can be found under conditions of known environment coordinates and complete road map of the obstacle distribution model. Most frequently cited methods include the following: (1) Potential fields method:13 This method mainly uses the principles that like magnetic poles repel and opposite magnetic poles attract to convert surroundings into a potential energy equation. The car and end goal are regarded as an attractive potential, and the starting point and obstacle as a repulsive potential. Attracted to the end, the car will successfully avoid obstacles and move toward the goal. (2) Cell decomposition method:14 This method divides free space outside the obstacle into simple areas, called cells. Description of the relationship between adjacent cells is referred to as network contact diagram. Traditionally, the shortest network path problem was solved using label correcting methods, label setting methods, and dynamic programming methods. According to different processing strategies, label correcting methods are divided into breadth-first search (BFS), depth-first search (DFS), best-first search, and other important methods.15 The single-source shortest path algorithm, Dijkstra’s algorithm proposed by EW Dijkstra16 in 1959, uses the strategy of best-first search to solve the shortest path. RE Bellman proposed dynamic programming9 to convert optimization into a series of single-step decisions, providing the best strategy for implementing a recursive solution in reverse from the last step to the initial step. (3) Analytical description of curves:17 This method is most widely used in path planning; its intuitive idea is to use analytic functions to approach any motion trajectory. The analytical description of curves directly establishes a mathematical model of obstacle avoidance path and can be used as a reference trajectory of the controller design, which drew the attention of many scholars. Analytic functions often cited in the literature include Cartesian polynomials, generalized polar polynomials, and Fourier harmonic functions. The main purpose of trajectory parameterization is to convert path planning into a matter of solving parameter optimization under certain constraints. First, the so-called cost function is defined as the shortest path, minimum energy, or least time, followed by the start point, end point, or some relay points as boundary conditions. The obstacle model is parameterized by the constraint conditions, and the engineering optimization algorithm

Advances in Mechanical Engineering is applied to calculate the trajectory parameter value of the analytic functions. (4) Vertices search method:18 This method is limited to a two-dimensional plane, and the obstacle shape is a convex polygon. The vertex plus start point and end point of all obstacles constitute the nodes of the network contact diagram, and the line segment between any two nodes constitutes a path in the network contact diagram; each path can be given a corresponding cost function, and the cost function of the forbidden path between obstructions is made infinite. Used with network path selection algorithms, including Dijkstra’s algorithm and dynamic programming method, whichever cost function produces the smallest collection of line segments is the shortest path from start point to end point. To provide obstacle detection in the environment, the Sobel edge detection boundary sequence arrangement of eight close neighbors search method was combined with Rosenfeld–Johnston’s corner detection method to detect all obstacles and the turning point in the image, and to construct an obstacle distribution model. Second, a convex-shaped anti-collision safety net was added on the boundary of each obstacle on the network, and a modified Dijkstra’s algorithm proposed in this study was used with the cost function for the shortest path to find an optimized obstacle avoidance path.

Turning point detection of polygon obstacles Grayscale conversion Each pixel in the color images captured by chargecoupled device (CCD) is composed of three bytes, which represent three kinds of color information, red (R), green (G), and blue (B). First, the grayscale conversion process was conducted on the input image to turn the color pixel into a 0–255 gray level value; 0 represents black and 255 represents white. The conversion formula is as follows Y = 0:299 3 R + 0:587 3 G + 0:114 3 B

ð1Þ

wherein Y is the converted gray level value.

Image binarization The so-called image binarization converts the gray level pixels through the selected threshold into value of 0 or 1. The purpose of image binarization is to segment the detection object and background information, which can significantly save memory space and image processing time. Image information is assumed to be a twodimensional matrix f (x, y), and the selected threshold is x. From the threshold calculation results, the f (x, y) value is converted into

Wu et al.

3  f (x, y) =

1 if f (x, y)  x 0 otherwise

ð2Þ

The Otsu algorithm can obtain the selection of best threshold.19 Figure 1. Search order of eight neighbors.

Edge detection The edge, which contains important image information, can be used to measure the object size in the image and recognize the object shape or carry out object classification. This article adopted the Sobel edge detection method; refer to correlation detection principle.19 The main function is to find edge coordinates of the image object. The corresponding pixel data f (x, y) are set as 1 and remainder as 0.

Figure 2. Eight-neighbor searching procedures.

Boundary sequential method The so-called orderly arrangement of edge point coordinates of all objects was conducted after edge detection. In addition, the linking relationship between each edge point was determined, and which edge points belonged to the same object and which edge points belonged to image noise were confirmed. Image information after binarization and edge detection was collected by scanning from left to right and from top to bottom. If pixel content is ‘‘0,’’ it is defined as background; otherwise, as prospects. The entire scanning process can be distinguished as two processes: object detection and edge point detection, which can determine at the same time the number of objects and the edge point coordinates each object contains. The ith edge point coordinates contained in jth object are defined as Pij = (xij , yij ), where j = 1, . . . , m, indicating the image contains m number of objects, while i = 1, . . . , nj , indicating jth object contains nj number of edge points. Therefore, the total number of edge points contained in the whole image is N=

m X

nj

ð3Þ

j=1

Once an object is detected in the scanning process, the edge point detection process begins. This article adopted eight-neighbor searching to find the edge point coordinates in sequence and record them in edge point collection Vj of the object. Based on this algorithm, repeated searching of the entire image was done, and finally all objects and edge point coordinates belonging to this image were obtained. The calculation process of the boundary sequential method is as follows: Step 1: First, detection scan of object is conducted. The detection of foreground pixels indicates the existence of objects; background pixels are ignored.

Then, edge point detection process in Step 2 begins. In this step, the foreground pixels found in the jth time are defined as edge point starting coordinates of the jth number of object, expressed as P1j , and recorded in the edge point collection Vj . Step 2: Based on the edge point starting coordinates Pij , (i = 1), the eight-neighbor coordinates are detected in counterclockwise direction. Refer to Figure 1 for its order. When a new foreground pixel is detected, i value is increased by 1. Coordinate points are recorded in edge point collection Vj . At this time, the new foreground pixel is regarded as reference point of the next eight-neighbor scan, and j is set to background data the previous pixel Pi1 (‘‘0’’). Step 3: If the edge of the object is a closed curve, Step 2 is repeated. When edge point coordinate Pij is equal to the starting coordinate Pj1 , that is, (xij , yij ) = (x1j , y1j ), edge point detection of a single object is complete. Step 4: The image often contains some minor noise. A threshold value Tb is defined for the number of edges to form an object. If the edge point pixel nj of the jth object is below threshold value, that is, nj \Tb , it is regarded as image noise. In this case, the object j and its edge point record should be deleted. Step 1 is repeated until scanning of all pixels in the image is complete. After that the process of the boundary sequence permutation method on all objects is complete. Figure 2 illustrates the eight-neighbor searching algorithm. The left icon is observed first. The detection of foreground pixels q in the scan indicates the presence of an object. The eight-neighbor searching algorithm then sequentially detects whether ‘‘1, 2, ., 8’’ are

4

Advances in Mechanical Engineering

edge point coordinates (or foreground pixels) of that object. Once checked, its next edge point is ‘‘3,’’ and its coordinates are immediately saved to the edge point collection of that object. The new foreground pixel 3 is regarded as the reference point q of the next eightneighbor scan, and the previous pixel q is set as background data, as shown in the diagram on the right.

Turning point detection method The discontinuous change in tangent direction of a certain point at the edge of an object is called the turning point. Rosenfeld–Johnston’s method3 was adopted in this study to detect the turning point in the image by comparing the angles between edge point vectors of each object to determine the position of the turning point. In order to calculate the more continuous approximate curvature value, as well as smoothly distinguish the angle of adjacent edge points, and prevent digitizing errors causing an erroneous turning point, this study introduced a smooth scaling k. The method is described below (hereinafter, indicator j is omitted). Aimed at the edge point coordinates Pi = (xi , yi ) of the same object, the smooth scaling k defined the front and rear edge point coordinates, respectively, and Pi + k = (xi + k , yi + k ). as Pik = (xik , yik ) Furthermore, the front and rear coordinates defined the so-called kvector ½aki , bki , wherein aki = (xi + k  xi , yi + k  yi ) and bki = (xik  xi , yik  yi ). By the cosine g ki of the angle between the two vectors aki and bki , the approximate curvature values were calculated as follows g ki = cos u =

aki  bki   kaki k  bki 

wherein  1  gki  1

ð4Þ

wherein k is a natural number, and the sampling length of the edge point has a smoothing effect, which can give the approximate curvature values of each edge point of the objects a more continuous effect. g ki stands for the cosine value of the angle formed by the front and rear two vectors of edge point coordinates. The closer the g ki value is to 21, the closer the u angle is to 180°, which means the region of this point becomes a more smooth straight line; the closer the g ki value is to 0, the closer the angle formed by the two vectors is to 90°. Likewise, the closer the g ki is to 1, the more acute the edge point angle. The design of the relevant parameters is stated as follows. Selection of k value. The k value selection affects the approximate curvature calculation results. As much as possible, a smaller k value should be chosen to reduce the number of points abandoned, so as to reduce the loss of information; however, too small a k value will cause curvature value deviation because of the impact

Figure 3. Smooth scaling used to reduce the impact of digitizing errors.

by digitizing errors; refer to Figure 3. Clemens et al.5 propose that the preferable range of k values for selection is 4–6; herewith, k value of 4 was selected in the simulation software. Different k values will affect the standard for judgment of the turning point. Curvature threshold (Tc ) calculation. The breakpoint of the object on the two-dimensional plane by k-curvature is detected by a sudden change of the angle in the tangent direction. When the approximate curvature value is greater than the threshold value (Tc ), the point is regarded as a turning point. Clemens et al.5 explain that the curvature threshold is determined by the following formula, wherein the C value in the simulation program is set to 1  k , Tc = cos 2  tan1 C

wherein C = 1;2

ð5Þ

Neighbor radius selection. As the computer image adopted the digitized images, digital image by binarization produced a series of non-continuous real points, leading to digitizing errors. As a result, some pixels neighboring the turning point will be identical, producing a curvature greater than the threshold value and multiple pseudo turning points. This study puts forward an adjacent interval practice, which uses the radius r to determine the interval range in which pseudo turning points may exist. When the area of the object is large, the number of edge pixels is greater; a larger value can be selected for r. Conversely, when the area of the object is small, a relatively smaller r value can be selected. Again, precision search was conducted in the radius range to further calculate the largest curvature values of the pseudo turning points; the real turning point is the point that we are looking for. Here, the simulation program is set to r = 6.

Obstacle objects distribution model Safety boundary design The obstacle avoidance path design is based on the vertices of the obstacle as graphical nodes to prevent the vehicle going over the vertex to collide with an obstacle,

Wu et al.

5

Figure 5. Safe boundary width design.

 max Rmin = r cot fmax  2b = r cot f  2 3=2 x_ (t) + y_ 2 (t) 1 = k(t) x_ (t)€y(t)  y_ (t)€x(t) Figure 4. The mobile robot’s turning restrictions.

introducing the security boundary design. Regardless of the appearance of the obstacle, a layer of protective nets was fixed on its border. In addition to security concerns, the concave-shaped obstacles were made convexshaped in appearance in order to meet the requirements of Dijkstra’s algorithm shortest path search. In the safety boundary design, the following two parameters must be considered: 1. Turning curvature restrictions: Consider the turning restrictions of the four-wheel mobile robot, as shown in Figure 4, wherein r is the wheelbase of the front and rear wheels, 2b is the width of the left and  are the deviation angles of right wheels, and f and f the two front left and right wheels. The Ackermann theorem explains that the moment the car turns, all wheel treads’ vertical lines will intersect at one point, which is called the instantaneous center of rotation (ICR). The relationship between the deviation angle of the left and right wheel can be deduced by the geometrical relationship in the figure cot f =

R + 2b , r

= cot f

R r

ð6Þ

By the deviation angle drive specification jfj  fmax ,  f  max , as well as the body geometric parameters, jfj the minimum turning radius when the body turns is determined as

ð7Þ ð8Þ

Assuming that the maximum angle of deviation of the actual vehicle is f( max ) = 258, the wheelbase is 1.5 m, and tread is 0.75 m, formula (7) calculates the minimum turning radius of the vehicle body to be about 2.4 m. Basically, the curve obtained by the path planning must be introduced with a limit of curvature called a reasonable motion trajectory. In order for the wheeled robot to be able to successfully turn, the curvature radius 1=k(t) of each point on the curve must be greater than the minimum turning radius of the wheeled robot. Given a two-dimensional smoothing curve S(t) = ½x(t), y(t) expressed with time parameter, curvature radius of each point in the curve can be expressed as  2 3=2 x_ (t) + y_ 2 (t) 1 = k(t) x_ (t)€y(t)  y_ (t)€x(t)

ð9Þ

In this way, the minimum turning radius specifications can be used to design the width of the obstacle safety boundary. 2. Boundary width design: The design of the safety boundary should not be too wide or too narrow. Too narrow will make collision with obstacles easy and fail to achieve safety protection; too wide will take up too much space to reach the demand of optimization. For example, Figure 5 illustrates how a car’s turning angle at 2u is used in the design of the obstacle boundary width L. In the figure, Rmin is the minimum turning radius when the car body turns and the car body length and width are ‘ and w, respectively. In addition, l is called the margin (or safety) width, that is, the safe distance for the vehicle body to turn to avoid tripping over

6

Advances in Mechanical Engineering

pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi obstacles. Herewith, we make l = ‘2 + w2 =2 equal to the entire length of the body diagonal. The safe boundary width design is Lmin = (m + l) sin u = Rmin (1  sin u) + l sin u

ð10Þ

wherein m = (Rmin = sin u)  Rmin Clearly, to make a car turn smoothly without colliding with an obstacle, boundary width L and turning radius of the vehicle are related to the turning angle.

Convex model of obstacle distribution This study proposed a modified Dijkstra’s algorithm, combined with the safety boundary concept, to directly use vertices of the convex-shaped obstacle as network nodes. Aimed at the nodes of each obstacle, the cost function assessment was conducted to search for the shortest path. The model information of the obstacles, including the working environment of the robot having m number of convex-shaped obstacles, was obtained by boundary sequence permutation method and turning point detection method. Each obstacle included ri (i = 1, ., m) number of vertices (or turning points), and its coordinates were expressed as Pij ( j = 1, 2, . . . , ri ). In order to effectively perform the shortest path search algorithms, the relevant environmental information was re-defined as follows: 1. Start point, vertices of each convex-shaped obstacle, and end points in total were k=

m X

ð11Þ

ri + 2

i=1

To form network nodes, start point coordinates were defined as D1 (x1 , y1 ), vertex coordinates of each obstacle were D2 (x2 , y2 );Dk1 (xk1 , yk1 ), and end point coordinates were Dk (xk , yk ). The coordinate vector was repressed as follows X = ½ x1

x2



xk  T ,

Y = ½ y1

y2



yk T ð12Þ

2. The distance between each network node forms a matrix called the distance matrix, defined as M(i, j) = dij = Di Dj =

qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi (xi  xj )2 + (yi  yj )2

ð13Þ

If obstacles between two network nodes cannot connect with each other, then the corresponding elements in the distance matrix M are defined as dij = ‘. 3. The cost function from the start point D1 to any network node Di is defined as ci , wherein i = 1;k. The cost function of the start point itself is defined as c1 = 0.

4. To search in a clockwise direction, all paths d d including Dd 1 Di , D2 Di , . . . , Di1 Di able to reach the Di node have a total of i  1 paths. The cost functions of each path are cji = cj + dji , j = 1, 2, . . . , i  1, respectively. From these possible paths, a minimum value is selected as the cost function ci = min (c1i , c2i , . . . , ci1 i ) from the start point to Di node. The node tag may be defined as L(i) = ½Dj , ci = cj + dji , wherein Dj is the so-called source node. 5. At the same time, the search path was also defined in a counterclockwise direction. Based on the Di node for network node Dp (p = 2, . . . , i  1), all Dp + 1 , Dpd Dp + 2 , . . . , possible paths including Dpd d Dp Di were searched in counterclockwise direction, totaling i  p paths. The cost function of counterclockwise search mode was expressed as c .

The forbidden path judgment It is assumed that the mobile robot moves in the R2 plane and all obstacles are of convex collection. Figure 9 illustrates the so-called forbidden path. Consider the distance between nodes D1 = (x1 , y1 ) and D5 = (x5 , y5 ). According to formula (13), the calculaqffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi tion should be (x1  x5 )2 + (y1  y5 )2 , but as obstacle O1 exists between two nodes, connection is impossible. The elements in the distance matrix should be modified to M(1, 5) = ‘. In order to effectively achieve this, this study proposed the judgment method of the forbidden path to decide whether or not the two nodes are connected. The most important task is to establish a complete obstacle model. First, we start from the definition of a collection of a straight line

L = D aT (D  D0 ) = 0

ð14Þ

wherein a 2 R2 is the perpendicular vector of this line, D0 = (x0 , y0 )T 2 R2 is any point on this line, and D = (x, y)T 2 R2 . Therefore, D  D0 and a are the two orthogonal vectors. The straight line represented by formula (14) can divide the R2 plane into two parts, as shown in Figure 6. aT D  b represents a half-plane (e.g. shaded) in the same direction with a vector, and aT D  b represents the half-plane in the opposite direction with a vector. The polygonal obstacle O in this study can be described by the above method, as shown in Figure 7. The obstacle is composed of r number of half-planes, and the normal vectors a1 , a2 , . . . , ar of each linear equation L are outwardly defined. The obstacle model can be expressed as follows







O = D aT1 D  b1 \ aT2 D  b2 \    \ aTr D  br ð15Þ

Wu et al.

Figure 6. Indication of linear equation cutting plane.

7

Figure 8. Using detection point for discrimination of forbidden path.

Step 4: Any two nodes Da and Db were taken for illustration, so as to determine whether the two nodes connected. From the initial node Da to the destination node Db , the corresponding x coordinate is increased by 1 in sequence, that is, from xa + 1 to xb  1. Through the slope obtained in Step 3, all corresponding y coordinates were found and these points were called detection points, as shown in Figure 8. Dt = (xt , yt )T was assumed to be a detection point; when it simultaneously satisfied the following ri number of conditions



a1i Dt  b1i \ a2i Dt  b2i \    \ ðari i Dt  bri i Þ,

i = 1, 2, . . . , m Figure 7. Indication of polygon obstacle model.

wherein ‘‘ \ ’’ stands for the significance of ‘‘and.’’ The use of the polygon obstacle model (Figure 7) is conducive to the resolution of the problem whether or not the forbidden path lies between two nodes. The judgment criterion and the relevant steps are stated as follows: Step 1: Via the turning point detection, the vertex coordinates of each obstacle were found to be Pij (j = 1, 2, . . . , ri ). Step 2: For the two turning points of each obstacle (called vertices), a linear equation was determined. For example, in the ith obstacle, formula (14) using P1i P2i , P2i P3i , . . . , Pri i P1i , respectively, determined L1i , L2i , . . . , Lri i number of equations. Furthermore, formula (15) obtained the geometric model Oi of the obstacle, wherein i = 1, 2, . . . , m. Step 3: Regarding the start point, vertices of all obstacles, and end points in the image as network nodes D1 ;Dk , using the vector of the coordinates of each point, the distance and slope between all network nodes are easily calculated. However, the judgment of the forbidden path confirmed whether or not the two nodes connected, that is, whether or not there was an obstacle between two nodes.

then it was called the detection point Dt , which fell in the range covered by the polygonal obstacle Oi . Then, the two nodes Da and Db were not connected, and the distance matrix was M(a, b) = ‘.

Modified Dijkstra’s algorithm Consider k number of network nodes D1 ;Dk during evaluation of the cost function of a node. This article applied two-way search skills to propose a modified Dijkstra’s algorithm, divided into two modes of clockwise search and counterclockwise search. First, the cost function of the start point D1 was set as 0, namely, c1 = 0. Followed by calculation of the cost function of D2 node, a search was conducted in the forward mode. Its only path was Dd 1 D2 , so the forward mode cost function was c2 = c1 + d12 , and the node tag was defined as L(2) = ½D1 , c2 = c1 + d12 . Following consideration of d D3 nodes, the two paths Dd 1 D3 and D2 D3 were compared to determine node tag L(3) with cost function of shortest path. Each node Di (i = 2;k) in the forward mode was sequentially evaluated, and the node was marked and defined as L(i) = ½Du , ci = cu + dui , wherein Du indicates the source node of Di . To evaluate the cost function in the forward mode, consider only

8

Advances in Mechanical Engineering

Figure 9. Modified Dijkstra’s algorithm hand count process.

the path of a smaller mark, Di node. For example, consider only the path Dd j Di (j = 1, 2, . . . , i  1). In the forward search process, once the cost function of Di node is found to be much smaller than last node Di21, it means a shorter path may appear in the start reverse search from Di. In this case, the algorithm will be changed to reverse search, the cost function of all previous nodes must be re-evaluated in counterclockwise direction, and compared to the result of the forward search, the shortest path to reach the target of total field search is re-determined. For example, in the reverse search mode of Dp nodes, all possible paths including Dp + 1 (q = p + 1;i) leading to the Dp node are evalDpd uated with the minimum cost function to get cp = cv + dvp , which indicates that Dv is the source node of Dp reverse search. After path searching through the two modes, comparison at the end showed the forward mode or reverse mode can achieve optimal path planning. The event cp \cp means the forward mode can find a path with a smaller cost function, and the Dp node tag remains unchanged. The event cp .cp means the effect of reverse search is better than the original, and the original node tag must be corrected as L(p) = ½Dv , cp = cv + dvp . The cost function of each node was calculated according to the above process, and a complete forward and reverse search evaluation was conducted in order to update the network tag of all nodes. Finally, from the node tag of end point Dk, the source node was searched for in order until start point D1. Connecting D1, the relay node, and Dk constitutes the so-called shortest path. After execution, c is smallest element value in the xvector; I is the indicator value of the smallest element located in the x-vector. Figure 9 shows two obstacles, O1 and O2 , respectively. After the turning point detection image

processing, all network vertex coordinates were D1 = (0, 0), D2 = (5, 5), D3 = (3, 9), D4 = (5, 13), D5 = (10, 13), D6 = (12, 9), D7 = (10, 5), D8 = (14, 15), D9 = (13, 16), D10 = (17, 23), D11 = (19, 23), D12 = (23, 16), D13 = (22, 15), and D14 = (25, 25). This study proposed a modified Dijkstra’s algorithm to search for the shortest path from start point D1 to end point D14 . The table on the right shows the hand count process for each network node. Worth noting are nodes D6 and D12 . A reverse search found that when source nodes were D7 and D13 , it obtained the cost function with the shortest path. Of course, this is due to the cost functions c7 \c6 and c13 \c12 . The node tag of end point D14 was found from its source node D12 , and search forward in sequence until initial node D1 was then conducted from node tag D12 . The shortest path was found to be D1 ! D7 ! D13 ! D12 ! D14 .

Simulation results Case 1 Using the programming language MATLAB 7.0, the proposed boundary sequence permutation of this study and the turning point detection algorithm were used to conduct simulation validation; Figures 10 and 11 illustrate the processing results of the turning point detection method, and Tables 1 and 2 record the comparison of the turning point actual coordinates and the actual detection results of the algorithms. First, the boundary sequence permutation of objects was used to complete the recording of the number of objects in the image and the edge point permutation coordinates of each object. Then, the turning point detection algorithm was used to identify the point of curvature value greater than threshold value, Tc . This point is likely the turning

Wu et al.

9 turning point. The turning point detected in the figure was depicted with a circle on the edge of the object for easy identification. In addition, the digital images generated digitizing errors, so we inevitably had 0;3 pixel errors in the detection process; refer to Tables 1 and 2. The experimental results suggest that the method proposed in this study not only has a good effect of turning point detection but also has a high practical value.

Case 2

Figure 10. Polygon images.

Figure 11. Star images.

point that we want to detect. Finally, through the selection of the neighbor radius r to filter the pseudo turning point, the maximum curvature value from the adjacent interval was found in order to determine the real

The MATLAB graphical user interface (GUI) toolbox was used to write the simulation software for obstacle avoidance paths, performed under a 2.8-GHz Pentium 4 processor. This study proposed the combination of boundary sequence permutation method, turning point detection method, forbidden path detection method, and modified Dijkstra’s shortest path search in a multifunctional integrated window. The image captured by the CCD or the users’ own selection set the obstacle distribution in the environment model. For example, the working interval in Figure 12(a) shows the coordinates of the starting point to be (0, 0) and the end point coordinates (25, 25). The user selected a triangular obstacle with a central point at (10, 5) and a radius of 3, a pentagonal obstacle with a central point at (15, 15) and a radius of 3, and a hexagonal obstacle with a central point at (20, 20) and a radius of 2. The goal was to design the shortest path curve from the start point to the end point coordinates. The turning point detection algorithm of image processing obtained a total of D1 ;D19 number of network nodes. By the path planning button, the modified Dijkstra’s algorithm derived the shortest path D1 ! D9 ! D15 ! D19 , as shown in Figure 12(b). Figure 13(a) slightly moved the pentagonal obstacle to the left, making the center point at (12, 15). Interestingly, the path planning result turned out to be very different. The shortest path became

Table 1. Comparison table of actual and detected coordinates of the polygon images’ turning points. Polygon image (320 3 200) Turning point

1 2 3 4 5

x y x y x y x y x y

Object 1

Object 2

Object 3

Object 4

Object 5

Actual

Detected

Actual

Detected

Actual

Detected

Actual

Detected

Actual

Detected

31 23 31 75 131 75 131 23

32 24 33 77 133 75 132 24

215 59 215 113 299 113 299 59

216 60 217 115 301 113 300 60

153 84 112 125 153 166 194 125

154 85 113 126 154 167 195 126

254 135 205 170 224 227 283 226 302 170

254 136 206 171 226 228 285 226 303 172

41 158 41 226 110 226 110 157

42 158 43 228 112 226 111 158

10

Advances in Mechanical Engineering

Table 2. Comparison table of actual and detected coordinates of the star images’ turning points. Star image (1024 3 768) Turning point

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

x y x y x y x y x y x y x y x y x y x y x y x y x y x y x y x y

Object 1

Object 2

Object 3

Object 4

Object 5

Actual

Detected

Actual

Detected

Actual

Detected

Actual

Detected

Actual

Detected

733 41 698 149 583 150 676 218 641 328 734 260 827 327 791 218 884 150 769 150

735 43 700 149 585 152 675 218 643 327 735 261 826 327 793 219 884 152 771 151

149 54 132 84 96 85 113 114 96 146 132 146 149 176 166 146 202 146 185 117 202 85 166 84

149 56 131 86 97 87 114 115 97 146 132 148 150 177 168 147 202 146 186 118 202 88 167 85

404 158 382 196 337 197 359 235 337 274 382 275 404 314 426 276 471 275 451 239 471 199 427 197

404 160 382 198 338 199 360 237 338 275 383 277 405 314 428 276 472 275 451 239 471 198 427 197

245 361 203 488 65 491 176 572 134 700 244 622 355 702 315 570 424 491 287 491

246 364 204 491 67 493 177 574 136 700 244 623 354 701 314 573 424 493 288 492

758 381 706 432 631 433 631 507 579 559 631 611 631 685 706 686 757 737 809 686 884 685 884 611 936 559 885 508 884 433 810 433

758 382 706 432 632 435 631 509 580 560 632 612 634 687 708 688 758 738 810 687 885 685 886 611 937 560 885 508 884 434 810 433

Figure 12. (a) Obstacle distribution and (b) path planning results.

Wu et al.

11

Figure 13. (a) Obstacle distribution and (b) path planning results.

D1 ! D4 ! D12 ! D11 ! D14 ! D15 ! D19 , as shown in Figure 13(b).

Conclusion The main purpose of this study is to identify and avoid obstacles using images to plan out the shortest and smoothest obstacle-avoiding path. Through the boundary sequence permutation method and Rosenfeld– Johnston’s turning point detection algorithm, all the turning point coordinates of the object were measured. The modified Dijkstra’s algorithm was used to find an obstacle-avoiding path connecting the start point, turning point of the obstacle, and end point. Compared with the traditional method, the method proposed achieved the goals of global search by forward and reverse modes. To direct future improvements, the discovery of digitizing errors through the simulation process is an important factor affecting detection results. Authors note Pu-Sheng Tsai is now affiliated to Department of Electronic Engineering, China University of Science and Technology, Taipei, Taiwan.

Declaration of conflicting interests The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.

Funding The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: The authors would like to thank the Ministry of Science and Technology of the Republic of China, Taiwan, for financially supporting this research under Contract No. MOST 105-2221-E-197-021.

References 1. Mortaza ZA, Ali S, Siti ZMH, et al. Modeling of route planning system based on Q value-based dynamic programming with multi-agent reinforcement learning algorithms. Eng Appl Artif Intel 2014; 29: 163–177. 2. Mortaza ZA, Ali S and Siti ZMH. Route planning model of multi-agent system for a supply chain management. Expert Syst Appl 2013; 40: 1505–1518. 3. Andreas B, Mina K, Kostas A, et al. Three-dimensional coverage path planning via viewpoint resampling and tour optimization for aerial robots. Auton Robot 2016; 40: 1059–1078. 4. Ahmed HQ and Yasar A. Potential functions based sampling heuristic for optimal path planning. Auton Robot 2016; 40: 1079–1093. 5. Clemens J, Reineking T and Kluth T. An evidential approach to SLAM, path planning, and active exploration. Int J Approx Reason 2016; 73: 1–26. 6. Chen Y, Yu J, Mei Y, et al. Modified central force optimization (MCFO) algorithm for 3D UAV path planning. Neurocomputing 2016; 171: 878–888. 7. Medioni G and Yasumoto Y. Corner detection and curve representation using cubic B-splines. Comput Vision Graph 1987; 58: 267–278. 8. Beus HL and Tiu SSH. An improved algorithm based on chain-code plane curves. Pattern Recogn 1987; 20: 291–296. 9. Rosenfeld A and Johnston E. Angle detection on digital curves. IEEE T Comput 1973; 22: 875–878. 10. Rosenfeld A and Weszka JS. An improved method of angle detection on digital curves. IEEE T Comput 1975; 24: 940–941. 11. Liu ML. Using K-curvature method for 2D object break point detection. Master’s Thesis, Institute of Industrial Engineering and Management, Chaoyang University of Technology, Taichung, Taiwan, 2000. 12. Cheng F and Hsu W. Parallel algorithm for corner finding on digital curves. Pattern Recogn Lett 1988; 8: 47–53. 13. Ge SS and Cui YJ. New potential functions for mobile robot path planning. IEEE T Robotic Autom 2000; 16: 615–620.

12 14. Palma-Villalon E and Dauchez P. World representation and path planning for a mobile robot. Robot 1988; 6: 35–40. 15. Bertsekas DP. Dynamic programming and optimal control. Nashua, NH: Athena Scientific, 1995. 16. Dijkstra EW. A note on two problems in connexion with graphs. Numer Math 1959; 1: 269–271. 17. Paolo G and Alessandro G. A technique to analytically formulate and to solve the 2-dimensional constrained

Advances in Mechanical Engineering trajectory planning problem for a mobile robot. J Intell Robot Syst 2000; 27: 237–262. 18. Keirsey DM, Koch E, McKisson J, et al. Algorithm of navigation for a mobile robot. In: Proceedings of the IEEE international conference on robotics and automation, Atlanta, GA, 13–15 March 1984, vol. 1, pp.574–583. NewYork: IEEE. 19. Zhong GL. Image processing and computer vision. Taipei, Taiwan: Tung-Hua Press, 2012.

Suggest Documents