HULOP BLE localization library (Web API)
Java JavaScript HTML
Latest commit 8621fb8 Oct 23, 2015 @muratams muratams Minor changes
Permalink
Failed to load latest commit information.
LocationService initial commit Oct 14, 2015
location-service-library Minor changes Oct 23, 2015
location-service-resource initial commit Oct 14, 2015
LICENSE Update LICENSE Oct 7, 2015
README.md Update README.md Oct 15, 2015

README.md

BLE Localization

This is a Bluetooth LE localization library to locate smartphones by estimating position from beacon signal strength. The localization algorithm is based on Monte Carlo localization using a particle filter which integrates radio wave signal strength and various sensor data of smartphones to localize them.

About

About HULOP

License

MIT

Dependent libraries for core library


Sample Web API

The localization library is wrapped by an example servlet. (You can try) This section describes about Web API that calculate location from beacon signals and motion data.

POST /locations/beacons

Input (post)

To localize a user carrying a smartphone, multiple pairs of beacon identifier (UUID, major id and minor id) and Received Signal Strength Indicator (RSSI) received by a smartphone at some interval are input to the library.

Data format example (JSON)

{
  "uuid": "00000000-0000-0000-0000-000000000000",
  "data": [
    {
      "major": 1,
      "minor": 1,
      "rssi": -70
    },
    {
      "major": 1,
      "minor": 2,
      "rssi": -75
    }
  ],
  "sensorCSV": "<motion data csv as a string including new lines.>"
}

Motion data

In the case that motion data are collected in addition to beacon data, time-series data from accelerometer and gyroscope are input to the library with the beacon data.

Case 1: Process motion data in the library.

Motion data is input in the following format. You need to input all motion data between the last two beacon signal sampling. (i.e. iOS provide beacon data every second so you will input all motion data within a second.)

Timestamp, "Acc",  X-acceleration, Y-acceleration, Z-acceleration
Timestamp, "Motion", Pitch-angle, Roll-angle, Yaw-angle

Example (CSV)

1444834800, Acc,    0.98407,    -0.143784,  -0.066208
1444834805, Motion  0.185809    1.465061    -1.530919
1444834810, Acc,    0.985413,   -0.141495,  -0.07077
1444834816, Motion  0.186237    1.465726    -1.533538
Case 2: Preprocess on a smartphone

If you want to reduce amount of data transfer and do not care user's orientation, you can just specify whether a user is walking or not by processing motion data on a smartphone.

Timestamp, "Moving", Indicator if a user is moving(1) or not(0).

Example (CSV)

1444834800, Moving, 0
1444834810, Moving, 1

Response

Returns user's two-dimensional location (x, y, floor).

Data format example (JSON)

{"x": 1, "y": 1, "z": 0}

When user's motion is also measured, orientation is appended to the output.

{"x": 1, "y": 1, "z": 0, "orientation": 1.57}

Test Web API on your machine

Try a sample web application for BLE-based localization. In this section, Eclipse is used to explain how to run the sample web app.

Prerequisites

Dependent libraries for Web app

Launch and use the sample app

Setup

  1. Clone this repository.
  2. Import all projects into your Eclipse workspace.
  3. Put the dependent libraries by following requirements.txt in the projects.
  4. Launch the web application on a web server on Eclipse.

Localization on sample data

  1. Open a sample web page. It takes a while for initialization. http://localhost:9080/LocationService/hulo_sample.html
  2. Start localization demo by clicking the start button.

Fingerprinting data for the library

To use this library in the real world, fingerprinting i.e. collecting BLE RSSI readings at known locations is necessary.

Data Directory

  1. Create a project directory to store the prepared data as following structure and put it in location-service-resource/projects/hulo/localization/resource/projects

    /<your_project_name>
        /training
            /<any_name>.json
        /map
            /map.json
        /format.json
    
  2. Update a setting property configurations.project in LocationService/resource/hulo/localization/resource/settings/deployment.json to <your_project_name>

  3. Launch the web app as previously explained.

Fingerprint data

Fingerprint data collected by a smartphone should be stored in the following format.

Data format example (JSON)

[{
    "beacons": [{
        "timestamp": 1444834000,
        "uuid": "00000000-0000-0000-0000-000000000000",
        "data": [{
            "major": 1,
            "minor": 1,
            "rssi": -77.0
        }, ...]
    }, ...],
    "information": {
        "x": 2.0,
        "y": 1.0,
        "absx": 2.0,
        "absy": 1.0,
        "floor_num": 0.0,
        "floor": 0.0
    }
}]

Test data

Test data is used to evaluate the accuracy of the localization algorithm at given data including fingerprints. Test data consist of locations, beacon RSSI readings and motion data.

Test data format (CSV)

Timestamp, "Acc",  X-acceleration, Y-acceleration, Z-acceleration
Timestamp, "Motion", Pitch-angle, Roll-angle, Yaw-angle
Timestamp, "Beacon", X-position, Y-position, Z-position, Floor, #Beacons, Major, Minor, RSSI, ...

The third line contains a location, the number of observed beacons, and pairs of beacon identifier and RSSI.

Beacon locations

This library uses BLE beacon positions as auxiliary information.

Data format example (GeoJSON)

{
    "type": "FeatureCollection",
    "features": [{
    "type": "Feature",
    "properties": {
      "type": "beacon",
      "uuid": "00000000-0000-0000-0000-000000000000",
      "major": 1,
      "minor": 2,
        },
        "geometry": {
            "type": "Point",
            "coordinates": [1.0, 2.0]
        }
    }, ...
    ]
}

Virtual fingerprinting data generator

In this sample app, an editor to create a virtual room where beacons and walls are installed is provided. The output of the editor is input to a tool to generate synthetic training and test data to be input to the localization library. The format of the data generated by these tools meets the input specifications of the library.

Edit a virtual room

  1. Open an editor to create a virtual room. http://localhost:9080/LocationService/env_editor.html
  2. Add beacons and walls on the editor.
  3. Add walk path used to synthesize test data.
  4. Add grid used to synthesize training data.
  5. Export the created environment data in GeoJSON format by clicking an export button.

Generate synthetic data

  1. Write a setting JSON file to define names of files to be generated. An example is provided in location-service-library/example directory.
  2. Generate synthetic data by running SyntheticDataGenerator in location-service-library with arguments as follows: SyntheticDataGenerator -i <PATH_TO_SETING_FILE>/<SETTING_FILE_NAME>.json Generated data will be saved to a directory designated by the setting file.