Practice Makes Perfect: An Optimization-Based Approach to Controlling Agile Motions for a Quadruped Robot.