Formation Control through Environment Pattern Recognition for a Multi-robot Architecture