Dynamic balancing of feedback and feedforward in robotics