Adaptive Gait Switching Control Structure using Max Plus in Legged Locomotion