Through the theoretical research and experimental verification of the traditional DWA, it can be found that the working environment of the DWA is diverse, and it is difficult to determine a set of appropriate fixed weight coefficients. The fixed weight combination in different scenes will seriously affect the path planning effect of the traditional DWA and may lead to problems such as the ferry vehicle not being able to avoid obstacles, the path being too long or missing the target point, and so on. In order to improve the above problems, this paper introduces fuzzy control theory to improve the traditional DWA to make it output the weight coefficient of the evaluation function adaptively according to the actual situation and improve the adaptability of the algorithm to the complex environment.
  4.2.2. Design of a DWA Based on Fuzzy Control
According to the characteristics of the DWA and the basic principle of the fuzzy controller, we can know that the ideal output value can be obtained when selecting the appropriate input value, selecting the reasonable membership function, and formulating the appropriate fuzzy control rules. The effect of path planning in the traditional DWA mainly depends on three weight coefficients. Therefore, this paper uses fuzzy control theory, considers the directionality principle and safety principle in path planning, and introduces the weight coefficient to design three fuzzy controllers, respectively, to realize the dynamic adjustment of the three weight coefficients of , , and . In order to improve the adaptability of the ferry in a dynamic environment.
- (1)
- Fuzzification 
In the fuzzy controller designed in this section, the inputs involved are the distance between the ferry vehicle and the obstacle 
; the distance between the ferry vehicle and the target point 
; the heading angle of the ferry vehicle relative to the target point 
; the output includes the three weight coefficients of the DWA 
, 
, and 
; and the fuzzy rule weight coefficient 
. The fuzzy definition of input and output is as follows: The fuzzy set of 
 is defined as {near (N), medium (M), far (F)}, and the domain is [0, 2]. When 
, it is fuzzified to N; when 
, it is fuzzified to M; and when 
, it is fuzzified to F. The fuzzy set of 
 is {near (N), middle (M), far (F)}, and the domain is [0, 4]. When 
, it is fuzzified to N; when 
, to M; when 
, to F. The unit of 
 is degree (deg), the fuzzy set is {negative large (XS), negative (S), medium (M), positive (B), positive large (XB)}, and the domain is [−180, 180]. When 
, the fuzzy description is negative large (XS); when 
, the fuzzy description is positive large (XB). When 
, fuzzy description is negative (S); when 
, fuzzy description is positive (B); and when 
, fuzzy description is medium (M). 
Figure 17 shows the membership functions of 
, 
, and 
.
For the output of the fuzzy controller 
, 
, and 
, the fuzzy set is {XS, small (S), medium (M), large (L), and maximum (XL)}, and the domain is [0, 1]. For the output of 
, the domain is [0, 1]. The fuzzy set is {small (S), medium (M), large (L)}, as shown in 
Figure 18, is the membership function of the output.
- (2)
- The formulation of fuzzy rules 
Fuzzy rules are the core of fuzzy controllers [
26]. According to the analysis of the traditional DWA, the adjustment of the weight coefficient of the DWA is actually a trade-off between the direction, safety, and speed of the ferry vehicle according to the current environment, so as to find out the most suitable speed trajectory for the current target. Among the three principles, the driving speed will have an impact on the algorithm efficiency of both directivity and safety principles. Therefore, this paper first designs two fuzzy controllers considering the directionality principle and the safety principle, and then designs a fuzzy controller that can output the weight coefficients of the directivity and safety principles, thus obtaining the weight coefficients of different evaluation factors in the evaluation function of the DWA. The specific fuzzy rules are designed as follows:
The factors that affect the directionality principle are the distance 
 between the ferry vehicle and the target point and the navigation angle 
 with the target point, so the structure of the directional fuzzy controller 
 is shown in 
Figure 19.
When the ferry vehicle approaches the target point and the heading angle is large, the direction should be given priority, a larger value of 
 should be used, and the speed should be reduced to a smaller value of 
. When the distance between the ferry vehicle and the target point is long, and the heading angle is small, priority should be given to increasing the driving speed, using a larger value of 
, and choosing a moderate value of 
 to keep moving in the direction of the target. When it is far away from the target point, priority is given to increasing the speed and then gradually maintaining the heading angle close to the target point. When approaching the target point, gradually reduce the speed and give priority to the direction. The specific fuzzy rules are shown in 
Table 5.
After the fuzzy vector under the directional principle is obtained by the Mamdani type reasoning method [
27], the clear output control quantity is obtained by defuzzifying by the center of gravity method, and the accurate values of 
 and 
 can be obtained. At the same time, in order to take into account for the security, the value of 
 is 0.2.
The factors affecting the safety principle are the distance 
 between the ferry vehicle and the obstacle and the distance 
 from the target point, so the structure of the safety fuzzy controller 
 is shown in 
Figure 20.
When the distance between the ferry vehicle and the obstacle and the target point is very small, the speed should be reduced first and the direction should be given priority. When the ferry vehicle is close to the target point and far from the obstacle, it should appropriately increase the speed, reduce the value of 
, and give priority to approaching the target point. When the ferry vehicle is far from the obstacle and the target point, the ferry vehicle gives priority to speeding up close to the target point, and the requirement for obstacle avoidance is reduced. When the ferry vehicle is far away from the target point but close to the obstacle, we should give priority to avoiding obstacles, take a larger value for 
, and reduce the speed by 
 value appropriately. The specific security fuzzy rules are shown in 
Table 6. The output is defuzzified by the center of gravity method, and the exact values of output 
 and 
 under the safety principle are obtained. At the same time, in order to take into account the directional principle, the value of 
 is 0.2.
Because different environments attach different importance to the directionality principle and safety principle, it is necessary to consider the distance 
 between the ferry vehicle and the obstacle and the heading angle 
 with the target point and introduce the fuzzy rule weight coefficient 
 of directionality and safety. By combining the output of the fuzzy controller obtained from 
 and 
, the final expressions of 
, 
, and 
 are obtained:
The fusion fuzzy controller 
 is designed, and the structure of the fuzzy controller 
 is shown in 
Figure 21.
When the ferry vehicle is far away from the obstacle and the heading angle is large, we should give priority to the directional principle and take a smaller value of the weight coefficient 
. When the heading angle of the ferry vehicle is small and close to the obstacle, we should give priority to the safety principle and take a larger value of 
. The closer the ferry vehicle is to the obstacle, the more attention that should be paid to safety, and the greater the value of 
. The larger the heading angle of the ferry vehicle is, the higher the emphasis on directionality should be, and the smaller the value of 
 should be. When the emphasis on directivity and safety is close, 
 should take the appropriate value. The output is defuzzified by the center of gravity method. The specific fusion fuzzy rules are shown in 
Table 7.
Figure 22 shows a three-dimensional surface diagram of fuzzy rules of 
, 
, and 
 fuzzy controllers.
   4.2.3. Simulation Experiment of the DWA Algorithm Based on Fuzzy Control
In order to verify that the improved dynamic window algorithm can better adapt to the complex environment than the traditional dynamic window algorithm, the DWA algorithm based on fuzzy control is used to simulate the same environment as in 
Section 4.1.4. The starting point and target point of the experiment and the parameters of the ferry vehicle are consistent with the traditional dynamic window method. The simulation results in this section are compared with those in 
Section 4.1.4.
In the first scene, the simulation results are shown in 
Figure 23, from the path results and the weight coefficient variation curve of the evaluation function, it can be seen that when it is close to 100 steps, the ferry vehicle is close to the obstacle, but there is still a long distance from the target point, so safety is given priority. The 
 value of the output of the fuzzy controller decreases, and the 
 value increases. Comply with the fuzzy rules set out in 
Section 4.2.2. At the same time, as the ferry vehicle is closer to the target point and the obstacles around the target point, the smaller the speed weight 
 is, the greater the values of 
 and 
 are. Compared with the path simulated by the traditional DWA in scene 1 in 
Figure 13, the ferry vehicle can dynamically adjust the avoidance weight according to the actual distance from the obstacle on the basis of ensuring the direction so that the ferry vehicle can smoothly bypass the obstacle in front of the target point and reach the target point, so as to avoid a situation where the traditional DWA crosses the obstacle in order to reach the target point faster.
The simulation is carried out in scene 2, the simulation results are shown in 
Figure 24, and the simulation results show that when there are both obstacles and drivable channels in the direction of the current position of the ferry vehicle facing the target point, that is, the position in the figure is close to 80 steps, the ferry vehicle is close to the obstacle, there is still a moderate distance from the target point, the values of 
 and 
 output by the fuzzy controller decrease, and the ferry vehicle chooses the path between the two obstacles. Finally, reach the target point. Avoid the situation where the traditional DWA gives up the optimal path in order to avoid obstacles. The distance and quality of the planned path are effectively optimized.
The simulation is carried out in scene 3, the simulation results are shown in 
Figure 25, and it can be seen from the simulation results that when the ferry vehicle is getting closer and closer to the target point, the speed weight 
 of the fuzzy controller will be greatly reduced, the speed of the ferry vehicle will slow down, and the relative heading angle weight will become a moderate value. The weight of avoiding obstacles is increased so that the ferry vehicle can reach the target point smoothly and safely. It will not happen that the ferry bus misses the target point because of the constant speed weight of the traditional DWA.
Through the simulation experiment of the DWA based on fuzzy control, it is obvious that, compared with the traditional DWA, the improved algorithm solves various problems caused by the constant weight coefficient of the evaluation function or the excessive weight coefficient of a certain weight. It solves the problem that the traditional dynamic window method cannot bypass the obstacles or pass through the narrow channel, and thus misses the target point. At the same time, it effectively improves the quality of the planning path.