Path planning is an important part of the navigation control system of mobile robots since it plays a decisive role in whether mobile robots can realize autonomy and intelligence. The particle swarm algorithm can effectively solve the path-planning problem of a mobile robot, but the traditional particle swarm algorithm has the problems of a too-long path, poor global search ability, and local development ability. Moreover, the existence of obstacles makes the actual environment more complex, thus putting forward more stringent requirements on the environmental adaptation ability, path-planning accuracy, and path-planning efficiency of mobile robots. In this study, an artificial potential field-based particle swarm algorithm (apfrPSO) was proposed. First, the method generates robot planning paths by adjusting the inertia weight parameter and ranking the position vector of particles (rPSO), and second, the artificial potential field method is introduced. Through comparative numerical experiments with other state-of-the-art algorithms, the results show that the algorithm proposed was very competitive.