In practical applications, multi-robot systems may have to simultaneously deal with several tasks: collision-free maneuvers in dynamic environments; tracking certain desired trajectories; forming suitable patterns or geometrical shapes, and/or varying the pattern when necessary. The proposed formation control scheme in this paper addresses these issues. First a dynamic model for a nonholonomic robot prototype is developed. Tracking control is then realized by employing input-output feedback linearization. To achieve typical complex formation missions, a two-layer hierarchical architecture is proposed. At the upper layer, a null-space method is utilized to prioritize the tasks of the robot team and to generate reference trajectories for formation control. In the lower layer, the control scheme for each individual robot guarantees asymptotic tracking of the desired trajectories. Numerical simulations of a realistic case study illustrate the effectiveness of the proposed framework.