  Quadruped animals seamlessly transition between gaits as they change
locomotion speeds. While the most widely accepted explanation for gait
transitions is energy efficiency, there is no clear consensus on the
determining factor, nor on the potential effects from terrain properties. In
this article, we propose that viability, i.e. the avoidance of falls,
represents an important criterion for gait transitions. We investigate the
emergence of gait transitions through the interaction between supraspinal drive
(brain), the central pattern generator in the spinal cord, the body, and
exteroceptive sensing by leveraging deep reinforcement learning and robotics
tools. Consistent with quadruped animal data, we show that the walk-trot gait
transition for quadruped robots on flat terrain improves both viability and
energy efficiency. Furthermore, we investigate the effects of discrete terrain
(i.e. crossing successive gaps) on imposing gait transitions, and find the
emergence of trot-pronk transitions to avoid non-viable states. Compared with
other potential criteria such as peak forces and energy efficiency, viability
is the only improved factor after gait transitions on both flat and discrete
gap terrains, suggesting that viability could be a primary and universal
objective of gait transitions, while other criteria are secondary objectives
and/or a consequence of viability. Moreover, we deploy our learned controller
in sim-to-real hardware experiments and demonstrate state-of-the-art quadruped
agility in challenging scenarios, where the Unitree A1 quadruped autonomously
transitions gaits between trot and pronk to cross consecutive gaps of up to 30
cm (83.3 % of the body-length) at over 1.3 m/s.
