Indirect Trajectory Optimization Using Automatic Differentiation