  The comparison between time-varying hybrid trajectories is crucial for
tracking, observer design and synchronisation problems for hybrid systems with
state-triggered jumps. In this paper, a systematic way of designing an
appropriate distance function is proposed that can be used for this purpose.
The so-called "peaking phenomenon", which occurs when using the Euclidean
distance to compare two hybrid trajectories, is circumvented by taking the
hybrid nature of the system explicitly into account in the design of the
distance function. Based on the proposed distance function, we define the
stability of a trajectory of a hybrid system with state-triggered jumps and
present sufficient Lyapunov-type conditions for stability of a hybrid
trajectory. A constructive design method for the distance function is presented
for hybrid systems with affine flow and jump maps and a jump set that is a
hyperplane. For this case, the mentioned Lyapunov-type stability conditions can
be verified using linear matrix conditions. Finally, for this class of systems,
we present a tracking controller that asymptotically stabilises a given hybrid
reference trajectory, and we illustrate our results with examples.
