SMS dit: Optimization for non-periodic dynamic motions of legged systems