commaai / laika

Simple Python GNSS processing library
MIT License
634 stars 178 forks source link

GPS ephemeris parsing: fix week increase #129

Closed gast04 closed 1 year ago

gast04 commented 1 year ago

GPS weeks are increased from Saturday night to monday morning (UTC), many saturday night drives get invalid ephemeris times, cause the ephemeris is valid for the next week with toe 0, but we use the current week. So we end up with current week and toe 0, which results in a date thats 7days off, which can be seen in a comparison to the GLONASS ephems:

G07 <GPSEphemeris from G07 at 2023-01-29T00:00:00.000000>
R09 <GLONASSEphemeris from R09 at 2023-02-04T22:15:00.000000>

after this fix we get:

G07 <GPSEphemeris from G07 at 2023-02-05T00:00:00.000000>
R09 <GLONASSEphemeris from R09 at 2023-02-04T22:15:00.000000>

not sure if this is the correct way to fix this, but havent found a better way yet