In order for a robot to complete a given task, it must first be made to autonomously reach a specified target location, so optimizing the robot path trajectory planning is a prerequisite for the use of robots. In this paper, for the two problems of the traditional artificial potential field method of target unreachable and local optimization, we first improve the repulsive potential field function so that the robot’s gravitational force and repulsive force are zero at the target position and then construct the robot kinematic analytical model by setting the virtual target point away from the local minimum value point. On this basis, the improved algorithm is used to compare simulation experiments in three environments with the real trajectory planning test in the showroom. In the climate “near the obstacle of the target point” and the pure U-shaped area environment, the robot of the traditional APF algorithm cannot reach the target point. However, the algorithm in this paper reaches the target point in all three environments, with a time taken of only 21, 33, and 42 seconds, respectively. In the real trajectory planning of the showroom, the improved algorithm in this paper reaches the target point quickly and accurately, with a total path trajectory length of 77.7835m, a time of 43 seconds, and a total turning angle of 793°. This paper provides an effective method for planning robot path trajectories in a complex and variable environment.