Time-Optimal Trajectory Planning for Flexible Joint Robots