| Algorithm 5. Explore Pseudocode. |
| if Status = Dispersing then |
| Disperse; |
| else |
| if Wandering Rate triggers then |
| LocateOpenArea; |
| else |
| Get the current AvoidingPastAngle and AvoidingObstacleAngle; |
| //This is to do smoother turning reactions with larger distances towards obstacles; |
| if Distance to Nearest Obstacle in Front < Aware of Obstacles Distance then |
| DrivingSpeedFactor = DistancetoNearestObstacleinFront/AwareofObstacleDistance; |
| else |
| DrivingSpeedFactor = 0; |
| end |
| DrivingSpeed = DrivingGain * MaxDrivingSpeed * (1 − DrivingSpeedFactor); |
| //Here is the fusion (weighted summation) for simultaneous obstacles and past avoidance; |
| SteeringSpeed = SteeringGain * ((AvoidingPastAngle * AvoidPastGain + AvoidingObstacleAngle * AvoidObstaclesGain)/2); |
| Ensure driving and steering velocities are within max and min possible values; |
| Set the driving and steering velocities; |
| end |
| if m robots near then |
| Status = Dispersing |
| end |
| end |