  Hybrid dynamical systems with nonlinear dynamics are one of the most general
modeling tools for representing robotic systems, especially contact-rich
systems. However, providing guarantees regarding the safety or performance of
nonlinear hybrid systems remains a challenging problem because it requires
simultaneous reasoning about continuous state evolution and discrete mode
switching. In this work, we address this problem by extending classical
Hamilton-Jacobi (HJ) reachability analysis, a formal verification method for
continuous-time nonlinear dynamical systems, to hybrid dynamical systems. We
characterize the reachable sets for hybrid systems through a generalized value
function defined over discrete and continuous states of the hybrid system. We
also provide a numerical algorithm to compute this value function and obtain
the reachable set. Our framework can compute reachable sets for hybrid systems
consisting of multiple discrete modes, each with its own set of nonlinear
continuous dynamics, discrete transitions that can be directly commanded or
forced by a discrete control input, while still accounting for control bounds
and adversarial disturbances in the state evolution. Along with the reachable
set, the proposed framework also provides an optimal continuous and discrete
controller to ensure system safety. We demonstrate our framework in several
simulation case studies, as well as on a real-world testbed to solve the
optimal mode planning problem for a quadruped with multiple gaits.
