我必须实现卡尔曼滤波器以获得更好的GPS位置精度...我使用随机解决方案(Smooth GPS data)。在ValidPosition中,我有一些检查:
public boolean checkPosition(Location location) {
if (( location != null ) &&
(distance != 0) &&
(distance > MINIMUM_DISTANCE) && // 10 metres
(location.hasSpeed()) &&
(location.getSpeed() > 0) &&
(averageTime < HUMANSPEED) &&
(location.hasAccuracy()) &&
(location.getAccuracy() < MINIMUM_ACCURACY) &&
(isBetterLocation(location, lastLocation)) // From Google example in http://developer.android.com/guide/topics/location/strategies.html#BestPerformance
return true;
}
return false;
}
现在,在我的位置融合提供程序的主要课程中,我有这个:
public static final int ACCURACY_DECAYS_TIME = 3; // Metres per second
private KalmanLatLong kalmanLatLong = new KalmanLatLong(ACCURACY_DECAYS_TIME);
private ValidPosition validPosition = new ValidPosition();
@Override
public void onLocationChanged(Location location) {
if(validPosition.checkPosition(location)) {
kalmanLatLong.process(
location.getLatitude(),
location.getLongitude(),
location.getAccuracy(),
location.getTime());
mCallback.handleNewLocation(location);
}
}`
现在?我如何使用卡尔曼预测?我在Stochastically代码中写了什么?
// TODO: USE VELOCITY INFORMATION HERE TO GET A BETTER ESTIMATE OF CURRENT POSITION
由于
答案 0 :(得分:0)
您忘记从kalmanLatLong
对象返回处理结果。
你需要做这样的事情:
if(validPosition.checkPosition(location)) {
kalmanLatLong.process(
location.getLatitude(),
location.getLongitude(),
location.getAccuracy(),
location.getTime());
location.setLatitude(kalmanLatLong.get_lat());
location.setLongitude(kalmanLatLong.get_lng());
location.setAccuracy(kalmanLatLong.get_accuracy());
mCallback.handleNewLocation(location);
}
关于你的第二个问题,我不认为这是微不足道的,应该更多地基于实验数据。在大多数情况下,线性衰减的简单假设很有效。