When the program is executed it takes 2 parameters as input: the path to the configuration file and the device ID from which you are running the program.
The configuration file has the list of services that need to be enabled for the device you are currently running the program from. These are some of the services:
anchor: opens a serial port connection to the Arduino that has the DW1000 antenna connected and every time it receives a range report from the Arduino, it sends the distance to the master service using an HTTP request.
master: this service enables an HTTP server. Other anchor services will send HTTP requests to the server sending as a parameter the anchor ID, the tag ID and the distance between this 2.
webApp: this is the frontend of the application. The webpage will draw a graphic representation of where the Anchors are located and the calculated position of the Tag.
For calculating the position of the Tag, we use a method called trilateration. This method takes as input the distance between 3 Anchors and the Tag along with the coordinates of each Anchor. Since we already know the location of the 3 Anchors, it's possible to calculate the location of the Tag.
YouTube video:
This is an example of the architecture I have running. The **anchor** services are running in 3 different devices: 2 raspberry pi and 1 mac. The mac is also running the **master** service and the **webApp** service. The program has been tested in Mac OS and in Raspbian<path to JAR>: this is the path to the generated JAR. <path to config file>: this is the path to the JSON config file (an example can be found in the doc folder) <device id>:device ID of the computer you are running the program from.
java -Djava.library.path=/usr/lib/jni -cp \ common.Program configPath:\ deviceId:\Example: java -Djava.library.path=/usr/lib/jni -cp /home/pi/dw1000server.jar common.Program configPath:/home/pi/dw1000server.JSON deviceId:raspberry1
java -cp \ common.Program configPath:\ deviceId:\ This is the structure of the config file. * listNetworkDevices: contains all the devices running services * id: deviceId * ip: ip address of the device * listServices: list of services that will run on the device * scene: * endX: max coordinates of the place where the anchors are located. * endY: max coordinates of the place where the anchors are located. Parameters: * anchorId: string for identifying the anchor * portName: serial port name in which the Arduino is connected to * coordinateX: X coordinate in which the Anchor is located at * coordinateY: Y coordinate in which the Anchor is located at Parameters: * httpPort: port number for the HTTP server Parameters: * webPath: full path to the "index.html" file * httpPort: port number for the HTTP server