rename spd to trk

This commit is contained in:
Junzi Sun 2017-12-12 23:06:03 +01:00
parent 3538645e22
commit 2b1f2a5878

View File

@ -574,7 +574,7 @@ def speed_heading(msg):
def airborne_velocity(msg): def airborne_velocity(msg):
"""Calculate the speed, heading, and vertical rate """Calculate the speed, track (or heading), and vertical rate
Args: Args:
msg (string): 28 bytes hexadecimal message string msg (string): 28 bytes hexadecimal message string
@ -635,7 +635,7 @@ def surface_velocity(msg):
msg (string): 28 bytes hexadecimal message string msg (string): 28 bytes hexadecimal message string
Returns: Returns:
(int, float, int, string): speed (kt), heading (degree), (int, float, int, string): speed (kt), ground track (degree),
rate of climb/descend (ft/min), and speed type rate of climb/descend (ft/min), and speed type
('GS' for ground speed, 'AS' for airspeed) ('GS' for ground speed, 'AS' for airspeed)
""" """
@ -645,13 +645,13 @@ def surface_velocity(msg):
msgbin = util.hex2bin(msg) msgbin = util.hex2bin(msg)
# heading # ground track
hdg_status = int(msgbin[44]) trk_status = int(msgbin[44])
if hdg_status == 1: if trk_status == 1:
hdg = util.bin2int(msgbin[45:52]) * 360.0 / 128.0 trk = util.bin2int(msgbin[45:52]) * 360.0 / 128.0
hdg = round(hdg, 1) trk = round(trk, 1)
else: else:
hdg = None trk = None
# ground movment / speed # ground movment / speed
mov = util.bin2int(msgbin[37:44]) mov = util.bin2int(msgbin[37:44])
@ -670,7 +670,7 @@ def surface_velocity(msg):
spd = kts[i-1] + (mov-movs[i-1]) * step spd = kts[i-1] + (mov-movs[i-1]) * step
spd = round(spd, 2) spd = round(spd, 2)
return spd, hdg, 0, 'GS' return spd, trk, 0, 'GS'
def altitude_diff(msg): def altitude_diff(msg):
"""Decode the differece between GNSS and barometric altitude """Decode the differece between GNSS and barometric altitude