[Ovmsdev] GPS location glitch (flatbed theft false alert)

Craig Leres leres at xse.com
Wed Jun 30 07:44:32 HKT 2021

On 6/29/21 12:27 AM, Michael Balzer wrote:
> How about testing latitude & longitude individually for sudden peaks 
> from their previous average, and discarding a new coordinate completely 
> while such a peak is present?

Overnight I had the idea that instead of looking for specific broken 
values (0.0, 0.05, etc.) maybe the way to go is to suppress values when 
the only the latitude or the longitude has a big jump. Maybe something 
like this:

     lat1, lon1 // previous position
     lat2, lon2 // new position

     tlat = (lat1 + lat2) / 2
     delta_lat = haversine(tlat, lon1, tlat, lon2)

     tlon = (lon1 + lon2) / 2
     delta_lon = haversine(lat1, tlon, lat2, tlon)

     if (delta_lat > simcombugdist && delta_lon < (simcombugdist / 10))
         # toss
     if (delta_lon > simcombugdist && delta_lat < (simcombugdist / 10))
         # toss

On 6/29/21 12:31 AM, Michael Balzer wrote:
 > I'd also suggest doing this detection in the modem NMEA code already,
 > to prevent feeding false coordinates into the metrics first place.

That sounds right considering it's a simcom bug we're mitigating.

On 6/29/21 9:05 AM, Stephen Casner wrote:
 > For vehicles like the Tesla Roadster that don't use the modem's GPS,
 > putting the detection only in the modem NMEA code would not help.

Unless the roadster's gps has the same wacky problem with latitude or 
longitude temporarily jumps to zero (or near zero) and back, I think the 
roadster should have its own code to deal with gps bugs.

On 6/29/21 1:01 PM, Stephen Casner wrote:
 > What would qualify as exactly the same bug behavior?  If it is
 > specifically that the latitude or longitude is reported as 0, that may
 > not be the same.  What we see is a sharp deviation in the GPS
 > position.

So both latitude and longitude temporarily jump? The kind of fix we 
currently have for the simcom gps (and what I'm proposing we do instead) 
won't help with that.

Another (possibly far fetched) idea I had was is it possible we' seeing 
corruption transferring the gps location from the simcom to the esp32? A 
race condition where the latitude or the longitude gets clobbered while 
reading it? I don't have a good idea of what other symptoms that kind of 
problem would have.


More information about the OvmsDev mailing list