In this article, we address a formation control problem for a group of autonomous robots to track a moving target in the presence of obstacles. In the proposed method, desired formations, which consist of virtual nodes arranged in specific shapes, are first generated. Then, autonomous robots are driven toward these virtual nodes without collisions with each other using a novel control scheme, which is based on artificial force fields. The convergence analysis is shown based on Lyapunov’s stability. The novelty of the proposed approach lies in a new combination of rotational force field and repulsive force field to design a mechanism so that robots can avoid and escape complex obstacle shapes. The effectiveness of the proposed method is illustrated with numerical examples using V-shape and circular shape formations.