Comments (7)
Hello, @powerzaba
There is "H" matrix in kalman filter for inputs transformation. In my example it's identity matrix (with ones on main diagonal) because all transformations I do before filter. I convert GPS coordinates into distance between north pole and current GPS location. Then I convert sensors data to IMU (inertial measurement unit). And then I can use both of them in Kalman filter.
About library usage - you can follow next steps (described here #22) :
- Create new class that implements LocationServiceInterface.
- Register it with this :
settings = new KalmanLocationService.Settings(Utils.ACCELEROMETER_DEFAULT_DEVIATION,
Utils.GPS_MIN_DISTANCE,
Utils.GPS_MIN_TIME,
Utils.GEOHASH_DEFAULT_PREC,
Utils.GEOHASH_DEFAULT_MIN_POINT_COUNT,
Utils.SENSOR_DEFAULT_FREQ_HZ,
null, false, Utils.DEFAULT_VEL_FACTOR, Utils.DEFAULT_POS_FACTOR);
ServicesHelper.addLocationServiceInterface(this);
But change default geohash precision and default geohash min point count.
3. Implement this:
@Override
public void locationChanged(Location loc) {
}
That's it. You should receive location in locationChanged method .
from mad-location-manager.
Hi! I've looked at the thread that you suggested me to look into and I've tried to use the code that the user MosCriogen posted, but nothing happens! I don't even get the permission request from Android to allow the use of location/GPS, here's the simple code I'm using. (Basically the same from MosCriogen)
`package com.example.kalmangpsfilter;
import android.content.Context;
import android.location.Location;
import android.widget.TextView;
import mad.location.manager.lib.Commons.Utils;
import mad.location.manager.lib.Interfaces.LocationServiceInterface;
import mad.location.manager.lib.Services.KalmanLocationService;
import mad.location.manager.lib.Services.ServicesHelper;
public class Kalman implements LocationServiceInterface {
private Context m_context;
private KalmanLocationService.Settings settings;
private TextView locationText;
public Kalman (Context context, TextView textView) {
m_context = context;
locationText = textView;
settings = new KalmanLocationService.Settings(Utils.ACCELEROMETER_DEFAULT_DEVIATION,
Utils.GPS_MIN_DISTANCE,
Utils.GPS_MIN_TIME,
Utils.GEOHASH_DEFAULT_PREC,
Utils.GEOHASH_DEFAULT_MIN_POINT_COUNT,
Utils.SENSOR_DEFAULT_FREQ_HZ,
null, false, Utils.DEFAULT_VEL_FACTOR, Utils.DEFAULT_POS_FACTOR);
ServicesHelper.addLocationServiceInterface(this);
}
public void start_k () {
ServicesHelper.getLocationService(m_context, value -> {
if (value.IsRunning()) {
return;
}
value.stop();
value.reset(settings); //warning!! here you can adjust your filter behavior
value.start();
});
}
public void stop_k () {
ServicesHelper.getLocationService(m_context, value -> {
value.stop();
});
}
@Override
public void locationChanged(Location location) {
locationText.setText("Long: "+location.getLongitude()+"Lat: "+location.getLatitude());
}
}
And in my main i have this:
` package com.example.kalmangpsfilter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private TextView location;
private Kalman kalman;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
location = findViewById(R.id.location);
kalman = new Kalman(this, location);
}
@Override
public void onStart() {
super.onStart();
kalman.start_k();
}
}
`
So I'm trying to log the filtered coordinates into a simple text field, but nothing happens, what am I doing to wrong? (The function locationChanged never occurs);
from mad-location-manager.
Update! I managed to make it work and log the coordinates! But the update frequency it's too low, I tried to change the settings in the setting object, but I get updates like every minute.
from mad-location-manager.
@powerzaba Try to log every GPS coordinates received by https://github.com/maddevsio/mad-location-manager/blob/master/app/src/main/java/com/example/lezh1k/sensordatacollector/Loggers/GPSDataLogger.java, please.
I faced this situation when tested application inside building, but I don't think that it's your situation. Let me know about GPSDataLogger, please. :)
from mad-location-manager.
Hi! I cannot get the LocationManager to pass to the GPSDataLogger, so I'm unable to log, or should I create a new LocationManager?
from mad-location-manager.
Add own GPS listener in this case and compare receiving frequencies from standard gps listener with kalmanlocationservice, please.
Also try to disable geo hash filter by setting zeroes to it's settings.
from mad-location-manager.
Closing due to inactivity
from mad-location-manager.
Related Issues (20)
- for gps accuracy
- Sensor calibration needed ? HOT 3
- gpsacckalmanfilter tutorial video ? HOT 1
- Demo App crashes with GPS Provider
- URGENT HELP HOT 5
- crash with deprecated api GPSStatus in "onStop()" method GPSLocationProvider file
- Maven Plugin doesn't work with Gradle 7.2 on Android Studio
- Doesn't work with Gradle 7.1.3
- Demo app crash
- Android location manager does not handle sensors ? HOT 1
- Фильтр Калмана не работает ожидаемым образом HOT 3
- questions on some logic used in code HOT 1
- Need help for starting demo app HOT 2
- Old device without sensors TYPE_ROTATION_VECTOR, TYPE_LINEAR_ACCELERATION HOT 4
- GPSAccKalmanFilter HOT 2
- Trouble updating mapbox sdk version HOT 1
- Kalman location service started location random coords HOT 2
- The Kalman filter doesn't work when I walk backwards
- GPS errors/jumps
- It can be used for count step?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mad-location-manager.