Dynamic motion of quadrupedal robots on challenging terrain: a kinodynamic optimization approach