In this paper, by explicitly considering a dynamic model of the robots, the coefficients of trajectories are determined by boundary conditions, optimal performance index and collision avoidance conditions. The planned trajectory is feasible and has a closed loop expression, which is efficient for real-time updating. There are two main improvements compared with existing parametric approaches. First, most existing methods use kinematic models of the robots, which could cause curvature discontinuities when trajectories are updated in real-time. Second, in some existing parametric methods, the initial position and ending waypoints can not be aligned vertically due to singularities. The approach proposed in this paper overcomes this limitation. Computer simulations verified the effectiveness of the proposed method.