A modular network for legged locomotion