Results 1 to 14 of 14

Thread: large (5sec +) delay between GPS and OBD Data

  1. #1
    Tuner in Training
    Join Date
    Jun 2016
    Posts
    27

    large (5sec +) delay between GPS and OBD Data

    I was on a race track yesterday (HHR) and used TrackAddict to monitor GPS and OBD data and record Video. Viewing it afterwards on the Mobile I noticed about a 5 sec. difference between the actual position of the Vehicle and what it showed on the map. The Video and OBD-Data overlay (RPM, Gear, etc.) are absolutely in sync, however the GPS Data (Position, speed, etc.) are about 5 sec. late. I verified this in RaceRender and it showed the same result.

    Analysing and editing the CSV manually (deleting the first 5sec. of GPS Data and rearranging everything else to match), it comes out correctly (except start and end points which need to be set manually then).

    I'm using an OBDLink LX and an external High-Speed (10Hz) GPS via BT on an SGS5 mini with Android 4.4.2....

    Any Idea why this happens? I'm happy to share my Data/Video if it helps..

    Regards

    STefan

  2. #2
    HPT Employee Weston@HPTuners's Avatar
    Join Date
    Jul 2014
    Location
    39.735034, -103.894459
    Posts
    868
    It's not uncommon for there to be a small amount of delay in receiving the GPS data (hence why the CSV file has a GPS_Delay column), but that's typically only a fraction of a second and we're able to compensate for that. So, what you're seeing here should not be happening.

    Some possibilities come to mind:

    1) If you are not using TrackAddict to directly connect to the GPS, and are instead piping it through the Android system (ie using Mock Location Provider tool for the GPS), that may be the cause.

    2) The GPS you are using may be sending the data too slowly or doesn't have enough bandwidth for its 10 Hz update rate (perhaps a limitation in its Bluetooth transmitter or its serial baud rate). The default baud rate on a lot of GPS chips is only 9600, which may not cut it for NMEA at 10Hz. The top brand-name devices should already have this covered, but it's an easy thing to overlook in homemade devices.

    3) Your Android device isn't able to process it fast enough (other tasks running in the background taking up all the CPU, etc).

    4) The OBD Bluetooth connection is somehow interfering with the GPS Bluetooth. This should not be an issue if your OBD device shows connected in TrackAddict, but when it is actively searching for an OBD device, Android has been known to lag other Bluetooth connections (should only be a small amount, though).

    5) Signal interference on the Bluetooth frequencies (2.4 GHz). That seems unlikely in a car unless you have too much distance between the phone and the GPS, but it's a possibility.


    We've seen very good results with the Qstarz BT-Q818XT 10Hz GPS units, and use them extensively for Android devices. The XGPS160 from Dual Electronics can also work well at 10Hz (and is compatible for iOS users too), although I've seen the Qstarz unit outshine it in terms of accuracy. Both are considerably better than using a phone's internal GPS.

  3. #3
    Tuner in Training
    Join Date
    Jun 2016
    Posts
    27
    thanks for the quick reply!!
    my comments:
    1) mock location is disabled, and no other application that could use BT GPS is installed...
    2) this could be an issue. until now I use "standard" speed of 9600 between the BT and the GPS module... but the delay should increase then or the update rate should decrease, the longer the device runs... However, I'll have a deeper look into that... seems to be the most likely option...
    3) could be, as it's not the newest device, however, CPU seems to be quite idle when recording..
    4) as far as I can remember, OBD was always green and working..
    5) this could also be an issue, I had a HR-sensor, GBS and OBD connected via BT... but all other communications disabled (GSM, WiFi, etc.)

    The GPS is a 10Hz u-Blox module connected to a HC-05 BT-Interface via UART. As said I'll have a deeper look into that...

    Fortunately the data is still usable, as I'm able to find the delay quite exact and can manually edit the CSV...

    Thanks again for your help, I'll report if I can find something...

  4. #4
    Tuner in Training
    Join Date
    Jun 2016
    Posts
    27
    HI I did some further investigations and found that actually it's the opposite, the GPS data starts 5sec. early...

    also I don't think it's a speed problem, I had a GPS+ reception throughout and TA showed more or less the whole time a 10Hz pdate rate. If the speed between the GPS, BT-Module and the device would be an issue, the update rate would have been lower!

    The CSV show 20'804 GPS Updates in 2'448 sec. (so a bit less than 10Hz) and 10'239 OBD Updates (~5Hz)

    GPS Delay is between 0.050 and 0.150

    I'm currently a bit puzzled nad not really sure wherer to look further... I still have a second stint to analys, probably it's different there.

    any ideas what could have happened?

  5. #5
    Tuner in Training
    Join Date
    Jun 2016
    Posts
    27
    quick update. I analysed now also the second sint and again at the beginning I have 4.5sec. more GPS data than OBD.... really strange...

  6. #6
    HPT Employee Weston@HPTuners's Avatar
    Join Date
    Jul 2014
    Location
    39.735034, -103.894459
    Posts
    868
    That is very odd... When you look at the file, it is showing nothing but GPS updates for the first few seconds (ie the accelerometer data and OBD does not change)? Or does everything seem to be logging from the start, but the GPS data is just 4-5 seconds off sync?

  7. #7
    Tuner in Training
    Join Date
    Jun 2016
    Posts
    27
    everything seems to be logging, but the GPS Data is 5sec ahead. OBD and accelometer data is changing (~5Hz)..

    if I delete the first 5 sec. or so (only the GPS columns) and move the rest of the GPS data upwards, everything seems to be fine, except that the start/finish line is on the wrong place then. start/finish moves forward on the track for the "deleted" amount of time (Not sure how star/finish is calculated in RR3).

    could it be a buffering issue? wrong position in a ring-buffer or similar....

    I'd have a smaller part (started the logger too early) of about 2min. which I could share if you like. Also there you can see that the GPS display are "behind" meaning GPS starts earlier to log than the rest... CSV is around 250kB mp4 about 250MB...

  8. #8
    Tuner in Training
    Join Date
    Jun 2016
    Posts
    27
    PS: I just saw, that I have about a 15sec. difference between the internal GPS and the internal android clock! Could this be an issue? I assume the external GPS also is more exact and has a difference to the internal android clock.

    what time reference is taken for the logs?

  9. #9
    Tuner in Training
    Join Date
    Jun 2016
    Posts
    27
    another update....

    tried to record a session with the internal GPS and only OBD-BT connected, no video, no external GPS...

    Analyzing the data file seems that the same problem persists... I have a few seconds more (earlier) GPS data.... comparing OBD-Speed and GPS-Speed shows that difference also.

    any idea what's happening?

  10. #10
    HPT Employee Weston@HPTuners's Avatar
    Join Date
    Jul 2014
    Location
    39.735034, -103.894459
    Posts
    868
    The time/date difference between the GPS and the phone's own clock generally shouldn't matter. This app operates relative to the phone's internal clock. There had been a clock bug observed in the Galaxy S3 and possibly others, but we implemented a workaround for that a while back by using a different time source, and I now regularly use a Galaxy S5 for testing with good results.

    If you could send the data logs that show this issue (both with external GPS and internal GPS) to Info@RaceRender.com, I'll take a deeper look and see if there are any clues... What you're experiencing is so bizarre that I'm at a loss for other ideas without seeing the actual data.

  11. #11
    Tuner in Training
    Join Date
    Jun 2016
    Posts
    27
    sent you some data-files and a link to the associated video-file... would be interested if you can see the difference in location data...

  12. #12
    Tuner in Training
    Join Date
    Jun 2016
    Posts
    27
    could you already investigate? any idea?

  13. #13
    Tuner in Training
    Join Date
    Jun 2016
    Posts
    27
    still nothing?

  14. #14
    HPT Employee Weston@HPTuners's Avatar
    Join Date
    Jul 2014
    Location
    39.735034, -103.894459
    Posts
    868
    I had taken a look at the data files that were sent, but did not see any definitive cause, so I was hoping to find time to think on this further...

    I see that the GPS data can be slightly delayed and is apparently dropping a few samples, as evidenced by the GPS_Delay data and the number of GPS_Update markers per second, but that alone shouldn't be a big problem and isn't necessarily unusual with a 10Hz GPS when also using OBD (it can just be due to the Bluetooth performance / resources on some devices). The usual cases of GPS data delay can be detected and compensated for, as can missing data samples, so not much concern there.

    However, deeper in the file, some more strange things are happening... What's most noticeable are bursts of many GPS updates over a very short time period, and with a zero GPS_Delay in that case, which may indicate that the calculated delay exceeded the expected reasonable maximum. But what's also happening in those cases is that they immediately follow a total gap in the data for about 1 second where no data logging took place. You should normally see a new data sample every 0.050 seconds or so, for the accelerometers if nothing else, so there is definitely something that's lagging the app or the whole system.

    It may be from another app or process that's running on your device, or could even be part of the system itself... One idea is that you might see some system-wide lags like this if your video recording was pushing the limits of your storage device's write speed. In that case, you could try switching to a faster SD card, switching to your device's own non-SD storage, reducing the video resolution to 720p or less, or turning off video entirely.

    One thing that I can reasonably rule out is a problem directly related to CPU or processing performance... The app is showing that it's able to process and log several of these buffered NMEA GPS data samples within 0.001 seconds of each other, so it does not appear to be getting overwhelmed by it or anything direct like that.