# Smooth Optimised A*-Guided DWA for Mobile Robot Path Planning
## 3 Smoothing Optimisation A*-Guided DWA
### Enhanced Global Path Constraints  
In order to solve the problem that the local path planned by DWA will deviate from the global path during obstacle avoidance, the evaluation function of the DWA algorithm is improved. The improved algorithm adds two evaluation subfunctions: the distance evaluation subfunction \(\mathrm{pathdist}(v,\omega)\) between the reference trajectory and the global path, and the path direction evaluation subfunction \(\mathrm{pathheading}(v,\omega)\). The corresponding  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Parameter Meaning** \\ \hline \(v_{min},v_{max}\) & Minimum and maximum speed of the current state \\ \(\omega_{min},\omega_{max}\) & Minimum pendulum angular velocity and maximum pendulum \\  & angular velocity in the current state \\ \  
coefficients are \(\mu\) and \(\varphi\), the trajectory with the lowest cost of the evaluation function is the optimal trajectory, and the evaluation function can be rewritten as:  
\[\begin{pmatrix}G(v,\omega)=\sigma\cdot(a\cdot\!\text{heading}(v,\omega)+\beta \cdot\!\text{vel}(v,\omega)+\gamma\cdot\!\text{dist}(v,\omega)\\ +\mu\cdot\!\text{pathdist}(v,\omega)+\sigma\cdot\!\text{pathheading}(v,\omega) )\end{pmatrix} \tag{15}\]  
(1) Evaluation subfunction of the distance between the reference trajectory and the global path  
The smaller the deviation distance between the end point of the trajectory to be evaluated and the global path, the lower the deviation of the trajectory from the global path. This evaluation term uses the point-to-straight-line distance formula to calculate the deviation distance between the end point and the global path. As shown in Figure 6, a schematic diagram of the distance evaluation subfunction of the reference trajectory from the global path is shown. The calculation process of the distance evaluation subfunction between the reference trajectory and the global path is shown in Equations (16) and (17), where \((x_{0},y_{0})\) denotes the coordinates of the end point of the trajectory to be evaluated calculated based on the robot kinematics model, and A, B, and C are the coefficients in the equation \(y=A\cdot x+B\cdot y+C\) that connects the robot's current local target point to the previous local target point.  
\[distance=\frac{A\cdot x_{0}+B\cdot y_{0}+C}{\sqrt{A^{2}+B^{2}}} \tag{16}\]  
\[\text{pathdist}(v,\omega)=\left\{\begin{array}{c}cos|distance|,\ distance\leq\frac{\pi}{2}\\ 0,\ distance>\frac{\pi}{2}\end{array}\right. \tag{17}\]  
(2) Path direction evaluation  
The main function of the path direction evaluation subfunction is to ensure that the motion direction of the mobile robot is always consistent with the global path, so as to improve the directional stability during the motion process. The subfunction determines whether the end of the trajectory is aligned with the direction of the global path by calculating the current direction of the global path and evaluating the size of the angle between the end of the trajectory to be evaluated and the direction. A schematic diagram of the path direction evaluation subfunction is shown in Figure 7.  
The specific calculation formula of the path direction evaluation subfunction is shown in Equation (18). \(\alpha\) is the angle between the end of the trajectory to be evaluated and the global path direction, and the smaller the \(\alpha\), the smaller the deviation of the robot's motion direction from the global path direction, and the higher the score of this evaluation item.  
\[pathheading(v,\omega)=\pi-\alpha \tag{18}\]  
Figure 6: Schematic of the distance between the reference trajectory and the global path.