Tutorial: Gait and Trajectory Optimization for Legged Robots