An apparatus on a vehicle comprises one or more sensors, one or more nozzles that output fluid to clean the respective one or more sensors, and a compressor that generates fluid such as compressed air. The compressor is in fluid communication with the one or more nozzles. The apparatus further comprises one or more processors, and a memory storing instructions that, when executed by the one or more processors, cause the system to predict a trajectory of the vehicle and control an operation of the compressor based on the predicted trajectory of the vehicle.