def test_PlatformRollAngle(self): example_value = 3.405814 example_ls_packet = hexstr_to_bytes('07 02 08 b8') interpretation_string = "3.4058656575212893" from klvdata.misb0601 import PlatformRollAngle self.assertEqual(bytes(PlatformRollAngle(example_value)), example_ls_packet) self.assertEqual(bytes(PlatformRollAngle(example_ls_packet[2:])), example_ls_packet) self.assertEqual(str(PlatformRollAngle(example_ls_packet[2:]).value), interpretation_string)
def test_OffsetCornerLatitudePoint3(self): # Example value and packet per MISB ST 0601.11, Section 8 "Conversions and Mappings of Metadata Types". frame_center_latitude = -10.5423886331461 example_value = -10.5527275411938 - frame_center_latitude example_ls_packet = hexstr_to_bytes('1e 02 ee 5b') from klvdata.misb0601 import OffsetCornerLatitudePoint3 self.assertEqual(bytes(OffsetCornerLatitudePoint3(example_value)), example_ls_packet) self.assertEqual(bytes(OffsetCornerLatitudePoint3(example_ls_packet[2:])), example_ls_packet)
def test_OffsetCornerLongitudePoint3(self): # Example value and packet per MISB ST 0601.11, Section 8 "Conversions and Mappings of Metadata Types". frame_center_longitude = 29.157890122923 example_value = 29.1542782573265 - frame_center_longitude example_ls_packet = hexstr_to_bytes('1f 02 f9 d6') from klvdata.misb0601 import OffsetCornerLongitudePoint3 self.assertEqual(bytes(OffsetCornerLongitudePoint3(example_value)), example_ls_packet) self.assertEqual(bytes(OffsetCornerLongitudePoint3(example_ls_packet[2:])), example_ls_packet)
def test_SensorLongitude(self): example_value = 128.426759042045 example_ls_packet = hexstr_to_bytes('0E 04 5B 53 60 c4') interpretation_string = "128.42675904204452" from klvdata.misb0601 import SensorLongitude self.assertEqual(bytes(SensorLongitude(example_value)), example_ls_packet) self.assertEqual(bytes(SensorLongitude(example_ls_packet[2:])), example_ls_packet) self.assertEqual(str(SensorLongitude(example_ls_packet[2:]).value), interpretation_string)
def test_checksum(self): # See MISB ST0902.5 interpretation = "0xAA43" tlv_hex_bytes = hexstr_to_bytes('01 02 AA 43') value = tlv_hex_bytes[2:] from klvdata.misb0601 import Checksum self.assertEqual(str(Checksum(value).value), interpretation) self.assertEqual(bytes(Checksum(value)), tlv_hex_bytes)
def test_SensorLatitude(self): example_value = 60.1768229669783 example_ls_packet = hexstr_to_bytes('0D 04 55 95 B6 6D') interpretation_string = "60.176822966978335" from klvdata.misb0601 import SensorLatitude self.assertEqual(bytes(SensorLatitude(example_value)), example_ls_packet) self.assertEqual(bytes(SensorLatitude(example_ls_packet[2:])), example_ls_packet) self.assertEqual(str(SensorLatitude(example_ls_packet[2:]).value), interpretation_string)
def test_PlatformIndicatedAirspeed(self): example_value = 159 example_ls_packet = hexstr_to_bytes('09 01 9f') interpretation_string = "159.0" from klvdata.misb0601 import PlatformIndicatedAirspeed self.assertEqual(bytes(PlatformIndicatedAirspeed(example_value)), example_ls_packet) self.assertEqual(bytes(PlatformIndicatedAirspeed(example_ls_packet[2:])), example_ls_packet) self.assertEqual(str(PlatformIndicatedAirspeed(example_ls_packet[2:]).value), interpretation_string)
def test_PlatformTrueAirspeed(self): example_value = 147 example_ls_packet = hexstr_to_bytes('08 01 93') interpretation_string = "147.0" from klvdata.misb0601 import PlatformTrueAirspeed self.assertEqual(bytes(PlatformTrueAirspeed(example_value)), example_ls_packet) self.assertEqual(bytes(PlatformTrueAirspeed(example_ls_packet[2:])), example_ls_packet) self.assertEqual(str(PlatformTrueAirspeed(example_ls_packet[2:]).value), interpretation_string)
class SensorTrueAltitude(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 01 07 01 02 01 02 02 00 00") TAG = 15 UDSKey = "06 0E 2B 34 01 01 01 01 07 01 02 01 02 02 00 00" LDSName = "Sensor True Altitude" ESDName = "Sensor Altitude" UDSName = "Device Altitude" _domain = (0, 2**16 - 1) _range = (-99999, 99999) units = 'meters'
class SensorLongitude1(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 01 07 01 02 01 02 06 02 00") TAG = 14 UDSKey = "06 0E 2B 34 01 01 01 01 07 01 02 01 02 06 02 00" LDSName = "Sensor Longitude" ESDName = "Sensor Longitude" UDSName = "Device Longitude" _domain = (-(2**63 - 1), 2**63 - 1) _range = (-180, 180) units = 'degrees'
class SensorLatitude2(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 01 01 01 03 07 01 02 01 02 04 02 00") TAG = 13 UDSKey = "06 0E 01 01 01 03 07 01 02 01 02 04 02 00" LDSName = "Sensor Latitude" ESDName = "Sensor Latitude" UDSName = "Device Latitude" _domain = (-(2**63 - 1), 2**63 - 1) _range = (-90, 90) units = 'degrees'
class PlatformRollAngle(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 07 07 01 10 01 04 00 00 00") TAG = 7 UDSKey = "06 0E 2B 34 01 01 01 07 07 01 10 01 04 00 00 00" LDSName = "Platform Roll Angle" ESDName = "UAV Roll (INS)" UDSName = "Platform Roll Angle" _domain = (-(2**15 - 1), 2**15 - 1) _range = (-50, 50) units = 'degrees'
class SensorHorizontalFieldOfView(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 02 04 20 02 01 01 08 00 00") TAG = 16 UDSKey = "06 0E 2B 34 01 01 01 02 04 20 02 01 01 08 00 00" LDSName = "Sensor Horizontal Field of View" ESDName = "Field of View" UDSName = "Field of View (FOVHorizontal)" _domain = (0, 2**16 - 1) _range = (0, 180) units = 'degrees'
class SensorVerticalFieldOfView(IEEE754ElementParser): key = hexstr_to_bytes("06 0e 2b 34 01 01 01 07 04 20 02 01 01 0a 01 00") TAG = 17 UDSKey = "06 0e 2b 34 01 01 01 07 04 20 02 01 01 0a 01 00" LDSName = "Sensor Vertical Field of View" ESDName = "Vertical Field of View" UDSName = "" _domain = (0, 2**16 - 1) _range = (0, 180) units = 'degrees'
class UASLocalMetadataSet(SetParser): """MISB ST0601 UAS Local Metadata Set """ key = hexstr_to_bytes( '06 0E 2B 34 - 02 0B 01 01 – 0E 01 03 01 - 01 00 00 00') name = 'UAS Datalink Local Set' parsers = {} _unknown_element = UnknownElement
class AlternatePlatformEllipsoidHeightExtended(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 01 0E 01 02 01 82 48 00 00") TAG = 105 UDSKey = "06 0E 2B 34 01 01 01 01 0E 01 02 01 82 48 00 00" LDSName = " Alternate Platform Ellipsoid Height Extended" ESDName = "" UDSName = "" _domain = (0, 2**16 - 1) _range = (-900, 40000) units = 'meters'
class TargetWidthExtended(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 01 07 01 09 02 01 00 00 00") TAG = 96 UDSKey = "06 0E 2B 34 01 01 01 01 07 01 09 02 01 00 00 00" LDSName = "Target Width Extended" ESDName = "Target Width" UDSName = "Target Width" _domain = (0, 2**8 - 1) _range = (0, 2**8 - 1) units = 'meters'
class DensityAltitudeExtended(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 01 0E 01 01 01 10 00 00 00") TAG = 103 UDSKey = "06 0E 2B 34 01 01 01 01 0E 01 01 01 10 00 00 00" LDSName = "Density Altitude Extended" ESDName = "Density Altitude" UDSName = "" _domain = (0, 2**16 - 1) _range = (-900, 40000) units = 'meters'
class CornerLongitudePoint4Full(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 03 07 01 02 01 03 0E 01 00") TAG = 89 UDSKey = "06 0E 2B 34 01 01 01 03 07 01 02 01 03 0E 01 00" LDSName = "Corner Longitude Point 4 (Full)" ESDName = "SAR Longitude 3" UDSName = "Corner Longitude Point 4 (Decimal Degrees)" _domain = ((-2**31 - 1), 2**31 - 1) _range = (-180, 180) units = 'degrees'
class PlatformRollAngleFull(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 07 07 01 10 01 04 00 00 00") TAG = 91 UDSKey = "06 0E 2B 34 01 01 01 07 07 01 10 01 04 00 00 00" LDSName = "Platform Roll Angle (Full)" ESDName = "UAV Roll (INS)" UDSName = "Platform Roll Angle" _domain = ((-2**31 - 1), 2**31 - 1) _range = (-90, 90) units = 'degrees'
class OffsetCornerLongitudePoint4(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 03 07 01 02 01 03 0E 01 00") TAG = 33 UDSKey = "06 0E 2B 34 01 01 01 03 07 01 02 01 03 0E 01 00" LDSName = "Offset Corner Longitude Point 4" ESDName = "SAR Longitude 3" UDSName = "Corner Longitude Point 4" _domain = ((-2**15 - 1), 2**15 - 1) _range = (-0.075, 0.075) units = 'degrees'
class CornerLatitudePoint3Full(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 03 07 01 02 01 03 09 01 00") TAG = 86 UDSKey = "06 0E 2B 34 01 01 01 03 07 01 02 01 03 09 01 00" LDSName = "Corner Latitude Point 3 (Full)" ESDName = "SAR Latitude 2" UDSName = "Corner Latitude Point 3 (Decimal Degrees)" _domain = ((-2**31 - 1), 2**31 - 1) _range = (-90, 90) units = 'degrees'
class FrameCenterLongitude(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 01 07 01 02 01 03 04 00 00") TAG = 24 UDSKey = "06 0E 2B 34 01 01 01 01 07 01 02 01 03 04 00 00" LDSName = "Frame Center Longitude" ESDName = "Target Longitude" UDSName = "Frame Center Longitude" _domain = (-(2**31 - 1), 2**31 - 1) _range = (-180, 180) units = 'degrees'
class OffsetCornerLatitudePoint1(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 03 07 01 02 01 03 07 01 00") TAG = 26 UDSKey = "06 0E 2B 34 01 01 01 03 07 01 02 01 03 07 01 00" LDSName = "Offset Corner Latitude Point 1" ESDName = "SAR Latitude 4" UDSName = "Corner Latitude Point 1" _domain = ((-2**15 - 1), 2**15 - 1) _range = (-0.075, +0.075) units = 'degrees'
class TargetWidth(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 01 07 01 09 02 01 00 00 00") TAG = 22 UDSKey = "06 0E 2B 34 01 01 01 01 07 01 09 02 01 00 00 00" LDSName = "Target Width" ESDName = "Target Width" UDSName = "Target Width" _domain = (0, 2**16 - 1) _range = (0, +10e3) units = 'meters'
class SlantRange(IEEE754ElementParser): key = hexstr_to_bytes("06 0E 2B 34 01 01 01 01 07 01 08 01 01 00 00 00") TAG = 21 UDSKey = "06 0E 2B 34 01 01 01 01 07 01 08 01 01 00 00 00" LDSName = "Slant Range" ESDName = "Slant Range" UDSName = "Slant Range" _domain = (0, 2**32 - 1) _range = (0, +5e6) units = 'meters'
class SensorRelativeElevationAngle(IEEE754ElementParser): key = hexstr_to_bytes("06 0e 2b 34 01 01 01 01 07 01 10 01 03 00 00 00") TAG = 19 UDSKey = "06 0e 2b 34 01 01 01 01 07 01 10 01 03 00 00 00" LDSName = "Sensor Relative Elevation Angle" ESDName = "Sensor Relative Elevation Angle" UDSName = "" _domain = (-(2**31 - 1), 2**31 - 1) _range = (-180, 180) units = 'degrees'
class SensorRelativeAzimuthAngle(IEEE754ElementParser): key = hexstr_to_bytes("06 0e 2b 34 01 01 01 01 07 01 10 01 02 00 00 00") TAG = 18 UDSKey = "06 0e 2b 34 01 01 01 01 07 01 10 01 02 00 00 00" LDSName = "Sensor Relative Azimuth Angle" ESDName = "Sensor Relative Azimuth Angle" UDSName = "" _domain = (0, 2**32 - 1) _range = (0, 360) units = 'degrees'
def test_PlatformPitchAngle(self): # See MISB ST0601.9 # @TODO: Limit display precision and add units as per example. interpretation = "-0.4315317239905987" tlv_hex_bytes = hexstr_to_bytes('06 02 FD 3D') value = tlv_hex_bytes[2:] from klvdata.misb0601 import PlatformPitchAngle self.assertEqual(str(PlatformPitchAngle(value).value), interpretation) self.assertEqual(bytes(PlatformPitchAngle(value)), tlv_hex_bytes) self.assertAlmostEqual(float(PlatformPitchAngle(value).value), -0.4315, 4)
class UAVBasicUniversalMetadataSet(SetParser): """MISB EG0104.4 Predator UAV Basic Universal Metadata Set http://www.gwg.nga.mil/misb/docs/eg/EG0104.4.pdf """ #key = hexstr_to_bytes('06 0E 2B 34 - 01 01 01 01 – 02 01 03 00 - 00 00 00 00') key = hexstr_to_bytes('06 0E 2B 34 - 02 01 01 01 – 0E 01 01 02 - 01 01 00 00') name = 'UAV Basic Universal Metadata Set' key_length = 16 parsers = {} _unknown_element = UnknownElement