Aiming at the difficulty of path planning for mobile robots caused by the limitation of indoor space, this paper analyses the characteristics of turning, starting and stopping in indoor mobile robots, and introduces particle swarm optimization (particle swarm optimization, PSO) to obtain the optimal path planning. At the same time, in order to improve the problems of low convergence and early maturity in classical algorithms, convergence factor, linear decline and non-linear concave are first used. The selection of inertia weight of PSO is discussed in terms of function and random distribution. The algorithm of PSO is improved by using cubic spline interpolation method and penalty function as fitness function. Finally, the simulation experiment is carried out with laboratory as indoor environment background, and compared with the classical PSO path planning method. The experimental results show that the improved PSO path in this paper is better than the classical PSO path planning method. The accuracy of path planning method is 5% higher than that of classical PSO method, and the average optimization time is about 5 seconds less than that of classical PSO. It can effectively improve the smoothness of path planning, and has good real-time and effectiveness for robot path planning in indoor environment.