AbstractIn this paper we describe a consensus based control strategy to obtain a formation of groups of mobile robots. Weighted graphs are used to obtain the desired formation–shape while avoiding collisions among the robots. Since mobile robots usually move in unknown and unstructured environments, we show how to extend our control strategy to make the robots avoid collision with obstacles as well. To validate our control strategy, we provide both analytical proofs and simulative and experimental results.