Energetics and mechanics of terrestrial locomotion