Git Product home page Git Product logo

pyspartn's People

Contributors

jonathanmullergeosatis avatar semuadmin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pyspartn's Issues

Found a solution for : "OCB payload decode is failing where nData < 35"

Main page specify that OCB payload decode is failing where nData < 35 (this is probably due to a misinterpretation of the payload specification).
This is true.
The reason the wrong place of IODE field in OCB messages.

Example for SPARTN-1X-OCB-GPS :
SF018 should be in the ORBCLK_BLOCK block (that is optionally read if orbit/clock/delay are set) while it is currently read every time because it's after the OCB_SAT_FLAGS block

groupSat": (  # Satellite Block table 6.4
            NB + "SF011",  # repeating group * num bits set in SF011
            {
                "SF013": "Do not use (DNU)",
                "optSat": (
                    ("SF013", 0),  # if SF013 = 0
                    {
                        **OCB_SAT_FLAGS,
Remove  --------------> "SF018": "GPS IODE",
                        **ORBCLK_BLOCK,
                        "optBias": (
                        ...
                        ...
ORBCLK_BLOCK = {  # tables 6.5 & 6.6 Orbit and Clock Blocks
    "optOrbit": (
        ("SF014O", 1),  # if SF014O = 1
        {
Add  -----> "SF018": "GPS IODE",
            "SF020R": "Orbit radial correction",
            "SF020A": "Orbit along-track correction",
            "SF020C": "Orbit cross-track correction",
            ...
            ...

image

However as it's type depend on the OCB message (IODE of GPS/GLO/GAL/BDS) I'm not sure the best way to parse it. Either copy-paste the block for each constellation type, or do it differently ?

How to reproduce :

import datetime

from pyspartn import SPARTNReader, SPARTNMessage

msgs = []

key = "930d847b779b126863c8b3b2766ae7cc"
msgs.append(b's\x00\x12\xe2\x08\xd6\xde\x07\xe8[\x11\x88CO\xe7Z\x9e\x91\x85\xd1\x9a\x14t\x7f,\xe1\x0e\xaa\xc9OX\xa5\xf1\x12\xb3\x02\xc0`F\xf8H\xba\xfa\x0c\xda\xee=q\xcd\x00\x057')
msgs.append(b's\x00\x10\xe3\x18\xd6\xdfX\xd8[\x10H\xa8\xff;\xec\xe7>;\x91\xbe\xa4\xa0p0\x1b~\xf3\x8a;N\xb6\xc5b\x9eQ\xbb.>\x98O\x0f\x18\xd7\xc6\xa6\xa0~')
msgs.append(b's\x00\x16i(\xd6\xde\x07\xe8[\x12\xc8\xa8\x94)\xa6)7\xd2\xe5\xdb\x06\xe0\xfaQ\xd0\xc958 \xacw\x14I\x92q\x98\xe2\xe2\xa2\xe0-X\x01Xe\xd1\x14\x18Z8\xae<\xad\x83\xdd\xbe`\xeb')
for msg in msgs:
    parsed = SPARTNReader.parse(msg, decode=True, key="930d847b779b126863c8b3b2766ae7cc", basedate=datetime.datetime(2024, 4, 12, 9, 17, 0))
    print(parsed)
    print(parsed._decode)
    parsed_typed: SPARTNMessage = parsed
    print()
Manual parsing :

        SPARTN-1X-OCB-GPS,
        00010100100000000000001000011000001000000110010110010111111101000101101000010010111111011101110011110010010111111011100011011010100010011011011100100101100010010111111101000111101010010010111111100100110110010010010111111011101111101010010010111111011011001011000010010111111100010010000000110000
        000101001 SF005 -> 51 -> name of solution
        0 SF010 -> 0 -> still more messages to follow
        0 SF069 -> 0 -> reserved
        0 SF008 -> 0 -> No Yaw (SF021) in all orbits
        0 SF009 -> 0 -> Time is normal
        00 SF016 -> 0 -> GPS L1C/A band used
        00 SF011_A -> 0 -> 32 bits to follow
        00000100001100000100000011001011 -> SF011_B -> There will be 9 sat to follow
        
        0010111111011101110011110010010111111011100011011010100010011011011100100101100010010111111101000111101010010010111111100100110110010010010111111011101111101010010010111111011011001011000010010111111100010010000000110000
        
        Sat  6 : 
                0   SF013 -> 0 -> satellites fields are present
                010 SF014 -> 0 1 0 -> Orbit NO, Clock YES, Bias NO
                111 SF015 -> 7 -> There has been no discontinuity in the last 320 seconds
                    Orbit : No orbit (because of flag)
                    Clock : 
                            111            SF022 -> The data has been using the same IODE since 320 seconds
                            10100010110100 SF020 -> 10420 == -4.456m of correction
                            001            SF024 -> 1 == 0.001m of error expected
                    Bias : No bias (because of flag)
        Sat 11
        Sat 12
        Sat 18
        Sat 25
        Sat 26
        Sat 29
        Sat 31
        Sat 32
        
        
        
        SPARTN-1X-OCB-GAL
        0001010011000001000010100111010000000000011100001010000010111111100000100011000010010111110100000000110000010010101101011100001010110010010111111011110101100110110010111110011111101011100010010111110011110110010010010010111110100010010110100010010111110100011011111010010010111110100000010101010010010111111101001000011100010010111110100011110001010010
        000101001 -> SF0005 -> 41 -> name of solution
        1 -> SF010 -> 1 -> all OCB messages for the epoch were sent
        0 -> SF069 -> 0 -> reserved
        0 -> SF008 -> 0 -> YAW is not present for any of orbit block
        0 -> SF009 -> 0 -> normal date reference
        001 -> SF096 -> 1 -> Ephem of type Galileo I/NAV
        00 -> SF093_A -> 0 -> 36 bits to follow
        001010011101000000000001110000101000 -> SF093_B
        
        sat 3
            
        sat 5
                0    -> SF013 -> 0 -> sat fields present
                010  -> SF014 -> orbit = 0, clock = 1, bias = 0
                111  -> SF015 -> 7 -> Maximum continuity
                        Orbit : No orbit
                        Clock :
                               111            -> SF022 -> 7 -> IODE maximum continuity 
                               10000010001100 -> SF020 -> -140 == -0.28m of correction
                               001            -> SF024 -> 1 == 0.001m of error expected
                        Bias : No bias
        sat 8
        sat 9
        sat 10
        sat 12
        sat 24
        sat 25
        sat 26
        sat 31
        sat 33

SPARTN-1X-OCB-GLO bad decryption

Decryption of SPARTN-1X-OCB-GLO doesn't seem to be correct. The output result looks random (not a single field looks correct)

It looks to be related to the ambiguity resolution as SPARTN-1X-OCB-GLO are the only messages with 16 bits GNSS time tag defined in GLONASS epoch (rather than being 32 bits with no ambiguity or defined in GPS epoch)

Ideally a parameter of one of the function in the chain should specify if GPS time needs to be used or GLONASS
I'm not sure how to solve it cleanly for now but I'll think about it and try to come with a proposal (or maybe @semuadmin has an idea on how to do that properly)

image

def convert_timetag(timetag16: int, basedate: datetime = datetime.now()) -> int:
    ...
    ...
    base16 = datetime(basedate.year, basedate.month, basedate.day, 0, 0, 0)
    secs = timetag16
    if basedate.hour >= 12:
        secs += 43200
    time16 = base16 + timedelta(seconds=secs)
    return date2timetag(time16)

Code to reproduce :

import datetime

from pyspartn import SPARTNReader, SPARTNMessage

msgs = []

key = "930d847b779b126863c8b3b2766ae7cc"

# msgs.append(b's\x00\x14h\x04\x120[\x11\x08(\x18\x14&\x98\x9e|\xdaz\x14\x01\xc0\xa5HS\xbc\xdb\xba\xc7\xcd\x83VuQ\xa5O\xc6\xc8]G\xe8\xc6t\xbcX\xd79\xe1*6\xa9\xfe\xc2')
# msgs.append(b's\x00\x0e\xec\x10\x1d [\x1e\xc8\xd6_\xf6q\xb8\x94\xdfja\x7fLh\x94\x89#G9\xbd%\xdfi\x15B\xc6\xe6y\xb3V\t\x04D)')
msgs.append(
    b's\x02\xb8j\x18\xd7)+p[\x10\x88\x04\xcf\xe7\xb3\xec\xf2l\xc1\xd9J\xd2qj\xc4\x8fW[\\\x08\x87\xe4\xa0\xb1\x1c\xb3\x96\xfc\xdci\x07\xf2\xf5\'5\t\x7f\xd0.\xe42\x0c\x0b\xb8\xd9r|\x8b\xcf\xd8c\x02\xe8t~\xfayqJHVU\xb9D\x1b\x02\xe1\xedK\xb6%p\xf1Z\xc2y+$M\xf9\xad\xa1?\xcb\xde6\xc0\x99\x02)\x7f\xde\xb1\xc85\xc7\xab\xc0x\x9f(\xc3K\xe66\xa0c\\4d\xf6\xb0\xaf-\x10x\x06\xa7\xadGl4\xec\xe6_\xa5;\xde\x12\xb4_\xdd\x10\x83J\xfb\xf6!\xf5]\xeaR\x08\x06)\x9fg\x03${\x10\xefVR+\xa7d=\x8d\x97U\xe7\x88\xc7\x01&\xccD#j\x19d\x87\x92">\xcb\xdaOET\xbfL\xfc\x8bQ{\xca\xb9\x89\xae\xe0\xd6\x7f\xcf\x154\n\xe7\x87Bau\xb5\xf3&\xcb\x8dp\xbbi\xcck\x99\xf4\xdfq\xd5\xa4\x85U\xb8\xb0NE\x8eO\x1a\xc9\xf6\xf3\x95\xcc\xc7\xe0\xa5~\x97\r\xca\x954.\x0e\x0c5\xfc\x011\xdbc\x8d\x1e\x8d\x84>\x07\x0cL\x87\xc9\xec\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"\xcd\xd1\xce0\x8di}\xc5$\x8ezd\xc6\x83]QO\xbf\xf44\x95\nv\xb0\x16\xec\xc1\xc3\xc0\x9d\x95\xdc\x9cR\x07l\xda\xc8\x05{\x18|\x11\x81\xdc\x1c\x84\x14\x91\x87\xba\xbc\x05L\xa4\xaa\xed\x8d\rsfqOh\xd7\x17b\x92w\x13\x959\x9cT\x8d\xd7\x0f\xd4\xb0/\x8a\xcfH\xe9\xce\xd0\xd3\x0e\x85R\xb9N7\x18Q\xddK\xb2z\xe5\xc5\xef\x82\x06\x9b\x94\x0c\xa8Sl\xe6\xb0QN\xe7\xd0Y\xab\x8f\x03\xa9n \r\x0f`\xe3\xfd*\xcbN\xe3\x08\x08\x0c\xb5\xb7h:\x06\xe1\x98\xc6At\xdah\xcd\xd7JC\xe9\x0f\xca\xd8\x96\xcc\xd08\xdb\xabw\xa4\xa7+c\xff\x8b\x056\x98\xf1\xca\x19l\x04V!p\xe2\xf3K\xaf\xe2b\xae\x9f\xd3@\xcc\x8fM"n\xc6_9\xdf\x01\ta\xba3\xf1G\x17?\xbd\x8d\xc0\xf6\xb4#\xccRe\x8e<\x1c\xa8\xcc\x02\x11\x89\x18Z\xdd\xca\xdcms\x82\xbak\xf3P\x08y\x12a\xd2$\x9cn\xc2*6/\xc6(Ksc\xaf1\xb8k\xb9\'\xd0\x84\xee\x1b\x82^\xcdG\x10\xf1\xe8\xe5\xb8\x88\x81\xe7y\xbfZ\xa9\xb9"\xf1LpL\xb2\x06\xf9\x95O\xef\xf63\xe19\xb9\xe9\xa2\xe5\xba\xa7\xd7j\xbd\xdf1y_\xbe\xcc+\x936\x94;U"\x81\xac\x83_\xd7\x8b\xb9\xdb\x1e\x06\xbd\xcf\xd5pz\x8cS\xcb\xcb\xf1\x96\x04\xf5jUJ\xc9G\x83\xf6\xces\xc7\xad\xf1=\x00\xbe\x91\x134\xa9\xf3\x07M\x1d@aUPJ5z\x06\x9e\xcdv%')
msgs.append(
    b"s\x02\xce\xed8\xd7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h\x01\x15\xbb\xe7<\xee{F\xb3t\xed\x06\xd1\xe5\x9c\xb8\xba_\xb0uZ\xca\xd3\x91"\xc0mB-\xff\x18\xde\xda$\xe7\xc1LX*\xe0.\xf6\x91@\xfd\x8cCx\xed\x87\x0e\xa7{\xf5[g\x15<\xd8\xd9j\xfd\x967\xf0\x83\xe7Y#C2\xde\xb4\xe1\x06\x16\xf3\x94!\xf9:\x12S\xb0\xae\xdf-\x01U\x0e\xf8\xc8\xae\xae\xec\xeaT\xc4\xf3[\x11\x00l\x1e\x95\xaf\x00\x81\x7f\xda\xee\x08\xcdLw[\xe6TLe\xa2\xff\x08\r\x91(\xfcf\x9d\xc6<\xc29\xc6\x83\xb3tB\x95R\xf3\xe5\x89\xc4\x9d\x8e\x99\x1cj^\xa8\xc1\xe0x1=\x01\x14\xf1\x88\xcaOr\x05e\xb1\xc2\xd3\x0em\x7f\xc2\x15\xeb\x05\r\xc5\xa8\xff\xa9W~\xf1q\x1f\xe7\n\x1aB\xc1\xeb\xfd\x98xF=\xe9\xde\xdd\xd9\xc0\xdf\'\xd3\x03\x81\xbc\x97\xf4` \x03KQ\xaa\xe2\xc2\xb5^\xa3')
msgs.append(
    b's\x02\xee\xee(\xd7\'\xda\x80[\x10H{\x1e$z\x86\xee\xae\xfd\x97f\xef\xefa\xbeX\xb0\x0f\xde\xfa\x97\x1d\xe8$\x8c\x08\xe6\xf1m\x14\xd6#S\x19\xea\x1b\xd9\xee/\x15\xa1^\xc4t\x8c\x1d\xcca\x18Zq,\xb8\x0e\x90\xe1[\x96\x1b\xd1\x16\x87\xb7\x9f(\xf28\x83\x17x<\x16\xf8\x13T\xda\xa1\xec\xde"\xfe~\'\x1ap\xbb\x1c{\xf0\x88\xe8\xe1V\xf5\xfd\xc1\x8a|\xc4\x0e\xf3s\x17z\xa7\xbd\xd8w\x9f\xca\xce\xbc\xb3\x97w\xa0\xd0+\x0e9J&/~9\x9f\xdeT\x9d\xcf\x17\x99]\x177L\xf2\xadO\xd6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\x94\xbd\xe5\xc6\xb6\xfd\x14i\xb6\x1e\xc0\x14\x96$]\xe1(\xe1\xb7v\x02$?\x9bd\xef\x8d\xc9\x12\xff\x99j3\x95U\xf5\x8e1p$\xa9\xd9")
msgs.append(b's\x00\x14h\x04\x12\xa8[\x11\xc8V\xf4^R\xac\xaf\xc7.Q\t\x82\x9c\xa3\xc2\x02H\xca\xb1J\xc4\x18\xc6A:\x90qZ-\x08\xee\xf8\xa8\x93\xc3\xfa\xcb\xdf\x9a\xa9\x0e\xaa\x9e\xf1')
msgs.append(b's\x00\x0e\xec\x10\x1d\x98[\x1f\x88r^\\\xff\xf6\x1a\xf8\x97\xf0)u"\xb1\x04\xe0\xb8\x1b\xbeu\x8d\xcao{\x01sUn\xc1\xc1b\x05I')
msgs.append(b"s\x00\x14h\x04\x12\xd0[\x12\x08&\x9b\nOi\x90\xe3\xccKp\x99\xc7w9\xd4\x8cY\xed'\xd2\xcb\x97`\xa4mT\xb5S\xbe&\xac-\x00u\x19\x1d\xcch\x96\x87\xcat\xcc")

msgs.append(b"s\x00\x0e\xec\x10\x1d\xc0[\x1f\xc8'e\x0f\xfc\xc4\x14z\x96\xc4h\x14\xe1\xec=\x05\x03\xc9\xa1h\xab\xc9\x99w\xbfN\x1fh\xee\xad\xb4\xf7\x1d")
msgs.append(b's\x00\x0c\xed4\x12`[\x17\xc8\x1c\\\x8d}\xf2\xafp=\xc9\x02\xf2J\xab\xa2\xd2Pc\x11\x00\r\xac\x16\xec\xd6\xd4j\x95?')
msgs.append(b"s\x00\x11c$\x12\xd0[\x1f\xc8\xd8O\x9e\x0f\x04X\xe7N7!\x9c\xa6g\x8c7\xbf[\t\x1c'\x99k\x954\xb8\xe8jR\x9dmBG\xd8\x07\x05\xd5K")

for msg in msgs:
    try:
        parsed = SPARTNReader.parse(msg, decode=True, key=key, basedate=datetime.datetime.utcfromtimestamp(1713519000))
        # print(parsed._decode)
        parsed_typed: SPARTNMessage = parsed
        print(f"{parsed_typed.identity}")
    except Exception as e:
        print(e)


MQTT Client - TypeError: can't subtract offset-naive and offset-aware datetimes

pyspartn Bug Report Template

TypeError: can't subtract offset-naive and offset-aware datetimes when processing basedates without timezone information.

Exception in thread paho-mqtt-client-<<redacted>>:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/paho/mqtt/client.py", line 4523, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/paho/mqtt/client.py", line 2297, in loop_forever
    rc = self._loop(timeout)
         ^^^^^^^^^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/paho/mqtt/client.py", line 1686, in _loop
    rc = self.loop_read()
         ^^^^^^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/paho/mqtt/client.py", line 2100, in loop_read
    rc = self._packet_read()
         ^^^^^^^^^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/paho/mqtt/client.py", line 3142, in _packet_read
    rc = self._packet_handle()
         ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/paho/mqtt/client.py", line 3808, in _packet_handle
    return self._handle_publish()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/paho/mqtt/client.py", line 4145, in _handle_publish
    self._handle_on_message(message)
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/paho/mqtt/client.py", line 4501, in _handle_on_message
    on_message(self, self._userdata, message)
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/pygnssutils/gnssmqttclient.py", line 411, in on_message
    for raw, parsed in spr:
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/pyspartn/spartnreader.py", line 135, in __next__
    (raw_data, parsed_data) = self.read()
                              ^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/pyspartn/spartnreader.py", line 165, in read
    (raw_data, parsed_data) = self._parse_spartn(byte1)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/pyspartn/spartnreader.py", line 251, in _parse_spartn
    parsed_data = self.parse(
                  ^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/pyspartn/spartnreader.py", line 328, in parse
    return SPARTNMessage(
           ^^^^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/pyspartn/spartnmessage.py", line 98, in __init__
    self._do_attributes()
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/pyspartn/spartnmessage.py", line 167, in _do_attributes
    iv = self._get_iv()
         ^^^^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/pyspartn/spartnmessage.py", line 203, in _get_iv
    timeTag = convert_timetag(self.gnssTimeTag, self._basedate)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/pyspartn/spartnhelpers.py", line 282, in convert_timetag
    basedate_seconds = date2timetag(basedate)
                       ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/steve/Library/Python/3.12/lib/python/site-packages/pyspartn/spartnhelpers.py", line 245, in date2timetag
    return int((date - TIMEBASE).total_seconds())
                ~~~~~^~~~~~~~~~
TypeError: can't subtract offset-naive and offset-aware datetimes

To Reproduce

Steps to reproduce the behaviour:

  1. Run spartn_mqtt_client.py example with decryption enabled.

Expected Behaviour

  • No error.

Desktop (please complete the following information):

  • All platforms.

SPARTN data source (please complete the following information as best you can):

  • Thingstream PointPerfect MQTT 100H

(NB: Please redact any current SPARTN decryption keys)

Additional context

Add any other context about the problem here.

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.