Discloses whole-body model predictive control and real-time footstep placement for dynamically balanced bipedal and quadrupedal robots traversing uneven, slippery, or obstructed terrain using onboard stereo perception and high-bandwidth torque-controlled actuators.