move speed phase computation to speed planning function