Regulation with on-line gravity compensation for robots with elastic joints