Aiming at the unreachable target and local minimum problems existing in the traditional artificial potential field method in the path planning of mobile robots, an improved artificial potential field method is proposed. Firstly, when there are obstacles near the target point, the robot is difficult to reach the target point due to the large repulsive force. A safety distance factor is introduced in the potential field, and the parameter is optimized, so that the robot can maintain a suitable distance from the obstacle and reach the target point smoothly. Secondly, in order to solve the local minimum problem, the local minimum judgment condition is introduced, and when the condition is triggered, the local minimum area is bypassed, so that the robot can reach the target point smoothly. The simulation results show that the improved algorithm runs in the environment of different numbers of obstacles and has strong robustness. The proposed algorithm can enable the robot to bypass the local minimum area in the U-shaped obstacle environment, and successfully solves the local minimum problem in the path planning of mobile robots.