Emergence of Functional Modularity in Robots