A hybrid dynamical extension of averaging and its application to the analysis of legged gait stability. (February 2018)