A decentralized localization scheme for swarm robotics based on coordinate geometry and distributed gradient descent

In this paper, a decentralized localization scheme using coordinate geometry and distributed gradient descent (DGD) algorithm is presented. Coordinate geometry is proposed to provide a rough estimation of robots’ location instead of the traditional trigonometry approach, which suffers from flip and discontinuous flex ambiguity. Then, these estimations will be used as initial values for DGD algorithm to determine robots’ real position. Evaluated results on real mobile robots show an average mean error of 2.56 cm, which is closed to the minimum achievable accuracy of the testing platform (2 cm). For a team of eight robots, the total average run time of the proposed scheme is 66.7 seconds. Finally, its application in swarm robotics is verified by experimenting with a self-assembly algorithm


Introduction
The studies related to swarm robotics practically focus on how to coordinate large groups of relatively simple robots to carry out complicated tasks such as area exploration, map construction, or harvesting.To achieve highest performance, it is usually necessary for all robots to agree on a global coordinate system as well as their current position in this system.
Conventionally, the work in [1] has proposed a GPS free localization method for indoor applications by using trilateration and trigonometry.However, as pointed out by authors in [2], this method suffers flip and discontinuous flex ambiguity under noisy range measurements.Therefore, they proposed the use of robust quadrilaterals to avoid these errors by excluding nodes that do not meet the noise-threshold requirement.Another approach, which has become the major trend in wireless sensor networks (WSNs) in recent years, is to use global optimization techniques to find the most corrected position of sensor nodes [3,4].The limitation of this method is that it requires the use of anchor nodes which usually employ GPS to have prior knowledge of their actual position.
Another problem in determining a localization scheme for both WSNs and swarm robotics is that it has to be scalable, which means the algorithm can be applied in a system with hundreds or thousands of nodes.Therefore, centralized approaches, which use a center node to distribute network information to all nodes [5], is not favorable as they puts too much strain on the communication channel in large networks.Thus, decentralized approaches, where each node only needs to communicate with its neighbors, is usually applied [1][2][3][4].These approaches are further divided into synchronous and asynchronous methods.Synchronous algorithms mean the state of all nodes in the system are synced.In other words, a node can only go to the next state when all nodes in the system have finished the current state.On the other hand, asynchronous algorithms mean each node can freely change its state without the need to wait for others, thus, it is faster but also more complicated than synchronous ones.
In this work, a synchronous decentralized localizations scheme for swarm robotic platforms is proposed.Instead of using trigonometry as in [1,2], a coordinate geometry method was developed to avoid flip and discontinuous flex ambiguity.To further improve the accuracy of localization results, distributed gradient descent (DGD) algorithm [4] is also integrated into this scheme.In order to verify effects of real noises in range measurements to the proposed approach, it has been implemented on eight mobile robots.Similar to other swarm-robotic platforms, such as Kilobot [6] and E-puck [7], the designed robots can measure their distance to their neighbors, with a mean error of 2 cm, and communicate through wireless signals.Evaluated results show an average mean error of 2.56 cm, which is closed to the minimum achievable accuracy of the testing platform (2 cm).For a team of eight robots, the total average run time is 66.7 seconds.To verify that this localization scheme can be used to provide robots' position for more complicated swarm robotic applications, the self-assembly algorithm DASH [8] is also implemented and shows good results.
The rest of the paper is organized as follows.Section 2 presents the proposed localization scheme.Section 3 discusses the testing platforms.The evaluation results are shown in section 4. Finally, section 5 draws the conclusion.
2 The proposed localization scheme The flow chart of this state is shown in Fig. 1.At the start of the localization scheme, each robot will wait for a random period of time before broadcasting a message to its neighbours.The robots which receive this message will trigger a distance sensing algorithm.The measured results will be stored in a table and sent back to the broadcasting robot.After receiving all measured results, this robot will continue to listen for the same broadcasting message.If none is received until the timer stops, it will jump to the next state.At the end of this state, every robot will have one table storing its distance to its neighbours and their ID.

Figure 2. Exchanging measured results flow chart.
Using the ID from the table of state 1, each robot will request the table of its neighbours as shown in Fig. 2. Thus, every robot will now have a second table which stores the first table of its neighbours.Similar to [1,2], this state has two phrases.Each robot will now establish its own local coordinate system based on the tables from state 1 and 2. It should be noted that no information is exchanged during this state.

Phase 1
At this state, every robot sees it as the origin, robot O or point O. Two neighbours which do not lie on the same line will be chosen.One is assumed to have the position (d OX , 0), robot X or point X, and the other is assumed to have a positive y coordinate, robot Y or point Y.The location of robot Y is calculated by using the triangle ∆OXY.The length of YH edge is calculated by Herons formula.The length of OH edge is determined by using Pythagoras theorem.Because robot Y has positive y coordinate, it only has two possible locations: Y 1 and Y 2 .However, the correct position will have the minimum error between the distance vector and the measured distance as described in step 8 of Algorithm 1. Positions of these three robots will be stored in a third table.Traditionally, by using trigonometry [1], we can locate the position of an unknown point J from three known points I, P, and Q, as long as they do not lie on the same line.But this approach is not accurate in noisy range measurements and can result in errors such as flip ambiguity or discontinuous flex ambiguity, which are well explained in [2].To overcome this issue, we propose another approach as explained in Algorithm 2 and below:

Phase 2
x Step 1 to 3: As shown in Fig. 4, the linear equation D (IP) in general form can be constructed from any two already located robots.
x Step 4 to 13: Calculating the location of point H, with JH is the semiperimeter of the triangle ∆IPJ.From the circle equation, we find two possible locations of H, H 1 and H 2 .The length of IH is obtained by applying Pythagoras theorem to the right triangle ∆IHJ.Similar to phrase 1, the correct location of point H has the minimum error between the distance and the measured distance.
x Step 14 to 23: Since JH and IP are two perpendicular lines, we can construct the linear equation in general form.Again, get two possible locations of robot J .Finally, by comparing the error between distance vectors and the measured distances, we get the correct location.
As can be seen, the coordinate of other robots can now be calculated as long as they are the neighbor of at least three already located robots.In other words, their ID appears in the first table of robot O , robot X , and robot Y .Algorithm 2 will go through all neighbors in the first table of robot O and try to find their position.If new robots are successfully localized, their position and ID will be stored in the third table.Obviously, they can now also be used to locate others.Therefore, whenever a new position is added, the algorithm will go through all remaining neighbors of robot O again.
To further reduce localization errors before going to the next state, each robot will use the gradient descent algorithm to optimize its calculated results as described in Algorithm 3, with is obtained by (1), where N i is the group of neighbors of robot i which are also belong to the local coordinate system of robot O .At the end of this state, tables from state 1 and 2 are no longer needed and can be removed to free memory.The table obtained from this state is called the local coordinate table.
There are two reasons why our proposed algorithm is more accurate than trigonometry approach.Firstly, in the conventional method, angles are used to determine the sign of y coordinate of a robot.As distance measurements are not accurate, this comparison has to tolerate a noise margin.If this margin is too small or too large, the calculated y coordinate is undefined and will cause a flip ambiguity.This error can happen even with robots having high y value.On the contrary, our method uses the error between calculated and measured distances.Therefore, a large error can only happen when robot Q lies near x axis.Obviously, this issue can be solved easily by chosen the robot farthest from x axis as robot Q.Secondly, the conventional method only uses a subset of distance measurements to localize a point while in our proposed scheme, all distance measurements will be used in the gradient descent algorithm to minimize calculated errors.

State 4: Create a unique global coordinate system
After their local coordinate is established, a robot will be chosen as the global origin based on two simple rules: x The higher number of neighbours, the higher priority.
x If the number of neighbours is equal then the smaller ID, the higher priority.Each robot will broadcast a vote message containing its ID and its number of located neighbours from state 3.When a robot receives the higher priority vote, it will replace its current vote and broadcast this vote to its neighbours.Otherwise, it will continue to broadcast its current vote.After the origin robot has been determined, its local coordinate system will be considered as the global coordinate and no further changes are necessary.Then, this robot will request its neighbour to rotate their coordinate table to the global one.After these neighbours have rotated, they will continue to request their neighbours to rotate and so on.In short, this process starts at the origin robot and spreads out to the whole system.The rotation algorithm is the same as the one proposed in [1].
As a result of randomly choosing robot X , robot Y , and the global origin, the network direction will differ each time the localization scheme is run.If this is undesirable, these 3 robots can be predetermined in state 3 and the origin voting phrase can be skipped.

State 5: Errors correction & position updating
Because of the use of angle rotation in state 4, the localization results will have some inaccuracies such as reflection error [2].For example, robot I and robot J successfully locate robot K position.If the coordinate table of these robots rotates a correct angle, then the position of robot K will be the same in both tables.However, if an error occurs, the position of robot K stored in robot I will differ with the one stored in robot J .Furthermore, these errors will propagate and become larger at farther nodes.To correct this, Distributed Gradient Descent (DGD) algorithm, proposed in [4], is modified to apply to swarm robotics as described briefly in Algorithm 4. It should be noted that is also calculated similarly as in (1).
Another important feature in robotic localization is that when a robot moves, it has to quickly update its new location.To do this, after new distance measurements are updated, Algorithm 4 is run again.However the position of neighbors (step 9 to 12) will only need to be asked one time.Obviously, it still has to have at least three already located robots as its neighbors.This updating method not only offers fast response speed but also high accuracy.

The designed testing platform.
To verify the proposed localization scheme, the following requirements are expected: x Each robot can measure the distance from itself to its neighbours.
x Each robot can communicate with its neighbours using wireless signals.The testing platform includes 8 mobile robots.Each has the same main board which consists of a micro-controller (ARM Cortex-M4F TM4C123GH6PM), an RF module (nRF24L01), two electret microphones with two twostage amplifiers, a speaker, three status LEDs, a 6 degrees of freedom IMU, and a battery management circuit as shown in Fig. 5.The total part cost of each robot is $20.68.Without a tool to command and communicate with robots, it is hard to develop and debug collective algorithms.To get over this situation, a wireless control board and a monitoring software (Fig. 6) using C# have been developed.The control board is connected to a PC using USB connection and will send user's commands to all or selective robots.In addition, a wireless bootloader protocol is also implemented to update all robots' firmware at the same time.For distance sensing purpose, the system and TDOA (time difference of arrival) algorithm proposed in [9] (Fig. 7) are implemented.First, the request side will broadcast an RF signal to other robots, then wait for a small amount of time before emitting an 8 KHz signal.Upon receiving the RF signal, the response side will turn on their microphones to sample the audible signal.The difference between the arrival time of the RF signal and the audible signal will be used to calculate the distance between the response and the request side.Similar to [9], each of our robot also stores two calibration parameters: S 0 (intercept) and M s (slope), which are extracted using least square optimization.The maximum measurable distance of our system is 47.5 cm and the mean error is 2 cm.

Evaluation results
The proposed scheme is evaluated based on the error between measured results and known ground truth as expressed in (2), where, bx i and by i are the true position of robot i , and x i and y i are its localization results.

Table .
Evaluation results from 10 test cases.
Testing with 10 different cases (by varying the number of robots and their formation), as shown in Fig. 8, the observed average mean error is 2.56 cm.For an ideal localization algorithm, its σ p cannot be lower than the mean error of distance measurements (2 cm in our system) [10].Therefore, this result shows that the proposed localization method achieves high accuracy.Table I summaries the evaluated results and the processing time.Since there are several states require random wait time, the run time is affected heavily and fluctuates from 54.5 to 96.7 seconds, with an average value of 66.7 seconds.It should be noted that because our approach is a synchronous decentralized method, its scalability is better than centralized methods.However, because each robot has to wait for others to finish their state, an asynchronous decentralized approach may be employed in further researches to improve runtime.
Since localization results are the foundation for more complicated swarm-robotic applications, the proposed method is continued to be verified by combining it with the self-assembly algorithm DASH [8].The localization scheme will provide robots' initial position as well as update their location after moving as described in the final state of section 2. The result is shown in Fig. 9, which successfully changes robots' formation from a star shape to a rectangular shape.

Conclusion
In this work, we have presented a new localization scheme using coordinate geometry to avoid flip and discontinuous flex ambiguity errors in the conventional method.After initial positions are produced, a global optimization using DGD is carried out to improve the accuracy of the whole system.The evaluation results on eight mobile robots, which have limited sensing capabilities, show high accuracy and good processing time.However, better run time can be achieved by employing an asynchronous decentralized approach.The proposed approach can also be applied in WSNs when GPS signals are not available.Finally, the proposed method is used to provide robots' position for selfassembly algorithm named DASH and shows good results.

Figure 3 .
Figure 3.The coordinate of three robots in phrase 1.

Figure 4 .
Figure 4. Finding the position of point J from three known points I, Q, and P.