A method to design adaptive controllers for flexible joint robots