All Projects → maddevsio → Mad Location Manager

maddevsio / Mad Location Manager

Licence: mit
Mad Location Manager is a library for GPS and Accelerometer data "fusion" with Kalman filter

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Mad Location Manager

nostromo
BLDC ESC firmware (GPLv3.0)
Stars: ✭ 36 (-90.24%)
Mutual labels:  kalman-filter
bayes-filters-lib
A flexible, modern, C++ recursive Bayesian estimation library.
Stars: ✭ 48 (-86.99%)
Mutual labels:  kalman-filter
Gps imu kalman filter
Fusing GPS, IMU and Encoder sensors for accurate state estimation.
Stars: ✭ 264 (-28.46%)
Mutual labels:  kalman-filter
DA Tutorial
This is a 'hands-on' tutorial for the RIKEN International School on Data Assimilation (RISDA2018).
Stars: ✭ 23 (-93.77%)
Mutual labels:  kalman-filter
COVID19
Using Kalman Filter to Predict Corona Virus Spread
Stars: ✭ 78 (-78.86%)
Mutual labels:  kalman-filter
Real-Time-Video-Stabilization
real time video stabilization using Kalman Filter
Stars: ✭ 119 (-67.75%)
Mutual labels:  kalman-filter
kalman-clib
Microcontroller targeted C library for Kalman filtering
Stars: ✭ 43 (-88.35%)
Mutual labels:  kalman-filter
Ros Sensor Fusion Tutorial
An in-depth step-by-step tutorial for implementing sensor fusion with robot_localization! 🛰
Stars: ✭ 306 (-17.07%)
Mutual labels:  kalman-filter
SSD Tracker
Counting people, dog and bicycle using SSD detection and tracking.
Stars: ✭ 17 (-95.39%)
Mutual labels:  kalman-filter
Kalmanfilter altimeter vario
Kalman filter to estimate altitude and climbrate(sinkrate) by fusing altitude and acceleration sensor data
Stars: ✭ 31 (-91.6%)
Mutual labels:  kalman-filter
imusensor
Python library for communication between raspberry pi and MPU9250 imu
Stars: ✭ 47 (-87.26%)
Mutual labels:  kalman-filter
MPU6050
STM32 HAL library for GY-521 (MPU6050) with Kalman filter
Stars: ✭ 114 (-69.11%)
Mutual labels:  kalman-filter
Computer-Vision
Cool Vision projects
Stars: ✭ 51 (-86.18%)
Mutual labels:  kalman-filter
KalmanFiltering
A demo for the performace evaluation of different kinds of Kalman filters, including the conventional Kalman filter (KF), the unscented Kalman filter (UKF), the extended Kalman filter (EKF), the embedded/imbedded cubature Kalman filter (ICKF/ECKF), the third-degree cubature Kalman filter (CKF) and the fifth-degree cubature Kalman filter (FCKF).
Stars: ✭ 37 (-89.97%)
Mutual labels:  kalman-filter
Freeimu Updates
IMU - FreeIMU Library Zero Drift, Altitude & LSM303 Heading Stability
Stars: ✭ 267 (-27.64%)
Mutual labels:  kalman-filter
multiple-object-tracking
combine state of art deep neural network based detectors with most efficient trackers to solve motion based multiple objects tracking problems
Stars: ✭ 25 (-93.22%)
Mutual labels:  kalman-filter
pySmooth
A unique time series library in Python that consists of Kalman filters (discrete, extended, and unscented), online ARIMA, and time difference model.
Stars: ✭ 29 (-92.14%)
Mutual labels:  kalman-filter
Financial Models Numerical Methods
Collection of notebooks about quantitative finance, with interactive python code.
Stars: ✭ 3,534 (+857.72%)
Mutual labels:  kalman-filter
Kalmanjs
Javascript based Kalman filter for 1D data
Stars: ✭ 298 (-19.24%)
Mutual labels:  kalman-filter
MessyTimeSeries.jl
A Julia implementation of basic tools for time series analysis compatible with incomplete data.
Stars: ✭ 88 (-76.15%)
Mutual labels:  kalman-filter

This is library for GPS and Accelerometer data "fusion" with Kalman filter. All code is written in Java. It helps to increase position accuracy and GPS distance calculation on Android devices for the driver's and couriers' apps. And also, it may be used for precise tracking in on-demand services.

Project consists of 2 parts:

Blog (english version)

Blog (russian version)

Our site

License: MIT Developed by Mad Devs

What can "Mad Location Manager" do?

This module helps to increase GPS coordinates accuracy and also:

  • reduces the errors in route tracking;
  • decreases the noise from Low-class smartphones;
  • excludes sharp «jumps» to the points remote from a real route;
  • eliminates additional distance when the object is motionless;
  • filters errors duу to the short-term loss of GPS-signal.

How to install

Use last version from link below (jitpack):

How to use

There is example application in current repository called "Sensor Data Collector".

WARNING!!

Right now these sensors should be available:
TYPE_ROTATION_VECTOR, TYPE_LINEAR_ACCELERATION.

It's possible to use just TYPE_ACCELEROMETER with high-pass filter.
Also it's possible to use Madgwick filter instead of rotation vector, but gyroscope and magnetometer sensors should be available in that case.

KalmanLocationService

This is main class. It implements data collecting and processing. You need to make several preparation steps for using it:

  1. Add to application manifest this:
<service
            android:name="mad.location.manager.lib.Services.KalmanLocationService"
            android:enabled="true"
            android:exported="false"
            android:stopWithTask="false" />
  1. Create some class and implement LocationServiceInterface and optionally LocationServiceStatusInterface .
  2. Register this class with ServicesHelper.addLocationServiceInterface(this) (do it in constructor for example)
  3. Handle locationChanged callback. There is Kalman filtered location WITHOUT geohash filtering. Example of geohash filtering is in MapPresenter class.
  4. Init location service settings object (or use standard one) and pass it to reset() function.

Important things!

It's recommended to use start(), stop() and reset() methods, because this service has internal state. Use start() method at the beginning of new route. Stop service when your application doesn't use locations data. That need to be done for decrease battery consumption.

Kalman filter settings

There are several settings for KalmanFilter. All of them stored in KalmanLocationService.Settings class.

  • Acceleration deviation - this value controls process noise covariance matrix. In other words it's "trust level" of accelerometer data. Low value means that accelerometer data is more preferable.
  • Gps min time - minimum time interval between location updates, in milliseconds
  • Gps min distance - minimum distance between location updates, in meters
  • Sensor frequency in Herz - the rate sensor events are delivered at
  • GeoHash precision - length of geohash string (and precision)
  • GeoHash min point - count of points with same geohash. GPS point becomes valid only when count greater then this value.
  • Logger - if you need to log something to file just implement ILogger interface and initialize settings with that object. If you don't need that - just pass null .

There is an example in MainActivity class how to use logger and settings.

GeoHashRTFilter

There are 2 ways of using GeoHash real-time filter :

  • It could be used as part of KalmanLocationService. It will work inside that thread and will be used by service. But then you need to use start(), stop() and reset() methods.
  • It could be used as external component and filter Location objects from any source (not only from KalmanLocationService). You need to reset it before using and then use method filter() .

It will calculate distance in 2 ways : Vincenty and haversine formula . Both of them show good results so maybe we will add some flag for choose.

The roadmap

Visualizer

  • [x] Implement some route visualizer for desktop application
  • [x] Implement Kalman filter and test all settings
  • [x] Implement noise generator for logged data
  • [ ] Improve UI. Need to use some controls for coefficient/noise changes

Filter

  • [x] Implement GeoHash function
  • [x] Get device orientation
    • [x] Get device orientation using magnetometer and accelerometer + android sensor manager
    • [x] Get device orientation using magnetometer, accelerometer and gyroscope + Madgwick AHRS
    • [x] Get device orientation using rotation vector virtual sensor
  • [x] Compare result device orientation and choose most stable one
  • [x] Get linear acceleration of device (acceleration without gravity force)
  • [x] Convert relative linear acceleration axis to absolute coordinate system (east/north/up)
  • [x] Implement Kalman filter core
  • [x] Implement Kalman filter for accelerometer and gps data "fusion"
  • [x] Logger for pure GPS data, acceleration data and filtered GPS data.
  • [ ] Restore route if gps connection is lost

Library

  • [x] Separate test android application and library
  • [x] Add library to some public repository

Theory

Kalman filtering, also known as linear quadratic estimation (LQE), is an algorithm that uses a series of measurements observed over time, containing statistical noise and other inaccuracies, and produces estimates of unknown variables that tend to be more accurate than those based on a single measurement alone, by estimating a joint probability distribution over the variables for each timeframe.

You can get more details about the filter here.

The filter is a de-facto standard solution in navigation systems. The project simply defines the given data and implements some math.

The project uses 2 data sources: GPS and accelerometer. GPS coordinates are not very accurate, but each of them doesn't depend on previous values. So, there is no accumulation error in this case. On the other hand, the accelerometer has very accurate readings, but it accumulates error related to noise and integration error. Therefore, it is necessary to "fuse" these two sources. Kalman is the best solution here.

So first - we need to define matrices and do some math with them. And second - we need to get real acceleration (not in device orientation).

First one is described in current project's wiki. But second one is little bit more complex thing called "sensor fusion". There is a lot information about this in internet.

Algorithms

Sensor fusion is a term that covers a number of methods and algorithms, including:

For real acceleration we need to know 2 things: "linear acceleration" and device orientation. Linear acceleration is acceleration along each device axis excluding force of gravity. It could be calculated by high pass filter or with more complex algorithms. Device orientation could be calculated in many ways:

  • Using accelerometer + magnetometer
  • Using accelerometer + magnetometer + gyroscope
  • Using Madgwick filter
  • Using virtual "rotation vector" sensor.

Best results show Madgwick filter and ROTATION_VECTOR sensor, but Madgwick filter should be used when we know sensor frequency. Android doesn't provide such information. We can set minimum frequency, but it could be much higher then specified. Also we need to provide gain coefficient for each device. So best solution here is to use virtual ROTATION_VECTOR sensor. You can get more details from current project's wiki.

Issues

Feel free to send pull requests. Also feel free to create issues.

License

MIT License

Copyright (c) 2020 Mad Devs

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].