Continuous 2-D Control via State-Machine triggered by Endogenous Sensory Discrimination and a Fast Brain Switch