Distributed control of multi-agent systems with switching topology, delay, and link failure