  Imitation Learning (IL) is a powerful technique for intuitive robotic
programming. However, ensuring the reliability of learned behaviors remains a
challenge. In the context of reaching motions, a robot should consistently
reach its goal, regardless of its initial conditions. To meet this requirement,
IL methods often employ specialized function approximators that guarantee this
property by construction. Although effective, these approaches come with a set
of limitations: 1) they are unable to fully exploit the capabilities of modern
Deep Neural Network (DNN) architectures, 2) some are restricted in the family
of motions they can model, resulting in suboptimal IL capabilities, and 3) they
require explicit extensions to account for the geometry of motions that
consider orientations. To address these challenges, we introduce a novel
stability loss function, drawing inspiration from the triplet loss used in the
deep metric learning literature. This loss does not constrain the DNN's
architecture and enables learning policies that yield accurate results.
Furthermore, it is not restricted to a specific state space geometry;
therefore, it can easily incorporate the geometry of the robot's state space.
We provide a proof of the stability properties induced by this loss and
empirically validate our method in various settings. These settings include
Euclidean and non-Euclidean state spaces, as well as first-order and
second-order motions, both in simulation and with real robots. More details
about the experimental results can be found in: https://youtu.be/ZWKLGntCI6w.
