For the problem of robot path planning in an environment of many terrains, mathematical model of multiobjective is established. Particle swarm optimization algorithm is used to solve the problem. Firstly, region weight is used to represent the difficulty when the robot passes through the terrain. Then passage time is calculated by utilizing local optimal criterion, and the danger degree is calculated according to the area between the danger sources and the robot’s path. Thus the problem can be converted into a bi-objective problem. Finally, particle swarm optimization algorithm is used to optimize the problem above, and the simulation results show the effectiveness of the proposed method.