General Algorithms for the Time-Optimal Trajectory Generation Problem