# Path Planning of Mobile Robots with an Improved Grey Wolf Optimizer and Dynamic Window Approach
## 4 Improved Dynamic Window Approach
### Key Improvements to the Dynamic Window Approach
#### 4.2.3 Conflict Avoidance Strategies  
In dynamic environments, mobile robots need to avoid dynamic obstacles to ensure the safety and efficiency of their tasks. The traditional DWA sometimes fails to take effective action in time, resulting in collisions when facing head-on conflict with dynamic obstacles. Additionally, when facing a dynamic obstacle approaching from the side, it often employs a non-discriminatory avoidance strategy, which may lead to unnecessary detours and increase the probability of collisions. To address these issues, this paper proposes a new obstacle avoidance strategy that utilizes the distance and angle relationship between the dynamic obstacle and the robot, assesses the obstacle's behavior, and adopts corresponding avoidance maneuvers. The specific strategies are as follows.  
First, the Euclidean distance between the robot's current position and the dynamic obstacle's current position is calculated. In this formula, the robot's current position is at \((x_{r},y_{r})\), and the dynamic obstacle's current position is at \((x_{obs},y_{obs})\).  
\[d=\sqrt{(x_{obs}-x_{r})^{2}+(y_{obs}-y_{r})^{2}} \tag{28}\]  
As shown in Figure 2, set the distance threshold \(d_{\min}\) to 3 and the angle threshold \(\theta_{\min}\) to 30\({}^{\circ}\), then proceed to the following judgment when \(d\leq d_{\min}\) and the dynamic obstacle enters the mobile robot's angle detection range.  
In this context, the heading angle of the mobile robot, \(\theta\), is initially defined with a specific value, representing the robot's actual orientation. For simplicity in the obstacle avoidance strategy, we redefine the robot's heading angle as \(\theta_{r}\) and consider it as 0\({}^{\circ}\). This simplification allows for easier judgment of the relative positions and angles of the robot and dynamic obstacle during the avoidance process. When the heading angle of the dynamic obstacle, \(\theta_{obs}\), falls within the range of \([160^{\circ},200^{\circ}]\), it is considered a head-on conflict; otherwise, it is considered a non-head-on conflict. When judged as a head-on conflict, the mobile robot quickly avoids the obstacle interference area by adjusting its angular velocity and accelerating to avoid collision. Specifically, if \(\theta_{obs}\in(180^{\circ},200^{\circ}]\), it indicates that the dynamic obstacle is moving to the left relative to the mobile robot, and the mobile robot accelerates to the left to bypass it. If \(\theta_{obs}\in[160^{\circ},180^{\circ}]\), it indicates that the dynamic obstacle is traveling to the right relative to the mobile robot or moving face-to-face, the mobile robot accelerates to the right to bypass it. If the conflict is determined to be non-head-on, the mobile robot stops and waits for the dynamic obstacle to leave the interference area before continuing path planning.  
With this strategy, the mobile robot can minimize the risk of collisions in complex environments, thereby ensuring the safety of its movement while simultaneously reducing unnecessary detours and enhancing the efficiency of path planning.