The existing vehicle obstacle avoidance path planning methods generally aim at obtaining the collision-free path, ignoring the impact of the planned path on the vehicle stability in the obstacle avoidance process, so that the controlled vehicle has the risk of rollover in the obstacle avoidance process. To solve the above problems, a two-layer obstacle avoidance path planning algorithm considering path pre-planning and re-planning is proposed in this paper. In the path pre-planning layer, an improved APF algorithm with road boundary function constraints is proposed. By introducing the repulsion field adjustment factor, the shortcomings of GNRON and local optimization existing in the existing artificial potential field method are effectively solved. In the path re-planning layer, taking the rollover stability index as the constraint, a pre-planning result optimization method based on particle swarm optimization algorithm is proposed. The simulation results show that the obstacle avoidance path planning algorithm proposed in this paper can not only generate the obstacle avoidance path in real-time, but also reduce the yaw rate and yaw angle of the main vehicle in the process of obstacle avoidance, and effectively improve the rollover stability of the vehicle in the process of obstacle avoidance.