|
Algorithm 1 Obstacle collision model |
|
Input: , , , , ,
Output: The distances measured by the three distance sensors to the nearest obstacles , , .
-
1:
Obtain the line-segment model of the range sensors and the line-segment model of each obstacle , , .
-
2:
For rectangular obstacles i, the set of boundary models is , whose slope and intercept are and , .
-
3:
Determine whether and are parallel.
-
4:
if parallel then
-
5:
It indicates no intersection points.
-
6:
else
-
7:
Calculate the intersection point , and obtain the distance .
-
8:
end if
-
9:
Sequentially verify whether the intersection point lies on the two intersecting line segments simultaneously.
-
10:
if True then
-
11:
Output .
-
12:
else
-
13:
It indicates safety.
-
14:
end if
-
15:
For circular obstacle i,
-
16:
if
then
-
17:
It indicates safety.
-
18:
else
-
19:
Compute the intersection points between the line and the circle and determine the one closer to the robot as the obstacle intersection point. Next, obtain the distance .
-
20:
end if
-
21:
Verify whether the intersection point lies on the line segment.
-
22:
if True then
-
23:
Output .
-
24:
else
-
25:
It indicates safety.
-
26:
end if
-
27:
For the forward and right sensors, use the same steps as the left sensor.
|