This paper presents control method for multiple two-wheeled mobile robots moving in formation. Trajectory tracking algorithm from  is extended by collision avoidance, and is applied to the different type of formation task: each robot in the formation mimics motion of the virtual leader with a certain displacement. Each robot avoids collisions with other robots and circular shaped, static obstacles existing in the environment. Artificial potential functions are used to generate repulsive component of the control. Stability analysis of the closed-loop system is based on Lyapunov-like function. Effectiveness of the proposed algorithm is illustrated by simulation results.