This paper proposes a new method to solve the problem of foraging in swarm robotics. This research approach is inspired by the collective behaviours of some species of bats that communicate the location of food or nests to other group using sound signals. A mechanism has been established a mechanism for more effective communication between agents. Within the framework of a self-organizing system without a central controller and through coordination mechanisms in individuals, we propose a way to prevent overcrowding at the point of exploitation and continue exploration. In this research, homogeneous agents, independently , with limited perception and processing ability, can determine and change their role in the group, and according to their role, they perform various tasks and cooperate and interact with other agents, and change and determine the roles of the agents according to rules, social or threshold time is done according to a probabilistic model. We tested the proposed method in a simulation environment and showed the performance of a group of individual agents with minimal cognitive and processing abilities.