# A Two-Stage Local Path Planning Algorithm Based on Sampling and Optimization Methods
## 4 Simulations and Experiments
### Comparative Simulations  
In the comparative simulations, the move_base framework in ROS was utilized for navigation. The comparative algorithms included the dwa_local_planner and teb_local_planner packages within move_base. The navigation parameters were selected from the parameter files officially provided for TurtleBot. This study primarily focuses on how to avoid obstacles in the environment using a local path planning algorithm while ensuring that the global path remains unchanged. Additionally, the local path must closely adhere to the global path. It is important to note that the global_planner in move_base performs global path planning at a certain frequency or re-plans when local path planning fails. Consequently, the default global_planner in move_base does not align with the problem addressed in this study.  
Therefore, a global_planner_plugin [25] with two modes was developed. One mode generates a straight-line path between the robot's position and the target point. This mode prioritizes the robot reaching the target directly and is thus referred to as the \"Goal\" mode. The other mode first plans a perpendicular path from the robot's position to the global path, then plans a straight-line path from the intersection point to the target point. This mode prioritizes the robot reaching the global path first and is therefore referred to as the \"Path\" mode.  
In the comparative simulations, three sets of trajectory comparisons were conducted. To ensure fair comparisons, the parameters' comparative algorithms followed the empirical selection (without altering the official parameters), and the parameters were tested to achieve a favorable performance. The first and second sets utilized traditional navigation methods for mobile robots, specifically the global_planner combined with either the dwa_local_planner or teb_local_planner. Initially, the global_planner's planning frequency was set to 10 Hz. Subsequently, the planning frequency was changed to 0 Hz, meaning that the global path was planned only once. The third set of simulations employed our global_planner_plugin to validate the obstacle avoidance and global path-following capabilities of traditional local planners. Since the DWA algorithm predicts the potential trajectories of the mobile robot within a forward simulation time for obstacle avoidance, it was found during actual testing that DWA has limited obstacle avoidance capability when the global path remains unchanged. Therefore, in the third set of simulations, only the TEB algorithm was tested. The simulation results are illustrated in Figure 8.  
The simulation results show that the PSF algorithm performs best in following the global path. When the robot deviates from the global path or obstacle avoidance ends, it  
Figure 8: The results of the comparative simulation.  
can reach the global path in a shorter distance. The other two algorithms show different performances in different navigation modes. The errors with the global path are shown in Table 2.  
It is evident that under traditional navigation modes, both local path planning algorithms can achieve smooth movement and obstacle avoidance for the mobile robot. However, their local planning capabilities rely on the paths planned by the global_planner. When using the global_planner_plugin, the TEB algorithm exhibited good robustness. In the \"Path\" mode, the robot prioritized moving toward the global path even after obstacle avoidance. However, since the goal of the TEB algorithm is to plan the shortest possible path in terms of time, its performance in following the global path is not as excellent as that of the PSF algorithm.