commit
26ef5d3ad9
@ -1,7 +1,7 @@
|
|||||||
The Python ADS-B/Mode-S Decoder
|
The Python ADS-B/Mode-S Decoder
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
PyModeS is a Python library designed to decode Mode-S (including ADS-B) message. It can be imported to your python project or used as a standalone tool to view and save live traffic data.
|
PyModeS is a Python library designed to decode Mode-S (including ADS-B) messages. It can be imported to your python project or used as a standalone tool to view and save live traffic data.
|
||||||
|
|
||||||
This is a project created by Junzi Sun, who works at `TU Delft <https://www.tudelft.nl/en/>`_, `Aerospace Engineering Faculty <https://www.tudelft.nl/en/ae/>`_, `CNS/ATM research group <http://cs.lr.tudelft.nl/atm/>`_. It is supported by many `contributors <https://github.com/junzis/pyModeS/graphs/contributors>`_ from different institutions.
|
This is a project created by Junzi Sun, who works at `TU Delft <https://www.tudelft.nl/en/>`_, `Aerospace Engineering Faculty <https://www.tudelft.nl/en/ae/>`_, `CNS/ATM research group <http://cs.lr.tudelft.nl/atm/>`_. It is supported by many `contributors <https://github.com/junzis/pyModeS/graphs/contributors>`_ from different institutions.
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ cdef unsigned char int_to_char(unsigned char i):
|
|||||||
@cython.boundscheck(False)
|
@cython.boundscheck(False)
|
||||||
@cython.overflowcheck(False)
|
@cython.overflowcheck(False)
|
||||||
cpdef str hex2bin(str hexstr):
|
cpdef str hex2bin(str hexstr):
|
||||||
"""Convert a hexdecimal string to binary string, with zero fillings."""
|
"""Convert a hexadecimal string to binary string, with zero fillings."""
|
||||||
# num_of_bits = len(hexstr) * 4
|
# num_of_bits = len(hexstr) * 4
|
||||||
cdef hexbytes = bytes(hexstr.encode())
|
cdef hexbytes = bytes(hexstr.encode())
|
||||||
cdef Py_ssize_t len_hexstr = PyBytes_GET_SIZE(hexbytes)
|
cdef Py_ssize_t len_hexstr = PyBytes_GET_SIZE(hexbytes)
|
||||||
|
@ -109,7 +109,7 @@ def position_with_ref(msg, lat_ref, lon_ref):
|
|||||||
A reference position is required, which can be previously
|
A reference position is required, which can be previously
|
||||||
calculated location, ground station, or airport location.
|
calculated location, ground station, or airport location.
|
||||||
The function works with both airborne and surface position messages.
|
The function works with both airborne and surface position messages.
|
||||||
The reference position shall be with in 180NM (airborne) or 45NM (surface)
|
The reference position shall be within 180NM (airborne) or 45NM (surface)
|
||||||
of the true position.
|
of the true position.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -163,10 +163,10 @@ def velocity(msg, source=False):
|
|||||||
Args:
|
Args:
|
||||||
msg (str): 28 hexdigits string
|
msg (str): 28 hexdigits string
|
||||||
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
||||||
If set to True, the function will return six value instead of four.
|
If set to True, the function will return six values instead of four.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int, float, int, string, [string], [string]: Four or six parameters, including:
|
(int, float, int, string, [string], [string]): Four or six parameters, including:
|
||||||
- Speed (kt)
|
- Speed (kt)
|
||||||
- Angle (degree), either ground track or heading
|
- Angle (degree), either ground track or heading
|
||||||
- Vertical rate (ft/min)
|
- Vertical rate (ft/min)
|
||||||
@ -341,7 +341,7 @@ def nic_v2(msg, NICa, NICbc):
|
|||||||
Args:
|
Args:
|
||||||
msg (str): 28 hexdigits string
|
msg (str): 28 hexdigits string
|
||||||
NICa (int or string): NIC supplement - A
|
NICa (int or string): NIC supplement - A
|
||||||
NICbc (int or srting): NIC supplement - B or C
|
NICbc (int or string): NIC supplement - B or C
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int or string: Horizontal Radius of Containment
|
int or string: Horizontal Radius of Containment
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
Decode all-call reply messages, with dowlink format 11
|
Decode all-call reply messages, with downlink format 11
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pyModeS import common
|
from pyModeS import common
|
||||||
|
@ -82,7 +82,7 @@ def airborne_position_with_ref(msg, lat_ref, lon_ref):
|
|||||||
"""Decode airborne position with only one message,
|
"""Decode airborne position with only one message,
|
||||||
knowing reference nearby location, such as previously calculated location,
|
knowing reference nearby location, such as previously calculated location,
|
||||||
ground station, or airport location, etc. The reference position shall
|
ground station, or airport location, etc. The reference position shall
|
||||||
be with in 180NM of the true position.
|
be within 180NM of the true position.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (str): even message (28 hexdigits)
|
msg (str): even message (28 hexdigits)
|
||||||
|
@ -86,7 +86,7 @@ def surface_position_with_ref(msg, lat_ref, lon_ref):
|
|||||||
"""Decode surface position with only one message,
|
"""Decode surface position with only one message,
|
||||||
knowing reference nearby location, such as previously calculated location,
|
knowing reference nearby location, such as previously calculated location,
|
||||||
ground station, or airport location, etc. The reference position shall
|
ground station, or airport location, etc. The reference position shall
|
||||||
be with in 45NM of the true position.
|
be within 45NM of the true position.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (str): even message (28 hexdigits)
|
msg (str): even message (28 hexdigits)
|
||||||
@ -133,7 +133,7 @@ def surface_velocity(msg, source=False):
|
|||||||
Args:
|
Args:
|
||||||
msg (str): 28 hexdigits string
|
msg (str): 28 hexdigits string
|
||||||
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
||||||
If set to True, the function will return six value instead of four.
|
If set to True, the function will return six values instead of four.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int, float, int, string, [string], [string]: Four or six parameters, including:
|
int, float, int, string, [string], [string]: Four or six parameters, including:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
# BDS 0,8
|
# BDS 0,8
|
||||||
# ADS-B TC=1-4
|
# ADS-B TC=1-4
|
||||||
# Aircraft identitification and category
|
# Aircraft identification and category
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
|
|
||||||
from pyModeS import common
|
from pyModeS import common
|
||||||
|
@ -16,7 +16,7 @@ def airborne_velocity(msg, source=False):
|
|||||||
Args:
|
Args:
|
||||||
msg (str): 28 hexdigits string
|
msg (str): 28 hexdigits string
|
||||||
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
||||||
If set to True, the function will return six value instead of four.
|
If set to True, the function will return six values instead of four.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int, float, int, string, [string], [string]: Four or six parameters, including:
|
int, float, int, string, [string], [string]: Four or six parameters, including:
|
||||||
|
@ -45,7 +45,7 @@ def cap17(msg):
|
|||||||
msg (str): 28 hexdigits string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
list: list of support BDS codes
|
list: list of supported BDS codes
|
||||||
"""
|
"""
|
||||||
allbds = [
|
allbds = [
|
||||||
"05",
|
"05",
|
||||||
|
@ -142,7 +142,7 @@ def hum44(msg):
|
|||||||
|
|
||||||
|
|
||||||
def turb44(msg):
|
def turb44(msg):
|
||||||
"""Turblence.
|
"""Turbulence.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (str): 28 hexdigits string
|
msg (str): 28 hexdigits string
|
||||||
|
@ -158,7 +158,7 @@ def vr60baro(msg):
|
|||||||
|
|
||||||
|
|
||||||
def vr60ins(msg):
|
def vr60ins(msg):
|
||||||
"""Vertical rate measurd by onbard equiments (IRS, AHRS)
|
"""Vertical rate measured by onboard equipment (IRS, AHRS)
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (str): 28 hexdigits string
|
msg (str): 28 hexdigits string
|
||||||
|
@ -7,7 +7,7 @@ try:
|
|||||||
import rtlsdr
|
import rtlsdr
|
||||||
except:
|
except:
|
||||||
print("------------------------------------------------------------------------")
|
print("------------------------------------------------------------------------")
|
||||||
print("! Warining: pyrtlsdr not installed (required for using RTL-SDR devices) ")
|
print("! Warning: pyrtlsdr not installed (required for using RTL-SDR devices) !")
|
||||||
print("------------------------------------------------------------------------")
|
print("------------------------------------------------------------------------")
|
||||||
|
|
||||||
sampling_rate = 2e6
|
sampling_rate = 2e6
|
||||||
|
@ -5,14 +5,14 @@ from textwrap import wrap
|
|||||||
|
|
||||||
|
|
||||||
def hex2bin(hexstr: str) -> str:
|
def hex2bin(hexstr: str) -> str:
|
||||||
"""Convert a hexdecimal string to binary string, with zero fillings."""
|
"""Convert a hexadecimal string to binary string, with zero fillings."""
|
||||||
num_of_bits = len(hexstr) * 4
|
num_of_bits = len(hexstr) * 4
|
||||||
binstr = bin(int(hexstr, 16))[2:].zfill(int(num_of_bits))
|
binstr = bin(int(hexstr, 16))[2:].zfill(int(num_of_bits))
|
||||||
return binstr
|
return binstr
|
||||||
|
|
||||||
|
|
||||||
def hex2int(hexstr: str) -> int:
|
def hex2int(hexstr: str) -> int:
|
||||||
"""Convert a hexdecimal string to integer."""
|
"""Convert a hexadecimal string to integer."""
|
||||||
return int(hexstr, 16)
|
return int(hexstr, 16)
|
||||||
|
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ def bin2int(binstr: str) -> int:
|
|||||||
|
|
||||||
|
|
||||||
def bin2hex(binstr: str) -> str:
|
def bin2hex(binstr: str) -> str:
|
||||||
"""Convert a binary string to hexdecimal string."""
|
"""Convert a binary string to hexadecimal string."""
|
||||||
return "{0:X}".format(int(binstr, 2))
|
return "{0:X}".format(int(binstr, 2))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user