Closed-loop speed control of hydraulic motors