A linear-time algorithm for minimum-time velocity planning of autonomous vehicles