Command shaping with constrained peak input acceleration to minimize residual vibration in a flexible-joint robot