Skip to main content
. 2012 Sep 18;12(9):12772–12797. doi: 10.3390/s120912772
Algorithm 4. Disperse Pseudocode.
if Any Avoid Obstacles condition is triggered then
 Do the avoiding obstacle turning or translating action immediately (do not return an AvoidObstacleAngle, but stop and turn the robot in-situ).;
 //Doing this operation immediately and not implementing a fusion with the disperse behavior resulted in a more efficient dispersion effect, this is why it is not treated as the avoid obstacles behavior is implemented.
else
 Determine the number of kins inside the Comfort Zone distance parameter;
if Number of Kins inside Comfort Zone = = 0 then
  return Status = ReadyToExplore;
else
  Status = Dispersing;
  if Number of Kins inside Comfort Zone > 1 then
   Determine the centroid of all robots' poses;
   if Distance to Centroid < Dead Zone then
    Set DrivingSpeed equal to 1.5 * MaxDrivingSpeed, and do a turning action to an orthogonal angle towards centroid location;
   else
    Set DrivingSpeed equal to MaxDrivingSpeed, and do a turning action to an orthogonal angle towards centroid location;
   end
  else
   if Distance to Kin < Dead Zone then
    Set DrivingSpeed equal to 1.5 * MaxDrivingSpeed, and do a turning action to an orthogonal angle towards kin location;
   else
    Set DrivingSpeed equal to MaxDrivingSpeed, and do a turning action to an orthogonal angle towards kin location;
   end
  end
end
end