Redundant manipulators are often required to not only track target trajectories but also actively avoid obstacles in practical applications. A real-time trajectory planning method is proposed to solve the issue of redundant manipulator obstacle avoidance and tracking. Firstly, the method takes the joint angle limit formed by the physical mechanism of the manipulator itself and the obstacle limit in the workspace as constraint conditions. Additionally, the optimization objective is the error between the current trajectory and the desired trajectory, and quadratic programming technology is used to describe it. Furthermore, the method employs a recurrent neural network (RNN) for real-time optimization on the quadratic programming model. Finally, the effectiveness of the proposed method is verified by experiments on Franka manipulator. Experimental results demonstrate that the algorithm is highly efficient for manipulating trajectory planning, suitable for solving the problems of obstacle avoidance and joint angle limits while tracking trajectories.