Controlled synchronization of mechanical systems with a unilateral constraint