Optimal Solution of Kinodynamic Motion Planning for the Cart-Pole System