Explicit formulas for Carnot-Carathéodory distances on Carnot groups Let $G$ be a Carnot group (aka stratified group), so that $G$ is a connected and simply connected finite-dimensonal Lie group, whose Lie algebra $\mathfrak{g}$ admits a decomposition $\mathfrak{g} = V_1 \oplus \dots \oplus V_n$ where $[V_1, V_k] = V_{k+1}$.  Let $\mathcal{H} \subset TG$ be the left-invariant "horizontal distribution" which agrees with $V_1$ at the identity.   Then $\mathcal{H}$ is bracket generating.  If we fix an inner product $\langle \cdot, \cdot \rangle$ on $V_1$, we obtain a left-invariant sub-Riemannian metric $g$ on $G$.
Let $d$ be the corresponding Carnot–Carathéodory distance on $G$.  That is, the distance $d(x,y)$ is the length of the shortest horizontal path joining $x$ to $y$.
If $G = \mathbb{H}^{2m+1}$ is a Heisenberg group, i.e. $n=2$ and $\dim V_2 = 1$, then an "explicit" formula for $d$ is known [1], for any inner product on $V_1$.  (As Richard Montgomery points out, it is not explicit in the strongest sense because it is in terms of a solution of a transcendental equation.  But that sort of thing is explicit enough for my purposes.)
There are also "explicit" formulas known in case $(G, \langle \cdot,\cdot \rangle)$ is H-type in the sense of Kaplan [2]; see [3,4,5].

Are there any other (classes of) Carnot groups for which we know how to "explicitly" compute the distance $d$?


[1]. Beals, Richard W.; Gaveau, Bernard; Greiner, Peter C., Hamilton-Jacobi theory and the heat kernel on Heisenberg groups, J. Math. Pures Appl., IX. Sér. 79, No.7, 633-689 (2000). ZBL0959.35035.
[2]. Kaplan, Aroldo, Fundamental solutions for a class of hypoelliptic PDE generated by composition of quadratic forms, Trans. Am. Math. Soc. 258, 147-153 (1980). ZBL0393.35015.
[3]. 
Korányi, Adam, Geometric properties of Heisenberg-type groups, Adv. Math. 56, 28-38 (1985). ZBL0589.53053.
[4] Rigot, Séverine, Counter example to the Besicovitch covering property for some Carnot groups equipped with their Carnot-Carathéodory metric, Math. Z. 248, No. 4, 827-848 (2004). ZBL1082.53030.
[5]. Tan, Kang-Hai; Yang, Xiao-Ping, Characterisation of the sub-Riemannian isometry groups of $H$-type groups, Bull. Aust. Math. Soc. 70, No. 1, 87-100 (2004). ZBL1070.53013.
 A: To my knowledge, there are two other classes for which one can get (possibly partial) explicit formulas for the distance. 
EDIT after Montgomery's answer. "Explicit formula" = at least as explicit as the distance formula for the standard Heisenberg group, i.e. including trascendental functions.
Generalized H-type groups
These are step $2$ Carnot groups that generalize H-type ones. They have been introduced in this recent preprint.
Let $\mathfrak{g} = \mathfrak{g}_1 \oplus \mathfrak{g}_2$ the stratified, nilpotent Lie algebra of a step $2$ Carnot group. For all $Z \in \mathfrak{g}_2$ we define the skew-symmetric operator $J_Z : \mathfrak{g}_1 \to \mathfrak{g_1}$ by the formula
$$
\langle X, J_Z Y \rangle = \langle Z, [X,Y]\rangle, \qquad \forall \, X, Y \in \mathfrak{g}_1.
$$
Here, we extended the left invariant scalar product $\langle \cdot,\cdot \rangle$ also on $\mathfrak{g}_2$, in some arbitrary way. However, the following definitions does not depend on this choice.
We say that such a Carnot group is of generalized $H$-type if there exists a symmetric, non-zero and non-negative operator $S: \mathfrak{g}_1 \to \mathfrak{g}_2$ such that
$$
J_Z J_W + J_W J_Z = 2 \langle Z,W \rangle S^2, \qquad \forall\, Z,W \in \mathfrak{g}_2.
$$
If $\dim(\mathfrak{g}_1) = 2d$ and $S = \mathrm{Id}$, then you obtain classical H-type groups in the sense of Kaplan.
If $\dim\ker(S)>0$, then the generalized H-type Carnot group admit non-trivial abnormal minimizers.
I think that for this class of Carnot groups, the distance can be explicitly computed, even if it is not done in a completely explicit way in the literature. The geodesic flow is explicit, and so it is the cut locus, hence it should be straightforward to find the shortest geodesic joining any two points, and in turn the sub-Riemannian distance. The explicit formula will indeed depend on the invariants of the structure, that is the eigenvalues of $S$.
Free, step $2$ Carnot groups
Another class for which something is known more or less explicitly are free, step $2$ Carnot groups, i.e. $\mathfrak{g} = \mathbb{R}^k \oplus \mathbb{R}^k \wedge \mathbb{R}^k \simeq \mathbb{R}^k \oplus \mathfrak{so}(k)$ is the free nilpotent Lie algebra of step $2$. Let me call this group $\mathbb{G}_k$. When $k=2$ indeed you obtain the 3D Heisenberg group. Identifying $\mathbb{G}_k$ with its Lie algebra in a standard way, let $p = (x,Y) \in \mathbb{R}^k \oplus \mathfrak{so}(k)$. Then the distance between the origin and any ``vertical point'' is explicitly known. Indeed, observe that $Y$ is a skew-symmetric matrix of dimension $k$. Then, letting $\mathrm{rank}(Y) = 2r$ and $0<\alpha_1\leq \dots \leq \alpha_r$ the repeated absolute values of the non-zero eigenvalues of $Y$, one has
$$ d((0,0),(0,Y))^2 = 4\pi \sum_{j=1}^r(r-j+1)\alpha_j .$$
A similar formula appeared in this famous paper by Brockett:
Brockett, R.W., Control theory and singular Riemannian geometry, New directions in applied mathematics, Pap. present. 1980 on the Occas. of the Case centen. Celebr., 11-27 (1982). ZBL0483.49035.  
Another proof is in the appendix A of this paper.
A: I would argue, to the contrary, that there is NO explicit formula for
the distance function, even for the standard 3 dimensional Heisenberg group.
Look at eq (1.40) of your ref [1].  The variable $\theta_c$ there is the (first) zero of a transcendental function $\mu$ (see eq. (1.26).)  There is a distance function.  The geodesics can be written down explicitly.  The unit sphere can be explicitly be parameterized.  But you cannot write down a recognizably explicit formula for the distance $d((0,0,0), (x,y,t))$ from the origin $(0,0,0)$ to (x,y,t) [in the coordinates of [1]].  It is a remarkable fact: no explicit distance function while there is an explicit rational expression (due to Folland) for the fundamental solution to the subLaplacian in this case.
A: As pointed out by Richard Montgomery, there is no formula expressed in terms of elementary functions for the Carnot-Caratheodory distance between any two points, even in the case of the Heisenberg group. In the answer provided below we will see an explicit formula involving an inverse of an elementary function which is Corollary 3.2 in [2]. It is perhaps easily seen to be equivalent to (1.40) in [1] (see the answer of Richard Montgomery), but I haven't checked it.
The Heisenberg group $\mathbb{H}^n$ is $\mathbb{C}^n\times\mathbb{R}=\mathbb{R}^{2n+1}$ given the structure of a Lie group with multiplication
\begin{split}
&(z,t)*(z',t')=
\Big(z+z',t+t'+2 {\rm Im}\, \sum_{j=1}^nz_j\overline{z_j'}\Big)\\
&=
\Big(x_1+x_1', \dots , x_n + x_n' , y_1+y_1', \dots, y_n+y_n', t+t'+2 \sum_{j=1}^n (x_j' y_j - x_j y_j')\Big).
\end{split}
A basis of a Lie algebra is given by
$$
X_j = \frac{\partial}{\partial x_j} + 2y_j \frac{\partial}{\partial t}, 
\quad 
Y_j= \frac{\partial}{\partial y_j} - 2x_j \frac{\partial}{\partial t}, 
\quad 
T=\frac{\partial}{\partial t},
\quad
j=1,2,\ldots,n.
$$
The Heisenberg group is equipped with the horizontal distribution 
$$
H\mathbb{H}^n = \mathrm{span} \{ X_1,\dots, X_n, Y_1,\dots,Y_n \}.
$$
The horizontal distribution is equipped with a Riemannian metric $g$ so that the basis $\{ X_1,\dots, X_n, Y_1,\dots,Y_n \}$ of $H\mathbb{H}^n$ is orthonormal. 
Horizontal curves are the curves that are tangent to the horizontal distribution and we compute the length of such a curve with respect to the metric $g$ on 
$H\mathbb{H}^n$. The Carnot-Caratheodory distance $d_{cc}(p,q)$ between $p,q\in\mathbb{H}^n$ is the infimum of lengths of horizontal curves connecting $p$ and $q$.
Define $H:(-1,1) \to \mathbb{R}$ as
$$
H(s) = \frac{2 \pi}{1 - \cos(2 \pi s)} \left( s-\frac{\sin(2 \pi s)}{2 \pi} \right)=
\frac{\frac{2\pi s}{3!}-\frac{(2\pi s)^3}{5!}+\frac{(2\pi s)^5}{7!}-\ldots}{\frac{1}{2!}-\frac{(2\pi s)^2}{4!}+\frac{(2\pi s)^4}{6!}-\ldots}\, .
$$
$H$ is a real analytic diffeomorphism of $(-1,1)$ onto $\mathbb{R}$ so the inverse $H^{-1}:\mathbb{R}\to (-1,1)$ is a real analytinc diffeomorphism too.

Theorem. (Corollary 3.2 in [2]). For $z\neq 0$, the Carnot-Caratheodory distance between the origin $(0,0)$ and $(z,t)$, equals 
  $$
 d_{cc}((0,0),(z,t)) = t \sin(\pi H^{-1}(t|z|^{-2}))|z|^{-1} +
 |z|\cos(\pi H^{-1}(t|z|^{-2})). 
$$

Using a fact that left translations on the Heisenberg group are isometries, we can obtain a formula for the distance between any two points. It also follows that the Carnot-Caratheodory distance is a real analytic function away from the center of the group.
[1]. R. W. Beals,B. Gaveau, P. C. Greiner, Peter C., Hamilton-Jacobi theory and the heat kernel on Heisenberg groups, J. Math. Pures Appl., IX. Sér. 79, No.7, 633-689 (2000). ZBL0959.35035.
[2]  P. Hajłasz, S. Zimmerman, Geodesics in the Heisenberg group. Anal. Geom. Metr. Spaces 3 (2015), 325–337.
