Multi-robot formations: rule-based synthesis and stability analysis