Auto-tuning of feedforward friction compensation based on the gradient method