Coder Social home page Coder Social logo

snstac / aircot Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 6.0 571 KB

Aircraft classifiers for TAK

Home Page: https://aircot.rtfd.io

License: Apache License 2.0

Makefile 4.14% Python 95.86%
ads-b adsb aircraft airplanes atak cot cursor-on-target drone helicopters itak

aircot's People

Contributors

ampledata avatar brian7704 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aircot's Issues

ValueError: invalid literal for int() with base 16: '0xTIS-B_308639'

I'm getting data from airplanes.live and using adsxbcot to convert it into a CoT. It seems to work fine except for TIS-B data. I get the following traceback:

Traceback (most recent call last):
  File "/home/administrator/airplanes_live2cot.py", line 26, in get_airplanes_live_data
    event = adsbxcot.adsbx_to_cot(craft, known_craft=None)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/administrator/.venv/lib/python3.11/site-packages/adsbxcot/functions.py", line 203, in adsbx_to_cot
    cot: Union[ET.Element, None] = adsbx_to_cot_xml(craft, config, known_craft)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/administrator/.venv/lib/python3.11/site-packages/adsbxcot/functions.py", line 150, in adsbx_to_cot_xml
    cot_type = aircot.set_cot_type(icao_hex, cat, flight, known_craft)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/administrator/.venv/lib/python3.11/site-packages/aircot/functions.py", line 349, in set_cot_type
    cot_type = aircot.adsb_to_cot_type(icao_hex, category, flight)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/administrator/.venv/lib/python3.11/site-packages/aircot/functions.py", line 88, in adsb_to_cot_type
    icao = int(f"0x{icao.replace('~', 'TIS-B_')}", 16)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 16: '0xTIS-B_308639'

This is the data it's failing on:

{'hex': '~308639', 'type': 'tisb_other', 'alt_baro': 'ground', 'gs': 0.0, 'track': 0.0, 'lat': xx.xxxxxx, 'lon': xx.xxxxxx, 'nic': 8, 'rc': 186, 'seen_pos': 13.15, 'nac_p': 8, 'nac_v': 2, 'sil': 2, 'sil_type': 'unknown', 'mlat': [], 'tisb': ['gs', 'track', 'lat', 'lon', 'nic', 'rc', 'nac_p', 'nac_v', 'sil', 'sil_type'], 'messages': 11, 'seen': 13.2, 'rssi': -29.3, 'dst': 4.347, 'dir': 180.9}

I think a possible fix would be to change icao = int(f"0x{icao.replace('~', 'TIS-B_')}", 16) to icao = int(f"0x{icao.replace('~', '')}", 16). If you're ok with that, I can submit a PR. Thanks!

Improve known_craft DB performance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.