Robustification of sample-and-hold controllers for the consensus problem