Optimizing energy consumption for legged robot by adapting equilibrium position and stiffness of a parallel torsion spring