Keywords

1 Introduction

Robot swarms are a distributed system of autonomous mobile robots that collaboratively execute some complex tasks. Swarms of low-cost, weak, simple robots are emerging as a viable alternative to using a single powerful and expensive robot. In the traditional model of robot swarms, the mobile robots are assumed to be autonomous (there is no central control), homogeneous (they execute the same distributed algorithm), anonymous (they have no unique identifiers), identical (they are indistinguishable by their appearance) and disoriented (they do not agree on any global coordinate system). The robots do not have any direct means of communication. Each robot is equipped with sensor capabilities (i.e., vision) to perceive the positions of the other robots. The robots operate in Look-Compute-Move (LCM) cycles: when a robot becomes active it takes a snapshot of the positions of the other robots, then computes a destination based on the snapshot using a deterministic algorithm (Compute), and then moves towards the destination along a straight line (Move).

The opaque robots or obstructed visibility model assumes that visibility can be obstructed by the presence of other robots: that is, two robots can see each other if and only if no other robot lies on the line segment joining them. The fundamental problem in this model is the Mutual Visibility problem: starting from arbitrary distinct positions in the plane, the robots have to reposition themselves, within finite time and without colliding, to a configuration in which they are in distinct locations and no three of them are collinear. The problem is important as it provides a basis for any subsequent task requiring complete visibility. We consider this problem in the robots with lights or luminous robots model [8, 10]. In this model, each robot is equipped with an externally visible light which can assume a constant number of predefined colors.

1.1 Our Contribution

In this paper, we have considered the Mutual Visibility problem in a grid based terrain. The infinite grid is a natural discretization of the Euclidean plane. Traditional spatial representation methods in robot navigation commonly represent the world as a two dimensional grid around the robot. Grid type floor layouts are also commonly implemented in real life robot navigation systems, e.g., industrial Automated Guided Vehicles (AGV), using magnets or optical guidances on the floor [3]. The simple model of movement along grid lines from one grid point to another can be easier to implement for robots with weak mechanical capabilities as they may not be able to execute accurate movements in arbitrary directions or by arbitrarily small amounts. Although the simple model of movement may be easier to physically execute, the restrictions imposed on the movements of the robots pose the main difficulty of the algorithmic problem. Our proposed distributed algorithm solves the Mutual Visibility problem on infinite grid for any arbitrary initial configuration. We have solved the problem in the luminous robots model using 11 colors.

1.2 Earlier Works

While fundamental problems in autonomous mobile robots like Gathering have been studied in grid environments [5,6,7, 11, 17], the Mutual Visibility problem has only been studied in continuous Euclidean plane. The first distributed algorithm for the Mutual Visibility problem was presented by Di Luna et al. [9] for oblivious and semi-synchronous robots. Later, Sharma et al. [13] analyzed and modified the round complexities of the algorithm in the fully synchronous model. The Mutual Visibility problem under the luminous robots model was first studied by Di Luna in [8]. They solved the problem with semi-synchronous scheduler using 3 colors and with asynchronous schedulers using 3 colors under one axis agreement. Later Sharma et al. [14] attained this result using only 2 colors both for semi-synchronous and for asynchronous robots. Then a series of papers [15, 16] appeared aiming towards reducing the runtime of the algorithm. Recently Bhagat and Mukhopadhyaya [4] have solved the problem for asynchronous robots without any agreement on coordinate axes or chirality. The problem has also been considered for fat robots [12] and faulty robots [2].

2 Model and Definitions

In this section, we present the model and some basic definitions.

Robots: We consider a set of \(N\ge 3\) homogeneous, autonomous, anonymous and identical robots \(\mathcal {R} = \{r_1, r_2, \dots , r_N\}\) deployed on a two dimensional infinite grid. All the robots are initially positioned on distinct grid points. The robots are assumed to be dimensionless and modeled as points on the plane. The robots do not have access to any global coordinate system. The total number of robots N is not known to them.

Movement: The movement of the robots are restricted only along grid lines from one grid point to one of its four neighboring grid points. Traditionally in discrete domains, robot movements are assumed to be instantaneous. For simplicity of analysis, we also assume the movements to be instantaneous. This implies that the robots are always seen on grid points, not on edges. However, our strategy will also work without this assumption.

Lights: Each robot is equipped with an externally visible light which can assume a constant number of predefined colors. The robots explicitly communicate with each other using these lights. The lights are persistent (i.e., the color is not erased at the end of a cycle), but otherwise the robots are oblivious. The colors used in our algorithm are \(\mathcal {C} \,{=}\, \{Off, Boundary, Request Expansion, Expanding, Moving1, Rectangle, Square, Next To Corner, Moving2, Moving3, Done\}\).

Visibility: The visibility range of the robots is unlimited, but can be obstructed by the presence of other robots. A robot \(r_i\) can see another robot \(r_j\) if and only if there are no robots on the straight line segment \(\overline{r_i r_j}\). The set of positions of all robots visible by a robot r at time t, expressed in its local coordinate system, is denoted by \(\mathcal {V}_{r}(t)\), or simply \(\mathcal {V}_{r}\) when there is no ambiguity.

Look-Compute-Move Cycles: The robots, when active, operate according to the so-called Look-Compute-Move cycle. In each cycle, a previously idle or inactive robot wakes up and executes the following steps. In the Look phase a robot takes the snapshot of the positions of the robots visible to it represented in its own coordinate system. Based on the perceived configuration, the robot performs computations according to a deterministic algorithm to decide a destination point \(p\in \mathbb {Z}^2\) (either the grid point on which it currently resides or one of the four neighboring grid points) and a color \(c \in \mathcal {C}\). Finally based on the outcome of the algorithm, the robot changes its light to the computed color, and either remains stationary or makes an instantaneous move to an adjacent grid point.

Scheduler: We assume that the robots are controlled by a fully asynchronous adversarial scheduler. This implies that the amount of time spent in Look, Compute, Move and inactive states by different robots is finite but unbounded and unpredictable. As a result, the robots do not have a common notion of time and the configuration perceived by a robot during the Look phase may significantly change before it actually makes a move.

Fig. 1.
figure 1

Illustrations for the geometric definitions given in Sect. 2.

Geometric Definitions: Given a configuration of robots at time t, the smallest enclosing rectangle is defined as the smallest axis-aligned rectangle that contains all the robots. The boundary of the largest rectangle contained inside the smallest enclosing rectangle is called the penultimate layer, and each side of the rectangle is called penultimate line segment. The robots on the boundary of the smallest enclosing rectangle will be called boundary robots, and otherwise interior robots. The boundary of the smallest enclosing rectangle of the interior robots is called the inner boundary, and each side of the rectangle is called inner boundary side. A configuration will be called an empty rectangle if there are only boundary robots. A robot r on a grid line segment \(\mathcal {L}\) will be called non-terminal on \(\mathcal {L}\) if it lies between two robots on \(\mathcal {L}\), and otherwise it will be called terminal on \(\mathcal {L}\) (Fig. 1).

3 The Algorithm

The main difficulty of the problem arises from the restrictions imposed on the movements of the robots. If the four neighboring grid points of a robot are occupied, then any move made by it will lead to a collision. Our plan is to first create an empty rectangle configuration where all the robots are positioned on the boundary of the smallest enclosing rectangle. This phase is called the Interior Depletion phase. Our main idea is to exploit the symmetry of the empty rectangle to our advantage. In the Symmetric Movements phase, the robots will sequentially leave the empty rectangle and form a mutually visible configuration. During the movements, the robots may not be able to perceive the positions of other robots due to obstructed visibility, but can predict their movements from the symmetries of the empty rectangle. The robots at the corners of the empty rectangle will not move in the symmetric movements phase, but, however, will play an important role in the process. The specified lights of the corner robots will guide the movements of the other robots. From their positions relative to these corners, the robots will deduce their destination. However, the empty rectangle created in the interior depletion phase may not have robots at the corner points. So in an intermediate phase, called Corner Creation, the robots terminal on the sides of the empty rectangle will reposition themselves at the corners. These phases are described in more detail in the following subsections.

3.1 Interior Depletion

The main idea of the algorithm is to sequentially move the interior robots to the boundary. In order to avoid collisions, only those robots that are on the inner boundary will move. However, there may not be an empty grid point on the boundary for the robot to position itself. In that case, the robot, using its lights, will ask the boundary robots to expand the boundary. A pseudo-code description of the procedure is presented in Algorithm 1. The geometric functions used in the algorithm are explained briefly in the following. The lights used in this phase are \(\{Off, Boundary, Request Expansion, Expanding, Moving1\}\).

Fig. 2.
figure 2

Illustrations for the function FindSpace().

The lights of all the robots are initially set to Off. Upon waking up, a robot r calls the function OnBoundary() to decide if it is on the boundary. If it finds that there is an open-half plane, delimited by one of the grid lines passing through itself, containing no robots, then it concludes that it is a boundary robot and sets its light to Boundary. If r finds itself in the interior, then it calls the function OnInnerBoundary(). If there is an open-half plane, delimited by one of the grid lines passing through itself, containing only robots with lights set to Boundary, then it is on the inner boundary. Only the robots on the inner boundary are allowed to move towards the boundary. Now, there are two cases to consider: the robot on the inner boundary is either on the penultimate layer or not.

If r is not on the penultimate layer and is terminal on an inner boundary side, then it has to move towards the boundary. But it will not move immediately. First, it will set its light to Moving1. Then in the next round, it will redo the same computations. An interior robot will move only if its light is already set to Moving1 (in some previous round).

On the other hand, if r finds itself on a penultimate line segment \(\mathcal {L}\) and is terminal on \(\mathcal {L}\), then it has to decide whether it is possible to move to the boundary. It does so using the function FindSpace(). The function FindSpace() works in the following way.

For the robot r, let \(\mathcal {S}_r\) denote the portion of the boundary as shown in the Fig. 2a. If \(\mathcal {L}\) contains more than one robot, then define \(\mathcal {H}_r\) as the closed-half plane, delimited by the grid line perpendicular to \(\mathcal {L}\) and passing through r, such that \(\mathcal {L} \cap \mathcal {H}_r\) contains no robot other than r. If there is no other robot on \(\mathcal {L}\) except r, then \(\mathcal {H}_r\) is the entire plane. The robot r will scan \(\mathcal {H}_r \cap \mathcal {S}_r\) for an empty grid point. If it finds an empty point, it makes sure that the shortest path to that point is not blocked by some other robot. Even if it finds an unobstructed empty point on \(\mathcal {H}_r \cap \mathcal {S}_r\), a move towards it can lead to a collision. To avoid this, it must make sure that there are no robots with light Moving1 within Manhattan distance 2 in the direction in which it intends to move. See Fig. 3.

Fig. 3.
figure 3

Illustrations for the function FindSpace(). (a) The robot \(r_1\) finds an empty grid point, while \(r_2\) does not find any empty grid point. (b) The robot \(r_1\) finds an empty grid point, but the shortest paths leading to it are blocked by other robots. (c)–(d) The robot r finds an empty grid point but there is a robot with light Moving1 within Manhattan distance 2 in the direction it should move to get there. (e) There is a robot \(r_1\) with light Moving1 within Manhattan distance 2, but not in the direction towards the empty point. Hence, FindSpace() will return True for r. (f) r is the only terminal robot on the penultimate line segment, and hence \(\mathcal {H}_r \cap \mathcal {S}_r = \mathcal {S}_r\). It has found two empty grid points in \(\mathcal {S}_r\). Here, it will choose the empty grid point on the left, because on the right side there is a robot with light Moving1 within Manhattan distance 2.

If the function FindSpace() returns True, then r will move towards the empty grid point on the boundary. Again, it will move only if its light is already set to Moving1, otherwise it will only change its light to Moving1. If FindSpace() returns False, r will set its light to RequestExpansion, requesting the boundary robots to expand the smallest enclosing rectangle so that an empty space is created on the boundary.

figure a

Now consider a robot \(r'\) with light Boundary. It will first recheck if it is still on the boundary. It may happen that some of the boundary robots on its grid line had started the expansion earlier, leaving \(r'\) inside the smallest enclosing rectangle. However, these robots will only move at most one hop from the previous boundary. Thus, if \(r'\) finds itself in the interior, it can move to the new boundary in a single step. If \(r'\) is on the boundary, and it observes that all terminal robots on the penultimate line segment next to it have set their lights to RequestExpansion, then it will change its light to Expanding and will start moving outwards. If a robot finds its light set to Expanding, it checks whether all its fellow boundary robots from the previous round have completed their moves by checking the penultimate line next to it. If it finds that the expansion is completed, it will change its light to Boundary.

A rigorous proof of correctness of the algorithm is omitted due to space constraints. The following two lemmas address the two main issues regarding the correctness of the algorithm. The proofs of the lemmas in this subsection are briefly presented in Appendix A.

Lemma 1

The interior depletion phase is collision free.

Lemma 2

If a robot r at time \(t_0\) on the penultimate layer sets it light to RequestExpansion, then there exist a time t \((>t_0)\) when the robot r reaches the boundary.

The interior depletion phase is completed when all the robots are on the boundary of the smallest enclosing rectangle, and the lights of all the robots are set to Boundary. However, it may not be possible for the robots to locally detect this. This is because, if the first condition is attained, a robot r can not determine whether the second condition is satisfied, as it may not be able to see all the robots on boundary line on which it resides. We say that a robot detects the partial completion of the interior depletion phase if it can determine if the first condition is satisfied. It does so using the function EmptyRectangle(), which returns True if the following conditions are satisfied:

  1. 1.

    all robots in \(\mathcal {V}_r\) are on the boundary of their smallest enclosing rectangle,

  2. 2.

    the lights of all the robots in \(\mathcal {V}_r\) are set to Boundary.

Lemma 3

The function EmptyRectangle() can detect the partial completion of the interior depletion phase.

Theorem 1

The algorithm Interior Depletion creates an empty rectangle configuration starting from any arbitrary configuration.

3.2 Symmetric Movements

Due to space constraints, we will not describe the corner creation phase. A brief discussion on this phase is given in Appendix C. This phase will require four different lights, namely, Rectangle, Square, NextToCorner and Moving2. The objective of the corner creation phase is to create an empty rectangle configuration with its four corners occupied by robots with specified lights. However, this may not be achievable if the empty rectangle is a square. Due to space restrictions, we will describe the symmetric movements phase assuming that the starting configuration is the generic configuration of a non-square rectangle having four corner robots with lights set to Rectangle. The algorithms for other configurations, like squares with possibly some missing corners or a straight line configuration, are based on the same movement strategy subject to some minor modifications. The lights that will be used in the symmetric movements phase are \(\{Moving3, Done\}\). See Appendix B, for the proofs of the claims in this subsection.

In this phase, the non-terminal robots on the sides of the empty rectangle will leave the boundary and move outwards along the grid line passing through its starting position. The extent of their movement will depend on (1) the length of the sides of the empty rectangle, and (2) the starting position of the robot on the boundary.

Fig. 4.
figure 4

(a) The final mutually visible configuration for a 7 \(\times \) 8 empty rectangle. (b) The coordinate system of the boundary of the rectangle.

The grid points on the boundary of the rectangle will be given coordinates (pk), where \(p = \) the size of the side of the rectangle it belongs to, and \(k = \) its distance from the closest corner. The coordinates of the four corners will be (0, 0). This coordinate scheme is illustrated in Fig. 4b. The group of symmetries of the rectangle is generated by reflections with respect to perpendicular bisectors of its sides. The group of symmetries induces an equivalence relation on the grid points on the rectangle: \(P \sim Q\) if and only if Q can be obtained from P by some reflection operations. This partitions the set of grid points on the rectangle into equivalence classes. The distance, that two robots on starting points belonging to the same equivalence class should move, have to be equal. Two points are equivalent if and only if their coordinates are equal (See Fig. 4b). We shall exploit these symmetries to design a recursive function called \(\textsc {Destination}\) that computes the destination points of the robots. The distance that a robot starting from (pk) should move is \(\textsc {Destination}(m, n, p, k)\), where mn \((m \ge n)\) are size of the sides.

The pseudocode of the function \(\textsc {Destination}\) is omitted. We shall briefly sketch out the recursive computation of the destination points corresponding to all the points on the rectangle. At each step, the algorithm computes destinations corresponding to all the points belonging to an equivalence class. In other words, the iteration runs over the set of equivalence classes of the grid points on the rectangle. The set of all the destinations computed up to the ith step of the procedure will be denoted by \(\mathcal {C}_i\).

Step 0: Robots at the corners (\(k = 0\)) will not move. Hence, \(\mathcal {C}_0\) consists of the starting positions of the corner robots.

Step 1 and 2: At step 1 and 2, the destinations corresponding to the middle points of the sides, i.e., \(k = {\lceil \frac{m}{2} \rceil } - 1\) and \({\lceil \frac{n}{2} \rceil } - 1\), are computed. Suppose we are computing the destinations corresponding to the middle points of a side AB. Draw two straight lines through A and B, parallel to the two diagonals of the rectangle. Let \(\mathcal {H}_A\) and \(\mathcal {H}_B\) be the open half-planes delimited by these straight lines that do not contain the rectangle. Then the destination of the robot(s) at the middle of AB will be the nearest grid points belonging to \(\mathcal {H}_A \cap \mathcal {H}_B\) (the shaded region in Fig. 8 in the Appendix).

In these steps, the destinations corresponding to the remaining grid points on the larger side are computed. This is done in a recursive manner. Suppose that at the ith step, we are to compute the destinations for grid points \(\{x_1, x_2, x_3, x_4\}\). We shall denote the computed destination corresponding to \(x_j\) as \(y_j\). The destinations are computed according to the following rules.

  1. 1.

    The destinations computed in step i are strictly farther from the rectangle than the ones computed in step \(i-1\).

  2. 2.

    Choose any one of \(\{x_1, x_2, x_3, x_4\}\), say \(x_1\). Then the corresponding destination \(y_1\) is the grid point (on the grid line passing through \(x_1\)) closest to the rectangle (respecting condition 1) such that no three points in \(\mathcal {C}_{i-1} \cup \{y_1\}\) are collinear. The destinations \(y_2, y_3, y_4\) are obtained from \(y_1\) from the reflectional symmetries. Since no two points in \(\mathcal {C}_{i-1}\) are collinear with \(y_1\), from the reflectional symmetries we can say that the same is true for \(y_2, y_3\) and \(y_4\). But it is still not apparent that no three points in \(\mathcal {C}_{i} =\) \(\mathcal {C}_{i-1} \cup \{y_1, y_2, y_3, y_4\}\) are collinear. We prove this in Lemma 4.

    In these steps, the destinations corresponding to the grid points on the smaller side are computed. The procedure is the same as before.

Lemma 4

If no three points in \(\mathcal {C}_{i-1}\) are collinear, then the same is true for \(\mathcal {C}_{i}\).

Theorem 2

No three points of the destinations computed by the function Destination are collinear.

Proof

Since no three points of \(\mathcal {C}_{0}\) are collinear, the result immediately follows from the Lemma 4.

We shall now describe the movement strategy. A pseudocode description of the procedure is given in Algorithm 2. As mentioned earlier, the algorithm is described for only non-square empty rectangle configurations with four occupied corners. In the function Destination, the destinations corresponding to the middle points of the sides were computed first in the recursive process. But the movements will occur in the exactly opposite order. The robots will sequentially leave the boundary with the ones closest to the corner moving first. A boundary robot will call the function EligibleToMove() to determine whether it should start moving. It checks if the following conditions are satisfied:

  1. 1.

    It can see at least one corner robot on its boundary side, and two corner robots on the opposite side. In Fig. 5, \(r_1\) can see \(c_1, c_3\) and \(c_4\). \(r_3\) can also see \(c_2, c_3\) and \(c_4\). But \(r_5\) cannot see \(c_1\) or \(c_2\), and so it is not eligible to move yet.

  2. 2.

    If there were robots initially on its boundary side between it and the corner(s) it can see, they have already completed their movements and changed their lights to Done. The robot \(r_1\) checks this by scanning the shaded region A, which is empty. Hence \(r_1\) is eligible to move. But when \(r_3\) scans the region B, it finds \(r_2\) with its light set to Moving3, and hence it will not move.

Fig. 5.
figure 5

Illustrations supporting the proof of Theorem 3

If EligibleToMove() returns True, the robot will change its light to Moving3 and leave the boundary. Note that a robot can leave the boundary even before the corner creation phase is completed. This is because the robot leaves the boundary when it sees at least three corners. The fourth corner is probably yet not created. We call this a premature move. But it can determine if it has made a premature move just after moving one hop from the boundary. This is because if the other corner is created, it will be able to see from the grid line one hop away from the boundary. If it can’t, it will wait for the completion of the corner creation phase. Note that at most one robot on a boundary line can make a premature move. Also note that Premature() will always return false if the robot is more than one hop away from the boundary.

When the robot is moving, after each one hop move it has to compute \(\textsc {Destination}(m,n,p,k)\) to find whether it has reached its destination. But that requires the knowledge of m and n. Consider the robot \(r_2\) in Fig. 5. Since the robots closer to the corners move farther, \(r_2\) will always be able to see \(c_2\) and \(c_3\). But to know the size of both the boundary sides, it also has to see another corner. If it cannot see \(c_1\), then its view must be obstructed by some robot in the shaded region in Fig. 5. So \(r_2\) now has to decide if its view is obstructed by a moving robot or a robot that has reached its destination. If \(r_2\) scans the shaded region and it finds a robot with light Moving3 below it, then BlockedByMovingRobot() will return True. Notice that if \(r_2\) can’t see \(c_1\), it can not identify the actual extent (on the left side) of the shaded region. But this is not a major problem as there can not be any robots (from any branch) moving in the area beyond the left boundary of the shaded region. The robots, upon reaching their destination points, will change their lights to Done.

figure b

Theorem 3

Algorithm Symmetric Movements correctly leads all the robots to the destinations computed by the Destination function.

From Theorem 2 and 3, we can conclude the following.

Theorem 4

The Mutual Visibility problem on infinite grid can be solved using 11 colors.

Note that the robots terminate the execution once their lights are set to Rectangle or Done. We say that the Mutual Visibility problem is solved with detection if we additionally require that a robot terminates only after it detects that the mutual visibility is attained. This can be easily achieved, but will require one extra color. Each corner robot can determine if the symmetric movements have been completed in its quadrant, and then changes its light to the extra color. When all four corner robots change their colors, it implies that a mutually visible configuration is attained and all the robots in the configuration can detect this.

Theorem 5

The Mutual Visibility problem on infinite grid can be solved with detection using 12 colors.

4 Conclusion

Our proposed distributed algorithm solves the Mutual Visibility problem on infinite grid for any arbitrary initial configuration under the luminous robots model using 11 colors. We considered the robots as dimensionless points. A more realistic model would be to consider robots with physical extent, i.e., fat robots. The Mutual Visibility problem for fat robots is solved as a subroutine of the gathering algorithm presented in [1]. But it is assumed that each robot knows the size of the team. Recently, Sharma et al. have solved the problem in a fully synchronous setting [12]. It would be interesting to see if our strategy can be extended to solve the problem for fat robots in asynchronous setting with less assumptions. Another direction would be to investigate if the number of colors used or the number of moves by the robots can be reduced.