SUMMARYThis paper presents a novel approach for online path tracking and obstacle avoidance of redundant robot manipulators. To this end, a nonlinear model predictive control (NMPC) method is designed that can track a desired path or reaches a moving target in the Cartesian space while avoiding static or moving obstacles as well as singular configurations in the workspace of the robot. The finite cost function of the NMPC is optimized at every sampling time, yielding an online optimal approach. In order to avoid collisions with moving obstacles and, at the same time, capturing a moving target, the future positions of the obstacles and the moving target are predicted using artificial neural networks (ANNs). Moreover, ANNs are employed to find a proper nonlinear model for the NMPC. The adaptation laws for the ANNs are obtained using the Lyapunov's direct method. The advantages of the proposed method are fourfold: (i) an adaptive and optimal approach is obtained, which can cope with changes in the system parameters; (ii) no inverse kinematics of the redundant manipulators is required; (iii) no prior knowledge about the obstacles and motion of the moving object is required; and (iv) stability of the closed‐loop system is guaranteed. Numerical simulations, performed on a four degree‐of‐freedom redundant spatial manipulator actuated by DC servomotors, show effectiveness of the proposed method. Copyright © 2013 John Wiley & Sons, Ltd.