Research Article

Color-Coded Light Signals Based Communication for Swarming Behaviors in Mobile Robotic System

Algorithm 1

Obstacle avoidance algorithm.
  Data: IR sensor readings: (S1, S2, S3)
  Result: Obstacle avoidance motion
1 Function Avoid Obstacle ():
2  Read sensor values S1, S2, S3
3if (S1 > threshold) or (S2 > threshold) or (S3 > threshold) then
4   if (S1 < threshold) and (S2 > threshold) and (S3 < threshold) then
5    Move back
6    Turn left
7   else
8    if (S1 < threshold) and (S2 < threshold) and (S3 > threshold) then
9     Turn left
10    else
11     Turn right
12    end
13   end
14else
15   Move forward
16end
17 end