  In this work, we consider a mechanical system whose mass tensor implements a
scalar product in a Riemannian manifold. This system is controlled with the
help of forces and torques. A cost functional is minimized to achieve an
optimal trajectory. In this contribution, this cost function is supposed to be
an arbitrary regular function invariant under a change of coordinates. Optimal
control evolution based on Pontryagin's principle induces a covariant
second-order ordinary differential equation for an adjoint variable featuring
the Riemann curvature tensor. This second order time evolution is derived in
this contribution.
