Scattering of a legged robot in a heterogeneous granular terrain