{'fraction_non_alphanumeric': 0.029452592190234776, 'fraction_numerical': 0.008992697205624962, 'mean_word_length': 4.844797178130511, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Development of a Cooperative Localization System using a UWB Network and BLE Technology

This paper presents the development of a system able to estimate the 2D relative position of nodes in a wireless network, based on distance measurements between the nodes. The system uses ultra wide band ranging technology and the Bluetooth Low Energy protocol to acquire data. Furthermore, a nonlinear least squares problem is formulated and solved numerically for estimating the relative positions of the nodes. The localization performance of the system is validated by experimental tests, demonstrating the capability of measuring the relative position of a network comprised of 4 nodes with an accuracy of the order of 3 cm and an update rate of 10 Hz. This shows the feasibility of applying the proposed system for multi-robot cooperative localization and formation control scenarios.


I. INTRODUCTION
The task of localization is now common to various fields such as mobile robotics, the Internet of Things, Smart Cities and Smart Industries. Therefore, developing low-cost, lowpower devices that can locate themselves is a key factor for successful applications in these fields. The most popular localization systems are based on satellite communications, i.e. GNSS (Global Navigation Satellite System). However, GNSSs do not perform as well indoors or where the direct visibility of satellites is compromised, for example by buildings or trees [1]. In the latter type of situation, research is very active in finding a new reference system. Many approaches exist: ranging from systems based on existing wireless networks, using vision with a known map or exploiting magnetic systems with coils that achieve millimeter precision [2].
In this work, a system able to perform cooperative localization based on Ultra Wide Band (UWB) and Bluetooth Low Energy (BLE) sensors is presented. One of the key contributions of this research is the development of a fullywireless, inexpensive and cooperative system for relative localization. Other works, in fact, such as [3] and [4], exploit wired connections for reading UWB device data and therefore do not have a fully-wireless setup. The long-term goal of this system is to provide real-time relative positions for dynamic robotic systems. The proposed system consists of 4 nodes and 5 Decawave DW1001 UWB transceivers capable of distance estimation with other devices using Two-Way-Ranging (TWR). These devices are not designed to perform cooperative measurements. Instead, they have been conceived and realized for an Anchor-Tag scenario. In this scenario, static and fixed nodes (Anchors) provide distance measurements towards one or more tags that are free to move in the anchor coverage area. In [4], an extensive analysis of the Decawave system is described, aiming at improving its performance and scalability. Anchor-Tag measurements constitute the input for the localization algorithm present in the factory firmware.
This localization algorithm solves a trilateration problem similar to that solved by GNSS. Its solution is based on two key aspects: the definition of a cost function and its minimization. In order to solve that mathematical problem, it is possible to range from linear and non-linear least-squares formulations, or to more advanced statistical analysis techniques such as Multidimensional Scaling (MDS) [5].

II. METHODOLOGY
In this section, the implementation of the proposed cooperative localization system is described, together with the main software and hardware design choices, and the employed conventions.

A. Decawave DWM1001 System Analysis
The proposed localization system is comprised of several nodes, as shown in Fig. 1, forming a UWB network. Each of the nodes is based on a Decawave DWM1001 UWB radio module, which is capable of a nominal ranging accuracy of approximately 10 cm [6]. This module is also equipped with a BLE interface. In particular, to implement each node, a DWM1001-DEV development board is used, which contains a DWM1001 UWB module together with a micro-usb interface, a microcontroller, and additional components.
The manufacturer provides three types of interface between the UWB network and an external control network [7]. Specifically, it is possible to connect a PC to a node of the network using the UART or SPI serial protocols via the usb connector. Additionally, a wireless connection may be established by using an external BLE module or device, such as a smartphone or a PC. Finally, for larger-coverage configurations, the usage of a gateway is suggested, in order to connect different UWB sub-networks.
Within the UWB network, there are two types of nodes: anchors and tags. The anchors are known-position nodes, also known as beacons, whereas the tags are nodes whose positions are estimated by the system. Distance measurements are performed only between nodes of different types, i.e. only between an anchor and a tag, with a maximum update rate of 10 Hz. This is also the maximum update rate of the position estimates provided by the Decawave software. The devices are equipped with Application Programming Interfaces (APIs) for all the different communication channels, sharing the functionalities provided by the same basis layer, as shown in Fig. 2. As illustrated by this diagram, the PANS (Positioning and Networking Stack) firmware library is located below the APIs. This firmware library is developed by Decawave and defines all interactions of the nodes in the UWB network. The ranging system implemented by PANS is based on a Time Division Multiple Access mechanism and applies the doublesided TWR technique, between anchor and tag to measure distance [8].
In TWR the communication is established between two devices: an initiator and a responder. The initiator sends a packet, then the responder replies and finally, after the initiator receives that reply, it sends a final message. The distance is estimated by measuring the time-of-flight (ToF), defined as follows: where the symbols are defined as in Figure 3 and the derivation is provided in [8].

B. Proposed System
The goal of the proposed system is to perform relative cooperative positioning in two dimensions, based on measurements of the distance between the nodes. This requires a sufficient number of measurements so that the relative position of each node of the network can be estimated by trilateration.
To reach this goal, a limitation is given by the PANS firmware, in which distance measurements can only be performed between anchors and tags, as mentioned in Section II-A. Notice that this is just a software limitation and some solutions have been proposed in the literature to circumvent it, such as the system presented in [9]. However, these solutions require a firmware modification, thus present some practical difficulties. For this reason, a different solution that does not require firmware modifications is employed in this paper, based on a specific network configuration.
In particular, the UWB nodes are placed at the corners of a quadrilateral, properly alternating anchors and tags to ensure that each node is involved in at least two distance measurements. Moreover, one of the nodes is comprised of two devices: an anchor and a tag. This allows to obtain all required distance measurements. Finally, to access the information from the UWB network, i.e. the distance measurement results, an external PC establishes a BLE connection with each tag node. The complete network connection scheme is shown in Fig.  4. In the following subsections, the software architecture, the conventions adopted, and the localization method are described in detail.
1) Software Architecture: The main components of the implemented software architecture, as shown in Fig. 5, are the ROS (Robot Operating System) framework, the python PyGatt library [10], and a Non-Linear Least Squares (NLSS) algorithm.
The software is executed on an external PC connected via BLE to the UWB tags. The measurement data received by the Bluetooth adapter in the PC are acquired thanks to the PyGatt library, a python wrapper that allows for reading and writing GATT (Generic Attribute Profile) descriptors. In this case, PyGatt is used to subscribe to the "Location data"  characteristic of the tag nodes. Using this characteristic with notifications enabled, distance measurements can be read.
After being decoded and organized by means of custom structures, the data are put into distinct sockets, one for each tag. The sockets are then read by a custom ROS node, denoted as "Ranging Node" in Fig. 5, which writes them into specific topics. The second ROS node, denoted as "Pose Node", computes an estimate of the positions of all nodes using range measurements acquired from the ROS topics mentioned above. The Pose Node uses the "trf" (Trust Region Reflective) NLSS algorithm, provided by the python scipy library [11], to estimate the position numerically by minimizing the cost function that will be described in Section II-B3.
2) Node Configuration Convention: The 2D trilateration procedure, commonly used for localization applications, requires the measurement of the distances between the target node, i.e. the node to be localized, and two known-position nodes. This is not possible in the case of relative cooperative localization, when none of the nodes has a known absolute position, and only the position of the nodes in a relative coordinate frame is desired.
To define this relative coordinate frame, a convention is adopted. Specifically, as illustrated by Fig. 6, the following constraints on the x and y coordinates of some of the nodes are imposed: • All nodes are placed on the same plane • node 0 is the origin of the coordinate frame, i.e. its coordinates are (0, 0) • node 1 lies on the x axis. Its x coordinate is the measured distance with respect to node 0 , denoted as d 10 1 , and its y coordinate is 0, i.e. its coordinates are (d 10 , 0) • node 2 and node 3 have no position constraints 3) Localization Method: Given the convention described in Section II-B2, the positions of node 2 and node 3 in the relative coordinate frame are estimated by minimizing the following cost functions, respectively: (2) The cost functions in (2) and (3) are numerically minimized by the algorithm mentioned in Section II-B1. Therefore the x n and y n coordinates are obtained as arg min xn,yn f n (x n , y n ) where n = 2, 3.
1 Measured distances are denoted as 'dxy', where x is the tag and y is the anchor

4) Calibration:
A calibration procedure, similar to [12], was performed to reduce the effect of the systematic error. To perform this procedure, each anchor-tag couple was placed at fixed and known distances, from 1 m to 4 m with 1 m steps. For each of these configurations, 1200 distance measurements were acquired and averaged. These measurements were executed in the same external conditions of the experimental tests. Fig. 7 shows the calibration curves from each anchortag couple: on the x-axis there are the reference distances manually measured with a laser distance meter, while the yaxis reports the average distances retrieved by the sensors. From the calibration curves a mathematical linear model is assumed and formulated as follows: where d m is the measured distance, m c the calibration slope, d r the laser reference measurement and q c the calibration intercept. The parameters m c and q c are computed by fitting a line to the experimental data. Then, the calibrated distances d c , are calculated using the calibration equation defined in (5).
d c is the value used within the position algorithm to estimate the node pose. The improvements due to the calibrations are highlighted in Fig. 8 wherein an uncalibrated square configuration position estimation is compared with the calibrated one. Moreover, this difference is evident in the cumulative distribution function reported in Fig. 9 for nodes 1,2,3 in square configuration: the calibrated nodes show a considerably lower empirical error.

III. EXPERIMENTAL RESULTS
To evaluate the position estimation accuracy achieved by the system, experimental tests were performed. During these tests, the four nodes were placed on stands in an outdoor environment with line-of-sight conditions, powered by battery  packs, as shown in Fig. 10. The raw UWB ranging data was acquired via BLE connection.
The Euclidean error (6) was used as the error metric, defined as follows: where (x,ŷ) represent the estimated coordinates and (x t , y t ) the reference coordinates, which were acquired through manual measurements using a tape measure. The "Evaluation Scripts" software module in Figure 5 was coded to process the results: it calculates the Euclidean error and produces multiple plots from the data read from the Rosbag 2 of each conducted experiment.
The setups used to carry out the tests are 3 and they only differ in the arrangement of the nodes. Performing the measurements outdoors in an open space, therefore without considerable obstacles capable of generating reflections or attenuation of the signal, conditions have been chosen that approximate the ideal ones. The analyzed node arrangements, instead, were chosen with the intention of stressing the system in critical configurations. Following are the chosen geometries: Fig. 10. Photo of the experimental setup. The four UWB nodes are mounted on stands and powered by battery packs.
Each different node arrangement was tested for 2 minutes, equivalent to 1200 measurements per node 3 . The actual configurations and their respective position estimates made through the software architecture described in Section II-B, are displayed in Figures 11(a), 11(b) and 11(c).
From these figures, it is possible to notice that the error in the lower left node (node 0 ) is always null. Moreover, the position estimates of the lower right node (node 1 ) vary only with respect to the x component of the coordinates. This reflects the convention adopted for relative localization, described in Section II-B2. Finally, the other two nodes have position estimates that vary on both axes.
The distribution of the Euclidean error is shown by the boxplots of Figures 11(d), 11(f) and 11(e), for each configuration. From these figures, it can be observed that the maximum error is always below 17 cm. Furthermore, the graph of the estimates of the x coordinate in the quadrilateral configuration is shown in Figure 12, which highlights how there are no measurement outliers.
Finally, Table I provides a comparison between the RMSE (Root Mean Square Error) values of all the nodes for each test performed. Note how Node 0, being the origin of the chosen reference system, always has a null error. There are no remarkable error differences between nodes and configurations. All errors are, however, less than, on average, 5 cm for every node and 4 cm for every geometrical configuration. Finally, it can be stated that the average error in the position estimation obtained by the proposed system is 3.2 cm. Our 2D-10Hz cooperative localization system shows comparable results with the 3D-1Hz system described in [9].

CONCLUSIONS
In this work, a cooperative localization system based on UWB technology has been presented. The developed system presents a fully-wireless setup, in which ranging data are acquired using BLE connections, and performs relative positioning of four nodes. The APIs provided by the devices used to obtain real-time data have been exploited. The minimization problem associated with the relative localization, described by a cost function with the constraints imposed by our convention, is solved through a non-linear least squares algorithm. The results show good performance, with an RMSE of 3.2 cm, which is of the same order of magnitude as DWM1001's capabilities according to the datasheet. However, by analyzing the RMSE results in different configurations, we also notice how the geometry of the problem, along with the restricted set of measurements for each node, may negatively affect the performance in extreme cases. This can potentially be mitigated by exploiting a network in which ranges are measured between all nodes (fully-connected network), obtainable using pairs of sensors in each node of the network. A further step to be explored concerns the analysis of system performance in dynamic situations. As an example, by placing the nodes on top of mobile robots (drones or ground robots) in motion, it could be possible to evaluate whether the accuracy of position estimation is suitable for shape-formation tasks.