Intelligent walking gait generation for legged robots