Based on hierarchical Lyapunov methods, the motion planning of free-flying space robots with prismatic joint for obstacle avoidance is discussed. First, with the momentum conversation and the Jacobian matrix, the system state equations and the control output equations for control design are established. And then the primary and secondary Lyapunov functions are selected. The primary function insures the movement of the endeffector from the start point to the end point. The secondary ascertains obstacle avoidance of the endeffector. Combined the primary and secondary functions, the endeffector implements the specific movement and realizes obstacle avoidance. A planar space robot with prismatic joint is simulated to verify the proposed methods.