Collision-Free Formation Control for Multi-Agent Systems with Dynamic Mapping