Chapter 5 Planning of Optimal Randomized Patrolling Paths for Vehicles
5.3 Calculation of Optimal Randomized Patrolling Paths by Finding
5.3.2 Proposed technique for generation of complete patrolling paths
generation of complete patrolling paths
Because every monitoring point is visited only once in a session, we transform the path planning proposed into the traveling-salesman problem. Some assumptions are made:
(1) all monitoring points are contained in a set V;
(2) each pair of vertices in the set V has an edge between them and all edges are contained in a set E;
(3) a complete undirected graph G is composed of the set V and the set E; and (4) a cost c(u, v) associated with the edge (u, v) is the distance between the
monitoring points u and v.
If two monitoring points belong to different rectangular regions, the distance between them is calculated by Dijkstra’s algorithm described in Section 5.2; else, it is the
78
straight line distance.
As an example, a patrolling environment is shown in Figure 5.10, in which M1
through M4 are monitoring points, and N1 through N5 are turning points. Furthermore, each black edge connects two points which are in an identical rectangular region and each blue edge connects two monitoring points which are also in the same one. All distances between pairs of monitoring points and turning points passed by them are recorded in a table, as shown in Table 5.1.
N1
Figure 5.10A patrolling environment.
Then, we transform the graph in Figure 5.10 into another, as shown in Figure 5.11.With the complete undirected graph G and all costs associated with the edges, we can find an optimal patrolling path. Because the vehicles do not return to the start position in this study, the path is exactly a Hamiltonian path with the minimum cost.
The result of Figure 5.11 starting at M1 is M1 Æ M3 Æ M4 Æ M2. And then integrating the information of Table 5.1 into the path, we get the final result as M1 Æ M3 Æ M4
Æ N4 Æ M2. The algorithm of generating an optimal patrolling path is shown below.
Table 5.1 Distances and passing turning points between every pair of monitoring points.
M1 M2 M3 M4
M1 37 13 16.5
79
Figure 5.11 A complete undirected graph G = (V, E).
Algorithm 5.3 Generation of an optimal patrolling path.
Input: All monitoring points, a table T containing all distances and passing turning points between all pairs of monitoring points, and a position P where the vehicle starts at.
Output: An optimal patrolling path from P.
Steps:
Step 1. Read the distance between each pair of monitoring points from T and each of them is exactly the cost c(u, v) associated with the edge (u, v) .
Step 2. Find a Hamiltonian path with the minimum cost from P in the patrolling environment containing all MPs.
Step 3. Merge turning points into the Hamiltonian path obtained from Step 2, by Table T.
In this study, the number of vehicles used to perform the patrolling task is more than one. Therefore, all monitoring points are divided randomly into groups for each
80
vehicle to patrol. The rule of choosing monitoring points randomly has been described in Section 4.2.1. By performing Algorithm 5.3 individually, the optimal randomized patrolling paths for all vehicles can be obtained. However, we set a threshold parameter T to restrict the differences of the patrolling distances for the property of load balancing among vehicles. If the condition is not satisfied, all monitoring points will be chosen and Algorithm 5.3 performed again.
81
Chapter 6
Collision Avoidance between Vehicles
6.1 Introduction
In this study, an assumption made is that no unexpected obstacle exists in the patrolling environment. However, the security patrolling task is performed by multiple vehicles, it is necessary to ensure no collision among vehicles. Many methods about collision avoidance among multiple vehicles have been proposed, such as by cell decomposition [18], using a probabilistic model [19], or based on multilayered cellular automata architecture [20], etc.
Because only two vehicles are used in the experiment of this study, we can solve the problem by keeping a fixed distance Dis between two vehicles. If the distance between the vehicles is smaller than Dis, their patrolling paths must be changed. By the way, it is noted that collision avoidance between the vehicles is real-time and this is good for the property of random patrolling paths. Furthermore, the calculating time is short. If the number of the vehicles is more than two, the collision avoidance technique will need more consideration and this can be one of the further works.
6.2 Detection of Collisions
Because vehicles are located constantly by the top-view omni-cameras, the odometer values are credible. Therefore, the values are utilized to compute the
82
distance between two vehicles in every cycle of a fixed time duration. If they are too close, their paths will be changed by inserting some passing points. By these points, the distance between the two vehicles can be drawn apart.
For collisions, there are two different states. We only consider the section of the assigned patrolling path from the current positions to the goals, turning points or monitoring points, where the vehicles are moving to. If the two sections have an intersection, this state is called path-intersecting; else, it is the state of non-path-intersecting. The proposed collision avoidance techniques are described in Section 6.3.
6.3 Proposed Collision Avoidance Techniques
6.3.1 Collision avoidance on intersecting paths
In the state of path-intersecting, we let the two vehicles keeping a fixed distance.
Assume that the first vehicle is at position V11 = (x11, y11) and the other is at position V21 = (x21, y21). Additionally, assume that they are moving to the goals G1 = (gx1, gy1) and G2 = (gx2, gy2), respectively. At first, we calculate the intersection I in the two paths by the parametric forms. Each parametric form with respect to the path from the current position to the goal is shown in Eq. (6.1) below:
83
The point I can be obtained by solving the simultaneous equations of “x1 = x2” and “y1
= y2”. Then, assume that the distance between V11 and I is smaller than the distance between V21 and I, as shown in Figure 6.1, and so the path of the second vehicle must be changed.
Figure 6.1 An intersection I on the paths of two vehicles.
Because the first vehicle moves along the original path, we can forecast the position V12 = (x12, y12) at the next moment. If the velocity of the vehicle is vel and the time interval of calculating the distance between vehicles is t, then V12 can be calculated by Eq. (6.2) below:
12 11 1 11
Because the vehicles must keep a distance Dis to each other, we can say that the passing point V22 of the second vehicle is on a circle C whose center is V12 and whose
84
radius is Dis. To calculate V22, we must acquire the projection point V21’ of V21 on the circle C, at first. The reason is that the distance between V21 and V22 is desired to be not too long. So we utilize an included angle θ between V21’ and V22 on C to acquire
Therefore, the projection point V21’ can be calculated by Eq. (6.4) as follows:
2 2 2
21 2 21 12 21 2 21 12
(x +(gx x s x- ) - ) +(y +(gx x s y- ) - ) =Dis . (6.4)
As long as the value s is solved, V21’ is obtained. Then, we calculate the angle θ21’ of V21’ from the positive direction of the x-axis. Because C can also be represented as Eq.
(6.5) below, we can calculate θ21’ by Eq. (6.6) below: points a or b as shown in Eq. (6.7), called candidate passing points:
12 21'
Furthermore, it is desired that the distance between V22 and G1 is bigger. The reason is that the distance between the two vehicles can be drawn apart. Therefore, if
85
point a is closer to G1 than point b, V22 will be exactly the point b. As the passing point V22 is obtained, the patrolling path of the second vehicle is changed from V21 Æ G2 to V21 Æ V22 Æ G2.
It is possible that the alternative path may exceed the walkable range. If this is the case, then the path must be changed again. In general, there are three unallowable states:
(1) the passing point P is in the outer region as shown in Figure 6.2;
V G
Walkable Region R P
P1 P2
Figure 6.2Passing point P is in the outer region.
(2) the path from the current position V to the passing point P exceeds the walkable range as shown in Figure 6.3; and
Walkable Region
V G
Walkable Region R P
P1 P2
Figure 6.3 The alternative path is not feasible.
(3) the path from the passing point P to the goal G exceeds the walkable range as shown in Figure 6.4.
86 Walkable Region
V G
Walkable Region R P
P1 P2
Figure 6.4 The alternative path is not feasible.
For these states, the rectangular region which the passing point P belongs to is not equal to the one R which both V and G belong to. Therefore, we calculate the intersections of the region R and the alternative path V Æ P Æ G. Finally, the patrolling path is taken to be V Æ P1 Æ P2 Æ G. The algorithm of checking and finding a feasible alternative patrolling path is shown in the following.
Algorithm 6.1 Checking and finding a feasible alternative patrolling path.
Input: All rectangular regions Re, the passing point P, the front point F (the current position V or another passing point) of P, and the goal G.
Output: A feasible alternative patrolling path.
Steps:
Step 1. Find the rectangular region R, which both F and G belong to, from Re.
Step 2. Check whether the rectangular region, which the passing point belongs to, is identical to R.
If yes, the alternative patrolling path is F Æ P Æ G.
Else, go to Step 3.
Step 3. Calculate the intersections, P1 and P2, of the region R and the alternative path F Æ P Æ G.
87
Then, the alternative patrolling path is F Æ P1 Æ P2 Æ G.
Additionally, after the time interval t, the system must check whether an intersection is still on the paths of the two vehicles again. If yes, the patrolling path of the second vehicle will be changed again. The entire process is described as Algorithm 6.2.
Algorithm 6.2 Computing an alternative path for an intersecting state.
Input: The current position V11 = (x11, y11) and the goal G1 = (gx1, gy1) of the first vehicle, the current position V21 = (x21, y21) and the goal G2 = (gx2, gy2) of the second vehicle, a fixed length Dis between the two vehicles, the velocity vel of the vehicles, the time interval t of calculating the distance between the vehicles, and the included angle θ between the current position and the passing point.
Output: A alternative patrolling path for one vehicle.
Steps:
Step 1. Calculate the intersection I in the two paths V11 Æ G1 and V21 Æ G2. Step 2. Judge which vehicle should change its path.
If d(V11, I) < d(V21, I), the path of the second vehicle must be changed.
Else, the path of the first vehicle must be changed.
Assume that the path of the second vehicle must be changed in the following steps.
88
V12 and whose radius is Dis by the following equation:
The above equations lead to
(x21+(gx x s x2- 21) - 12)2+(y21+(gy2-y s y21) - 12)2 =Dis2.
The above equations lead to:
' '
Step 6. Calculate candidate passing points a and b in the following way, in which the included angle between V21’ and the candidate passing points is θ:
Step 7. Determine the passing point in the following way:
if (a, G1) < (b, G1), point b is the passing point.
Then the path of the second vehicle is taken to be V21 Æ b Æ G2. Step 8. Check whether the alternative path is feasible by Algorithm 6.1.
If not, the new alternative path will be obtained from Algorithm 6.1.
89
6.3.2 Collision avoidance on non-intersecting paths
In this state, both paths of the two vehicles must be changed. Each passing point is on the perpendicular bisector l of the path from a current position V = (x1, y1) to a goal G = (x2, y2). Because it is desired to draw apart the distance between the two vehicles quickly, the included angle between the paths V Æ G and V Æ turning point P = (p1, p2) is set by a parameter θ. Therefore, the distance between P and C, which is the midpoint of line segment V and G, is:
2 tan
VG∗ θ. (6.8)
A graphic illustration is shown in Figure 6.5.
V G
The directional vector wJK
of l is perpendicular to the one of path V Æ G, so it is:
Then, l can be represented as:
1 2 1 2
90
Because P is on the perpendicular bisector l and the distance between C and P is computed by Eq. (6.8), P can be represented by Eq. (6.11) below, in which a and b are in the different sides of path V Æ G, respectively:
1 2 1 2
For each path of the vehicles, there are two candidates to choose as a passing point.
The condition of choosing passing points for the vehicles is that the distance between chosen passing points is the longest within all combinations of the candidates. See an example shown in the following.
perpendicular
Figure 6.6Alternative paths at a non-intersecting state.
Points a1 and b1 are the candidates for the first vehicle and points a2 and b2 are the ones for the second vehicle. All states of choosing candidates are (a1, a2), (a1, b2), (b1, a2), and (b1, b2), in which the distance between a1 and a2 is the shortest. So, a1 and a2 are the passing points for the first and the second vehicles, respectively; the alternative paths for the two vehicles are V1 Æ a1 Æ G1 and V2 Æ a2 Æ G2.
Additionally, because the included angle between the two paths from the current
91
position V to the goal G and to the passing point P is restricted by a parameter θ, the distance between P and path V Æ G may be too long. Therefore, we set a fixed distance D between them. If the distance between P and path V Æ G is larger than D, we translate the line segment l connecting V and G along a perpendicular direction toward the passing point P, such as shown in Figure 6.7, in which l is exactly the translation line.
Figure 6.7The passing point P is too far.
The translation line l can be represented as:
2 2
Therefore, the new alternative path is V ÆP1 Æ P2 ÆG. Furthermore, it is necessary to check whether the path is feasible by Algorithm 6.1, and then the final alternative path can be obtained. See an example shown in Figure 6.8 through Figure 6.10 for illustration.
In the example, two vehicles are too close and paths of them are non-intersecting.
Here, we only see the state of one vehicle, as shown in Figure 6.8. P is the passing
92
point, but the point is too far from line segmentVG. Therefore, we translate VG a distance D toward P, and then the translation line l can be obtained, as shown in Figure 6.9.
V
P
G
Rectangular Region R
perpendicular bisector l
Figure 6.8 A passing point P at a non-intersecting state.
V
P
1 G P
P2
D
translation line l
Rectangular Region R
Figure 6.9 P is too far.
After calculating two intersections of l and V Æ P Æ G, the new alternative path is V Æ P1 Æ P2 Æ G. For P1 and P2, it is necessary to check whether they are feasible by Algorithm 6.1. Because the rectangular region which P2 belongs to is different from the one R which both the current position V and the goal G belong to, as shown in Figure 6.10.
93 V
1 G P
P2
θ
P21 P22
Figure 6.10 P2 is not in the rectangular region R.
Hence, we calculate the intersections of P1 Æ P2 Æ G and R, and then the alternative path becomes V Æ P1 Æ P21 Æ P22 Æ G. The processing of computing a alternative path at a non-intersecting state is shown as Algorithm 6.3 below.
Algorithm 6.3 Computing an alternative path for a non-intersecting case.
Input: The current position V1 = (x11, y11) and the goal G1 = (x12, y12) of the first vehicle, the current position V2 = (x21, y21) and the goal G2 = (x22, y22) of the second vehicle, the restricted distance D between a passing point and the original path V1 Æ G1 or V2 Æ G2, and the included angle θ between the original path and the path from the current position to the passing point.
Output: The alternative paths for the two vehicles.
Steps:
Step 1. Calculate two candidates of passing points for the first vehicle (a1 and b1) and the second vehicle (a2 and b2) by the following equation:
94
Step 2. Determine the passing points for the two vehicles in the following way.
Step 2.1. Calculate all distances of the four combinations (a1, a2), (a1, b2), (b1, a2), and (b1, b2).
Step 2.2. Choose the least distance from Step 2.1 and the combination is exactly the passing points for the two vehicles.
Step 2.3. Insert the passing point into the original path for each vehicle.
Step 3. Check whether the distance between the passing point P and the original path is larger than D, for each vehicle.
If yes, calculate the intersections of the translation line l and the alternative path, in which the distance between l and the original path is D; and then, replace P by the intersections.
Step 4. Check whether every alternative path is feasible by Algorithm 6.1.
If not, obtain the new alternative path from Algorithm 6.1.
95
Chapter 7
Experimental Results and Discussions
In this chapter, we show some experimental results of the proposed security patrolling system by two ways. The first is the result of optimal randomized patrolling paths and collision avoidance between vehicles shown by a simulation using programs written in the Borland C++ builder; it is described in Section 7.1. The other is the result of an actual environment in the Computer Vision Laboratory, Department of Computer Science, National Chiao Tung University, and it is described in Section 7.2.
7.1 Experimental Results of Simulation of Patrolling
In this simulation, we create a patrolling environment whose floor shape is composed of four rectangular regions, as shown in Figure 7.1, in which Obj. 0 through Obj.6 are monitoring points.
We utilize the rectangular regions to calculate all the turning points and the distance between each pair of monitoring points, and then save the data into some text files. By reading the files, they can be used again. Furthermore, the threshold to restrict the differences between the patrolling distances needs to be keyed in to the user interface, as shown in Figure 7.1, marked by a red frame. All patrolling paths are random, optimal, and load balanced among vehicles. See an example shown in Figure 7.2, in which the first vehicle starts its navigation at Obj. 4 (M4) and the second
96
vehicle starts at Obj. 1 (M1).
Figure 7.1A simulated patrolling environment.
Among all monitoring points, M0, M3, M4, and M6 are chosen by the first vehicle; M1, M2, and M5 are chosen by the second. The obtained optimal paths are M4 Æ M6 Æ M3 Æ M0 and M1 ÆM2 Æ M5. According to the record of turning points passed by between each pair of monitoring points, obtained in the learning phase, the actual paths are M4 Æ M6 Æ N3 Æ M3 Æ N1 Æ M0 and M1 ÆM2 Æ N2 Æ N3Æ M5 for the two vehicles, as shown by red and green dotted lines in Figure 7.2.
Furthermore, the distances of the paths are 1633.22 and 1081.56. Because the difference of the distances is smaller than the threshold 800, set by the user, the two paths are accepted. In this session, the two vehicles end at M0 and M5, respectively, so the positions are the starts for them in the next patrolling session, for which, the new path planning is shown in Figure 7.3.
97
Figure 7.2 Path planning for the two vehicles in a session.
M0, M2, M3, and M4 are chosen by the first vehicle; M1, M5 and M6 are chosen by the second. The obtained optimal paths are M0 Æ M2 Æ M3 Æ M4 and M5 ÆM6 Æ M1; the actual paths are M0 Æ N1 Æ M2 Æ M3 Æ M4 and M5 ÆM6 Æ N3 Æ N2 Æ M1 for the two vehicles, as shown by the red and green dotted lines in Figure 7.3.
Furthermore, the distances of the paths are 1175.41 and 1262.25 and they are also accepted.
To show the advantage of our system, we compare the times needed for different control factors, as shown in Table 7.1. If the property of randomization is an essential condition, the average time in one session taken by using one vehicle is nearly double of that taken by using two vehicles. This result tells us that the system for multiple
98
vehicles can bring more benefits. Besides, if the number of vehicles is the same, an optimal patrolling path will take less time than a non-optimal path.
Figure 7.3Path planning for the two vehicles in the next session.
For collision avoidance, if the distance between two vehicles is too close, the paths of the vehicles will be changed. The states of non-intersecting paths are shown in Figure 7.4, in which red and green lines are the original paths of the vehicles.
Because the first obtained passing points, red and green circles, are too far from the original path or exceed the walkable regions, the blue circles are calculated. The dotted lines are exactly the feasible alternative paths for the vehicles. Besides, the final passing points belong to the rectangular region which the original path also belongs to.
99
Table 7.1The table of time comparisons where O and X means conducted or not, respectively.
Number of Vehicles
Randomization Optimization
Average Time (second / one session)
Saved Time / Original Time
(%)
1 O O 39.4 -
1 O X 31.6 19.8
2 O O 19.7 50.0
2 O X 13.5 65.7
For collision avoidance of the path-intersecting case, one example is shown in Figure 7.5. Because the second vehicle is closer to the intersection than the first one, the path of the first vehicle must be changed. The black circles a and b are the candidates of passing points. Because b is farther from the goal of the second vehicle, b is chosen.
For collision avoidance of the path-intersecting case, one example is shown in Figure 7.5. Because the second vehicle is closer to the intersection than the first one, the path of the first vehicle must be changed. The black circles a and b are the candidates of passing points. Because b is farther from the goal of the second vehicle, b is chosen.