Pātuhitia tēnei: Control of switching systems by invariance analysis