  This paper develops numerical methods for optimal control of mechanical
systems in the Lagrangian setting. It extends the theory of discrete mechanics
to enable the solutions of optimal control problems through the discretization
of variational principles. The key point is to solve the optimal control
problem as a variational integrator of a specially constructed
higher-dimensional system. The developed framework applies to systems on
tangent bundles, Lie groups, underactuated and nonholonomic systems with
symmetries, and can approximate either smooth or discontinuous control inputs.
The resulting methods inherit the preservation properties of variational
integrators and result in numerically robust and easily implementable
algorithms. Several theoretical and a practical examples, e.g. the control of
an underwater vehicle, will illustrate the application of the proposed
approach.
