The equivalence of controlled lagrangian and controlled hamiltonian systems