Energy-shaping control