*3.1. Static Environment*

For a static environment, we place several obstacles randomly in the room. The DAPF and the standard APF algorithms are carried out using the experimental parameters defined in Table 1.


**Table 1.** The experimental parameters in a static environment.

The robot has the oscillation problem and can not avoid the local minimum region using the standard APF algorithm as shown in Figure 6a,c, respectively. In contrast to the APF, the proposed DAPF approach has a smooth planned path along the edge of the influence range of obstacles as shown in Figure 6b,d. For the local minimum problem, the DAPF has no need to detect whether the robot has entered a local minimum region, since the DWA can predict and avoid such a situation in advance.

**Figure 6.** Experimental results using APF (**a**,**c**) and proposed DAPF (**b**,**d**) in the static environment where the gray solid circles are obstacles, the circles that around obstacles means the influence range, the small green circle is the robot position, and the red curve is the planned path. The APF has the oscillation problem that occurs in the (**a**) and local minimum problem that occurs in the (**c**), whereas the DAPF solves such problems and achieves better results as shown in (**b**,**d**), respectively.

#### *3.2. Moving Obstacle*

For dynamic environment, we compare three methods to avoid the moving obstacle, i.e., DAPF, DVAPF and DIAPF. We show that these methods have different performance for faster and slow moving obstacles. The experimental parameters are shown in Table 2.

The performance using the DAPF for avoiding the slow and fast obstacles are shown in Figures 7 and 8 respectively. For the slow obstacle, the DAPF has a period of oscillation when the obstacle is in front of the robot. For the fast obstacle, the situation is worse, i.e., the collision between the robot and the obstacle occurs.

**Table 2.** The experimental parameters for moving obstacle avoidance


The DVAPF is better than the DAPF as shown in Figures 9 and 10, where we can see that the DVAPF prefers a path behind the moving obstacle. Using such a strategy, the robot and the dynamic obstacle will move in opposite directions when the obstacle enters the robot's local map if the dynamic obstacle is faster than the robot, and the robot will continue to move towards the target point when *<sup>α</sup>* <sup>∈</sup> (−*π*, <sup>−</sup>*<sup>π</sup>* <sup>2</sup> ) <sup>∩</sup> ( *<sup>π</sup>* <sup>2</sup> , *π*) or the obstacle leaves the robot's local map. If the moving obstacle is slower than the robot or their velocity is similar, the planned path can be inefficiency and dangerous as shown

in Figure 10, i.e., the robot enters the influence area of the obstacle since the robot's deflection angle is too small to avoid the obstacle.

**Figure 7.** The robot uses the DAPF approach to avoid the slow moving obstacle: (**a**) shows the robot is before obstacle avoidance; (**b**–**e**) show that the robot is avoiding the obstacle, and (**f**) shows that the robot finishes obstacle avoidance.

**Figure 8.** The robot uses the DAPF approach to avoid a fast moving obstacle: (**a**) shows that the robot is before obstacle avoidance, and (**b**) shows that the robot collides with an obstacle.

In contrast to the DVAPF and DAPF, the DIAPF has the best performance according to the experiment results as shown in Figures 11 and 12. From the experimental results, it can be seen that the DIAPF approach can make a prediction according to the state of the moving obstacle: if the obstacle velocity is similar or faster, the robot can plan a path behind the obstacle. If the obstacle velocity is slower, the robot can plan a path in front of the obstacle. This strategy makes the planned path more efficient. In addition, the distance influence factor plays a key role to increase the safety and effectiveness of the planned path, e.g., the distance influence factor can reduce the robot's deviation angle if the moving obstacle is far away, and can increase this angle if the moving obstacle is closer.

**Figure 9.** The robot uses the dynamic window based artificial potential field (DVAPF) approach to avoid a fast moving obstacle: (**a**) before avoiding; (**b**) avoiding the obstacle; and (**c**) finish avoiding.

**Figure 10.** The robot uses the DVAPF approach to avoid a slow moving obstacle: (**a**) before avoiding; (**b**) avoiding the obstacle; (**c**) finish avoiding.

**Figure 11.** The robot uses the DIAPF approach to avoid a fast moving obstacle: (**a**) before avoiding; (**b**) avoiding the obstacle; and (**c**) finish avoiding.

**Figure 12.** The robot uses the DIAPF approach to avoid a slow moving obstacle: (**a**) before avoiding; (**b**) avoiding the obstacle; and (**c**) finish avoiding.

#### *3.3. Dynamic Environment*

In this section, we compare the proposed DIAPF method to the ROS [26] path plan package which employs the DWA and A\* algorithm. The experimental environment includes four static obstacles and a moving obstacle. As can be seen from Figure 13, the ROS uses A\* algorithm to plan a global path and uses the DWA algorithm to handle nearby obstacles in the local map. If the speed of the moving obstacle is slow, the robot can avoid the obstacle directly as shown in Figure 13a. However, if the obstacle moves fast, the robot needs to re-plan the path according to the position of the obstacle. The global path also needs to replan according to the local path changes as shown in Figure 13b. In contrast to the ROS method, the proposed DIAPF can make decisions in advance according to the relative velocity between the moving obstacle and robot as shown in Figures 14 and 15. The planned path using the DIAPF is more efficient than the one using the ROS module as seen in Figure 16, which shows the changes of the distance between the robot and the target point. The DIAPF shows a linear decrease of the distance while the ROS shows a curve that decreases first and then increases due to a re-planned path.

**Figure 13.** The robot uses path planner in robot operating system (ROS) to avoid a (**a**) slow and (**b**) fast moving obstacle in the dynamic environment.

**Figure 14.** The robot uses the DIAPF approach to avoid a fast moving obstacle in the dynamic environment: (**a**) before avoiding; (**b**) avoiding the dynamic obstacle; and (**c**) finish avoiding.

**Figure 15.** The robot uses the DIAPF approach to avoid a slow moving obstacle in the dynamic environment: (**a**) before avoiding, (**b**) avoiding the dynamic obstacle; and (**c**) finish avoiding.

**Figure 16.** The changes of the distance between the robot and the target point using the proposed DIAPF method (blue) and ROS path plan module (red).

#### **4. Conclusions**

In this paper, we introduce a dynamic window approach (DWA) and danger index (DI) based artificial potential field (APF) for static and moving obstacle avoidance. The dynamic window approach based APF (DAPF) can overcome the local minimum problem since the DWA can predict the local minima region and avoid in advance. For moving obstacles, we propose a novel danger index based APF (DIAPF) that considers not only the relative distance, but also the relative velocity between the robot and the moving obstacle. In this way, an optimized strategy can be made according to the motion status of the moving obstacle, which leads to a safer and efficient planned path compared to the state-of-the-art works, e.g., ROS path plan module. Finally, we demonstrate the proposed idea in the real environment using the Turtlebot robot, and the experiment results prove our claims. Future work will be extending current work to the environment with an unknown map and multiple randomly moving obstacles.

**Author Contributions:** The manuscript was written through the contributions of all authors. All authors discussed the original idea. J.S. and G.L. designed and performed the simulation experiments; J.S. wrote this manuscript with support from G.L., G.T. and J.Z.; all authors provided critical feedback and helped shape the research, analysis, and reviewed the manuscript; G.L. supervised this work.

**Funding:** This research was supported by the National Key R&D Program of China (2018YFB1306504), the National Natural Science Foundation of China (61603213, 91748115), the Young Scholars Program of Shandong University (2018WLJH71), the Hebei Provincial Natural Science Foundation (F2017202062), and the Taishan Scholars Program of Shandong Province.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


c 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
