I have a circle of radius 300 cm on whose circumference robots stop after moving in the environment. The robots only have a communication radius of 10 cm such that they can fit 6 robots along the diameter of the communication circle. Robots can only communicate i.e. receive and transmit messages from robots within their communication radius. Now I want to keep track of how many robots are present on the circumference of the 300 cm circle at any instant t.
What I was doing is this :
If robot_1 stops on the circumference on circle then echo "counter=1". Counter is initialized with counter=0
Another robot_2 stops on the circumference and within the comm. radius of robot_1 and recieves the echoed "Counter=1"
It checks its own counter value and if (recived_counter_value > own_counter_value) then own_counter_value=recived counter value+1
Robot_2 then send its counter value to robot_1
Similarly the counter value propogates as robots keep stopping within comm. radius of each other.
But it doesn't seem to work. Robots also have unique IDs so I can keep the track of IDs from which the current robot is receiving messages from but the memory is limited so I'm trying to avoid using the IDs but if you have an algorithm that makes use of ID then please feel free to help.