void onMapReady(GoogleMap googleMap) { map = googleMap; map.getUiSettings().setZoomControlsEnabled(false); map.setMyLocationEnabled(false); map.getUiSettings().setCompassEnabled(true); map.getUiSettings().setMyLocationButtonEnabled(true); w ζʔϜίϯτϩʔϧΛඇදࣔʹ͢Δɻ w ࣗͷҐஔΛࣔ͢ΠϯσΟέʔλʔΛඇදࣔʹ͢Δɻ ޙͰࣗͰඳ͘ʣ w ίϯύεͷػೳΛΦϯʹ͢Δ w ݱࡏʹඈͿϘλϯΛදࣔʹ͢Δ
(long)(location.getElapsedRealtimeNanos() / 1000000); long elapsedTimeInMillis = locationTimeInMillis - runStartTimeInMillis; if(currentSpeed == 0.0f){ Qvalue = 3.0f; //3 meters per second }else{ Qvalue = currentSpeed; // meters per second } kalmanFilter.Process(location.getLatitude(), location.getLongitude(), location.getAccuracy(), elapsedTimeInMillis, Qvalue double predictedLat = kalmanFilter.get_lat(); double predictedLng = kalmanFilter.get_lng(); Location predictedLocation = new Location("");//provider name is unecessary predictedLocation.setLatitude(predictedLat);//your coords of course predictedLocation.setLongitude(predictedLng); float predictedDeltaInMeters = predictedLocation.distanceTo(location); if(predictedDeltaInMeters > 60){ Log.d(TAG, "Kalman Filter detects mal GPS, we should probably remove this from track"); kalmanFilter.consecutiveRejectCount += 1; if(kalmanFilter.consecutiveRejectCount > 3){ kalmanFilter = new KalmanLatLong(3); //reset Kalman Filter if it rejects more than 3 times in raw. } kalmanNGLocationList.add(location); return false; }else{ kalmanFilter.consecutiveRejectCount = 0; }