Learning to enhance multi-legged robot on rugged landscapes