Task-Driven Perception and Control for Robust and Efficient Autonomy