  In the paper [P. Cannarsa, C. Mendico, Asymptotic analysis for
Hamilton-Jacobi- Bellman equations on Euclidean space, (2021) Arxiv], we proved
the existence of the limit as the time horizon goes to infinity of the averaged
value function of an optimal control problem. For the classical Tonelli case
such a limit is called the critical constant of the problem. In the special
case of sub-Riemannian control systems, we also proved the existence of a
critical solution, that is, a continuous solution to the Hamilton-Jacobi
equation associated with such a constant, which also coincides with its
Lax-Oleinik evolution. Here, we focus our attention on the sub- Riemannian case
providing a variational representation formula for the critical constant which
uses an adapted notion of closed measures. Having such a formula at our
disposal, we define and study the Aubry set. First, we investigate dynamical
and topological properties of such a set w.r.t. a suitable class of minimizing
trajectories of the Lagrangian action. Then, we show that critical solutions to
the Hamilton-Jacobi equation are horizontally differentiable and satisfy the
equation in classical sense on the Aubry set.
