junzis / pyModeS

Python decoder for Mode S and ADS-B signals
GNU General Public License v3.0
527 stars 151 forks source link

Possibly incorrect decoding of airborne position #97

Closed wiseman closed 3 years ago

wiseman commented 3 years ago

I haven't tracked it all the way down, but I think pyModeS may be incorrectly decoding this position. At least the position it returns disagrees with the position returned by two other libraries.

import pyModeS as pms

msg_even = "8DA46D4F58B9834BD7AE086205AE"
msg_odd = "8DA46D4F5827864A548FA927F541"

print(pms.adsb.airborne_position(msg_odd, msg_even, 0, 1))
(88.94435, -57.63428)

The position I get from adsb and antirez dump1090 is this:

(88.91747426178496, 101.01104736328125)

Those two libraries use basically the same CPR NL function implementation, so maybe that's not a big surprise.

Note that those two messages are not actually valid for use in position decoding, because they were broadcast hours and many miles apart. But It still seems like there may be a potential issue.

junzis commented 3 years ago

I think you might have given the wrong timestamps to the messages. The following code yields the same result:

print(pms.adsb.airborne_position(msg_odd, msg_even, 1, 0))

(88.91747, 101.01105)
wiseman commented 3 years ago

Duh, thank you!