An obstacle avoidance mechanism is designed for the operation mode and the overall structure of high-voltage power lines inspection robot based on magnetic levitation principle. The mechanism is composed of a planar linkage mechanism and a screw nut mechanism with two degrees of freedom. Through the control of two of the original, the robot has a function of opening the shell and obstacle avoidance. The mechanism is simple and occupies less space with flexible movement, compact structure, to meet the requirements of obstacle avoidance to avoid vibration hammer, clamp, straight line towers and other obstacles effectively which solved the contradiction between the small space in the robot and the obstacle avoidance requirements. Two prime bar linkage relationships is obtained according to static analysis of the mechanism. Finally, by means of Kinematics simulation of the obstacle process through Pro/E software, the feasibility of the institution obstacle scheme is verified.