We investigate the problem of how to make a multi-robot system performing a cooperative task by inducing a set of emergent actions. We model the environment dynamics by considering some parameters that
express the ability of each robot to perform its task. Thus, the members of a group of robots become aware of their ability to realize some tasks by simply computing some quality function Q of the
configuration pattern of the environment. A role assignment schema allows roles to be swapped among the robots of the group in order to select the best behaviors able to perform the task cooperatively.
We illustrate this approach by showing how two soccer robots were able to exchange a ball, during a real game, by combining the use of efficient collision avoidance algorithms with role swapping triggered
by the value of the above quality function Q.