Trajectory planning using higher order motion specifications