0

iam implementing an speedometer and try to get the current speed of the device.The idea is as soon as the device is moving i want to display the speed. Even with the following settings, i notice a latency of a second until the actually speed is displayed:

locationRequest = new LocationRequest();
    locationRequest.setInterval(500);
    locationRequest.setFastestInterval(500);
    locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

At decreasing speed the app jumps from 30 to 20 without showing 24 or 26 etc. Is it possible to get the same result in questions of latency and accuracy as a real speedometer?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • With GPS alone? Probably not. A 1-second interval is pretty typical. If you really need to do better, then integrating data from the accelerometers, using a [Kalman-filter](https://stackoverflow.com/questions/1134579/smooth-gps-data)-type approach, may be workable. – greeble31 Dec 21 '19 at 14:26
  • Hey greeble31, thanks for response and the link! I followed it and found this statement: "GPS positions, as delivered, are already Kalman filtered, you probably cannot improve, in postprocessing usually you have not the same information like the GPS chip." Doesn`t that mean that its not neccessary or recommned to you use an custom based kalman-filter? So its not possible with the fusedlocationproviderclient to go under a second of possition request interval? No i need to know how i can combine the accelereometer with gps. –  Dec 21 '19 at 23:27
  • I do not believe the quoted comment is accurate. Doesn't really matter, though, b/c the output the `FusedLocationProviderClient` is giving you is not filtered _enough_, b/c it's at a 1-second spacing, and you need to further filter that data in order to _fill in those gaps_. So yes, you need a custom Kalman filter. I'm sure there are others who have tried this, but I don't know of any libraries offhand. There will probably be accuracy problems in practice, but you have asked a question that is actually very difficult, and you will have to take what you can get. – greeble31 Dec 22 '19 at 15:08
  • Ok thank you anyway, i will keep focus on that topic. –  Dec 22 '19 at 22:47

0 Answers0