Merge branch 'master' of github.com:junzis/pyModeS
This commit is contained in:
commit
0c1a3b06e1
6
.gitignore
vendored
6
.gitignore
vendored
@ -58,3 +58,9 @@ target/
|
||||
|
||||
# PyCharm
|
||||
.idea/
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
|
@ -165,6 +165,7 @@ Core functions for ADS-B decoding
|
||||
pms.adsb.position(msg_even, msg_odd, t_even, t_odd, lat_ref=None, lon_ref=None)
|
||||
pms.adsb.airborne_position(msg_even, msg_odd, t_even, t_odd)
|
||||
pms.adsb.surface_position(msg_even, msg_odd, t_even, t_odd, lat_ref, lon_ref)
|
||||
pms.adsb.surface_velocity(msg)
|
||||
|
||||
pms.adsb.position_with_ref(msg, lat_ref, lon_ref)
|
||||
pms.adsb.airborne_position_with_ref(msg, lat_ref, lon_ref)
|
||||
@ -175,7 +176,6 @@ Core functions for ADS-B decoding
|
||||
# Typecode: 19
|
||||
pms.adsb.velocity(msg) # Handles both surface & airborne messages
|
||||
pms.adsb.speed_heading(msg) # Handles both surface & airborne messages
|
||||
pms.adsb.surface_velocity(msg)
|
||||
pms.adsb.airborne_velocity(msg)
|
||||
|
||||
|
||||
|
@ -89,6 +89,9 @@ def surface_position(msg0, msg1, t0, t1, lat_ref, lon_ref):
|
||||
# four possible longitude solutions
|
||||
lons = [lon, lon + 90.0, lon + 180.0, lon + 270.0]
|
||||
|
||||
# make sure lons are between -180 and 180
|
||||
lons = [(l + 180) % 360 - 180 for l in lons]
|
||||
|
||||
# the closest solution to receiver is the correct one
|
||||
dls = [abs(lon_ref - l) for l in lons]
|
||||
imin = min(range(4), key=dls.__getitem__)
|
||||
|
@ -19,3 +19,18 @@ def test_bds_is50or60():
|
||||
assert bds.is50or60("A0001838201584F23468207CDFA5", 0, 0, 0) == None
|
||||
assert bds.is50or60("A0000000FFDA9517000464000000", 182, 237, 1250) == "BDS50"
|
||||
assert bds.is50or60("A0000000919A5927E23444000000", 413, 54, 18700) == "BDS60"
|
||||
|
||||
|
||||
def test_surface_position():
|
||||
msg0 = "8FE48C033A9FA184B934E744C6FD"
|
||||
msg1 = "8FE48C033A9FA68F7C3D39B1C2F0"
|
||||
|
||||
t0 = 1565608663102
|
||||
t1 = 1565608666214
|
||||
|
||||
lat_ref = -23.4265448
|
||||
lon_ref = -46.4816258
|
||||
|
||||
lat, lon = bds.bds06.surface_position(msg0, msg1, t0, t1, lat_ref, lon_ref)
|
||||
|
||||
assert abs(lon_ref - lon) < 0.05
|
||||
|
Loading…
Reference in New Issue
Block a user