Learning agile and dynamic motor skills for legged robots