Dynamic scaling of trajectories for robots with elastic joints