4.1. High Precision Positioning Technology
The traditional three-sided measurement method may cause the three locating circles to be unable to be intersected at one point due to the different power consumption and the existence of the multipath effect of the base station, which will reduce the positioning accuracy. Therefore, the standard trilateral measurement method is improved.
In most cases, the trilateral method will intersect in an area, as shown in
Figure 4. Set the intersection of three circles as
,
,
and select the center of gravity
of the triangle surrounded by three points to represent the position of the label. Obviously, the size of the area surrounded by three circles has a great influence on the location accuracy of the label, and experiments show that the smaller the area surrounded, the higher the accuracy. Therefore, the area can be used as a weight to measure the credibility of the positioning point.
There is a positive correlation between the intersection area of three circles and the triangle area surrounded by the three intersection points. The relationship between the intersection area of three circles and the accuracy of location can be approximated by the relationship between the triangle area surrounded by the three intersection points and the accuracy of location. The smaller the area of the triangle is, the more accurate the anchor point is and the larger the weight is. The three sides of the triangle formed by the intersection point, respectively, are:
Suppose that UWB obtains n groups of valid data every 0.1 s and the triangle area enclosed by the intersection under each group of data is s. The following weight function can be defined to represent the credibility of the location:
The optimal position is obtained by standardization:
Above all, the unknown point position is estimated for many times, the location point is determined by using the weight of each position and the optimal location point is obtained by the unscented Kalman filter algorithm with an adaptive factor. It not only solves the problem that the standard trilateral measurement method cannot meet at one point, but it also overcomes the influence of the multipath effect and NLOS error on positioning to a certain extent, increases the reliability of positioning and realizes the high-precision positioning of the human vehicle.
In order to verify the rationality of the positioning and algorithm, static tests and dynamic tests were carried out, respectively. The test was carried out in a 10 m × 10 m LOS environment using the DWM 1000 radio frequency module produced by Decawave. The typical bandwidth is 500 MHz, the transmission power adjustment range is −62–−35 dBm/MHz and a communication rate of 110 kB/s is selected.
In the static positioning test, at a positioning speed of 10 times per second, the lateral and longitudinal errors are within 10 cm, the highest positioning accuracy is within 7 cm, the RMSE (root mean square error) is reduced by 12.74% and the MaE (average absolute Error) is reduced by 21.58%, as shown in
Table 2.
The comparison between the static positioning result and the traditional positioning algorithm is shown in
Figure 5. It can be seen from the experimental results that this work proposes an improved trilateral measurement method. The absolute positioning accuracy and relative positioning accuracy have been significantly improved.
In the dynamic positioning S-shaped test, the maximum deviation in the horizontal and vertical directions is within 20 cm and the error of most points is within 10 cm. Compared with the ideal point (3000, 4000), the average error in the x-direction in the unimproved group is 7.091 cm and the maximum error is 17.208 cm. The average error in the y direction is 8.947 cm and the maximum error is 23.987 cm. In the improved group, the average error in the x direction is 5.566 cm and the maximum error is 10.225 cm. The average error in the y direction is 6.817 cm and the maximum error is 18.038 cm. The dynamic positioning trajectory is shown in
Figure 6.
In dynamic positioning, the maximum deviation in the x direction is 12.4 cm and the maximum deviation in the y direction is 15.0 cm. The error of most points is within 10.0 cm, and the trajectory fluctuates little, which is basically consistent with the ideal trajectory.
In order to verify the optimization effect of the algorithm of this work on UWB positioning data and the ability to correct NLOS errors, a simulated NLOS test was carried out in a laboratory environment of 10 m × 10 m. A UWB device with a transmission power of –45 dBm/MHz is adopted, with a communication rate of 6.8 m/s, a center frequency of 6489.6 MHz, a frequency band of 6240–6739.2 MHz and a bandwidth of 499.2 MHz. It complies with IEEE 802.15.4-2011 protocol. The test scenario is shown in
Figure 7. The base station is placed along the vertices of an equilateral triangle with a side length of 6 m, and the dashed line represents the movement trajectory of the tag MS. A metal block is inserted between the base station and the track. When the tag, the metal block and the base station are on the same straight line, the metal block with a dielectric coefficient greater than 1 will interfere with the propagation of the direct single-path component DP, forming a strong NLOS environment. The traditional positioning algorithm and the algorithm of this work were used to carry out the positioning test, and the test results are shown in
Figure 8.
It can be seen from
Figure 4 that in the 30th to 40th ranging, the base station was affected by the metal block and the ranging value suddenly changed, which is shown in the positioning result, as shown in
Figure 9.
The black dots in
Figure 5 are the positioning results of the traditional algorithm. It can be seen that the data began to be abnormal at
y = 150 cm, and then there was a large error in the positioning and the maximum error value reached 33.589 cm. The red dot in the figure is the positioning of the work algorithm. As a result, it is obvious that the data fluctuation is smaller and the data mutation at the original NLOS error is relatively smooth. The maximum error is only 15.883 cm, which is 52.7% lower than the maximum error of the traditional algorithm. The RMSE value and MAE value are shown in
Table 3.
Experiments show that the algorithm proposed in this work improves the positioning accuracy of UWB, solves the problem of low positioning accuracy in complex scenes and realizes the real-time accurate positioning of people and vehicles.
4.2. Lane Detection Technology
The premise of lane detection is to detect the edge of the lane. Because of the uneven distribution of light in the parking lot and the strong reflection of the ground, the commonly used edge detection methods easily judge the noise as the edge, so the threshold needs to be manually selected. This paper proposes a lane detection method based on an improved sparrow search algorithm, which reduces the interference of ambient light by dynamically selecting the region of interest (ROI). The optimization of parameters such as step size and warning threshold can avoid noise, quickly and accurately find the edge area of lane line, improve the accuracy of lane line detection and ensure the safety and standardization of calling vehicles.
The main flow chart (
Figure 10) and steps of edge detection of the improved sparrow search algorithm are as follows:
(1) Input the pre-processed image, and each pixel is regarded as a location where the sparrow can forage. Initialize the sparrow position: randomly distribute n sparrows to the pixels of the image.
(2) A fixed proportion of sparrows were selected as the discoverers to provide direction for the whole sparrow species. The location updating formula is as follows:
where
is the position of the
sparrow in generation
in the
dimension of the image,
is the random number in the value space
,
is the maximum number of iterations,
is the random number in the standard normal distribution,
is the alert threshold and
is the fitness of the position, which is defined as follows:
In the formula, represents the gray value of the pixel at position. The gray value of pixels in the edge region changes greatly and has better adaptability. When , it doesn’t reach the warning threshold and it carries out an extensive search. When , it reaches the warning threshold and randomly moves in a small range according to the standard normal distribution.
(3) In each generation of sparrows, except the sparrow selected as the discoverer, it is regarded as the follower. The follower follows the discoverer to forage, and its location updating formula is as follows:
is the lowest global fitness position of the current sparrow,
is the highest fitness position of the current discoverer and
is determined by the location dimension. Since the input image is a two-dimensional image, the value of
in this work is 2. When
, it indicates that the adaptability of the position of the
follower is relatively low and it needs to fly to other places. When
, the follower will fly to the optimal position of the current discoverer at random.
(4) All sparrows, except those selected as discoverers, are regarded as followers who follow discoverers to forage. The formula for updating its position is as follows:
In the formula, is the highest global fitness position of the current sparrow, the parameters of control step follow the standard normal distribution, is the random number between , is the current global maximum fitness, is the current global minimum fitness and in order to prevent the denominator from being 0. When , the sparrow flies to the best position in the whole world. When , the sparrow will fly to a nearby position.
(5) Continue to iterate until the maximum number of iterations is reached. In the edge detection, the output image is a binary image. The pixel value of the position where the sparrow stays is set to 1, and the pixel value of the position where the sparrow does not stay is set to 0. Finally, the image is output, and the effect of the output image is shown in
Figure 11.
The last step of edge detection also detected some interference factors; there is a need to further operate the image after edge detection to find the lane line. In most cases, the lane line is a straight line, so this paper uses Hough transform to extract the lane line.
Input the two-dimensional image. In a Cartesian coordinate system, the function expression of straight line is
and the expression converted to the Hough coordinate system is
. As shown in
Figure 12 below, a point on a straight line in a Cartesian coordinate system is transformed into a Hough space and is intersected at a point.
However, in the case of
, it is not convenient for the straight line to be expressed in the Cartesian coordinate system, so it needs to be converted to the polar coordinate system that
, and then the Cartesian coordinate system is converted to the Hough coordinate system and the function expression after conversion is
. As shown in
Figure 13 below, a line in the polar coordinate system is transformed upward into the Hough space and intersects at a point:
Therefore, lane lines can be well fitted through Hough transform, and the effect of lane line detection can be achieved, as shown in
Figure 14.
In order to verify the effect of the lane line detection and recognition method based on the improved sparrow search algorithm proposed in this paper, this paper performs lane line detection on the same computer on the videos taken by three groups of actual vehicles driving on the road. The results are shown in
Table 4.
For three groups of the same video on the same computer, the traditional edge detection method based on the canny operator is used to detect lane lines. The results are shown in
Table 5.
In
Table 4 and
Table 5, video 1 is a video of a vehicle driving on a highway during the day, video 2 is a video of a vehicle driving on a highway on a cloudy day and video 3 is a video of a vehicle driving on a highway under strong light. From the simulation results in
Table 4 and
Table 5, it can be seen that under the same number of frames, the lane line detection and recognition method based on the improved sparrow search algorithm proposed in this paper has a higher detection and recognition rate.
4.3. Vehicle Collision Warning Model and Algorithm
The safety of vehicle operation is affected by many factors such as meteorological conditions and road conditions. The traditional safety distance calculation model is only calculated by speed limit, which leads to an inaccurate alarm. In this paper, an improved Berkeley model is proposed; that is, the vehicle forward and backward motion parameters are analyzed using LiDAR, and the effect of braking deceleration on displacement is ignored [
25,
26].
(1) When the car in front moves at a constant speed and the car behind decelerates to 0, the required time is as shown in
Figure 15 for the velocity displacement variation of the two vehicles.
When
, the speed of the vehicle behind, decreases to the same as that of the vehicle in front, the safety distance between the two vehicles is:
(2) When the deceleration time of the rear vehicle to zero is greater than or equal to the time when the speed deceleration time of the front vehicle reaches zero, the velocity-displacement changes of the two vehicles are shown in
Figure 16.
When the vehicle has decelerated to a static state at
time because of
, the following vehicle still keeps a certain deceleration state and moves forward. The safe distance is:
(3) When the time
that the rear vehicle decelerates to zero is smaller than the time
that the front vehicle decelerates to zero, the velocity-displacement changes of the two vehicles are shown in
Figure 17.
At
time, the speed of the two vehicles is the same and the safety warning distance is:
Synthesizing the above three situations, different calculation formulas of safety warning distance are selected at the right time.
In order to remedy the defect of the Berkeley model neglecting side safety, this paper proposes a new side safety distance model for driving on curved roads (
Figure 18).
For the model with the angle of the two cars and the speed of the car as the main parameters, the lateral critical safety distance model is established, according to the angle between the two cars (D ipsilateral two laser sensors for vehicle distance, , ; respectively different obstacle distance from the laser sensor), and the relative velocity was carried out on the side of the vehicle driving state, an analysis of lateral safe distance:
( is the longitudinal traveling distance of car B and is the longitudinal traveling distance of car A.) Compared with the traditional model, this model takes into account the influence of other vehicles on the side safety in the process of self-vehicle turning and lane change. It has fast signal transmission, strong anti-interference ability and can predict the lane change of vehicles in different lanes in real time, thus improving the accuracy of early warning.
Simulation analysis of the improved Berkeley model and the traditional Berkeley model based on MATLAB (the left picture in
Figure 19 is the traditional Berkeley model, and the right picture is the improved model of the work). The simulation data shows that at different vehicle speeds, the improved Berkeley model has an earlier warning, and this advantage becomes more obvious as the vehicle speed increases. When the relative vehicle speed is higher, the safety warning distance in the improved model is compared with the safety warning in the traditional model. The distance is relatively small, and the difference is about 1 to 2.5 m. Compared with the traditional model, the improved Berkeley model can effectively prevent false alarms and realize that the safety warning distance changes according to the changes of the front and rear vehicle motion parameters.
The lateral safety distance model of the curve is simulated based on MATLAB, as shown in
Figure 20.
When passing railway crossings, sharp bends, narrow roads and narrow bridges, the maximum speed of motor vehicles shall not exceed 30 km per hour, which is about 8.3 m/s. So, take = 25 km/h, which is about 6.94 m/s.
In order to ensure that the two vehicles are in a safe state when they are stopped, the safe distance between the vehicle and the vehicle in front of it after stopping is generally taken as 2 to 5 m. In view of the fact that both vehicles are driving on curves, in order to ensure that the two vehicles still have a safe distance after driving for a period of time, the longitudinal critical safety distance is = 3.5 m.
The results show that when the reference speed is 25 km/h and the longitudinal critical safety distance is 3.5 m, the lateral safety distance and lateral critical safety distance change significantly with the change of the included angle and relative speed of the two vehicles. When the driving speed is low, the change of the lateral critical safety distance is not obvious, and the change of the angle between the two vehicles has little effect on it. The change of the lateral safety distance in the vehicle curve is relatively obvious, with an amplitude of about 0.3 m. When the relative speed increases, the longitudinal distance between the two vehicles gradually increases, which is not prone to collision risk, and the lateral safety distance decreases when the vehicle bends. When the included angle between the two vehicles increases, the longitudinal distance between the two vehicles gradually decreases, which renders them prone to collision, and the lateral safety distance increases. The test shows that on the premise of ensuring driving safety, the lateral warning distance can reach 0.94 m and the accuracy of the longitudinal safety warning distance can be increased by 3.8%. Compared with the traditional model, this model predicts the side vehicles based on the relative speed and the angle between the two vehicles so as to improve the reliability of early warning and ensure the driving safety in the state of curve and vehicle lane change.