Implement Galileo E1B I/NAV navigation decoding
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from galileo_rx.navigation.inav_page_decoder import InavPage
|
||||
from galileo_rx.navigation.inav_word_parser import EphemerisClockWord4, InavWordParser
|
||||
|
||||
|
||||
def _put(bits: list[int], start: int, width: int, value: int) -> None:
|
||||
if value < 0:
|
||||
value += 1 << width
|
||||
for index in range(width):
|
||||
bits[start + index] = (value >> (width - 1 - index)) & 1
|
||||
|
||||
|
||||
def test_word4_signed_scaling_and_units() -> None:
|
||||
bits = [0] * 128
|
||||
for start, width, value in [(0, 6, 4), (6, 10, 77), (16, 6, 12), (22, 16, -3), (38, 16, 5), (54, 14, 9000), (68, 31, -100), (99, 21, 200), (120, 6, -2)]:
|
||||
_put(bits, start, width, value)
|
||||
page = InavPage(12, 0, 100, [], [], 4, True, True, True, False, 0.0, 0, bits, 200)
|
||||
parsed = InavWordParser().parse(page)
|
||||
assert parsed.iod_nav == 77
|
||||
assert isinstance(parsed.payload, EphemerisClockWord4)
|
||||
assert parsed.payload.svid == 12
|
||||
assert parsed.payload.cic_raw == -3
|
||||
assert parsed.payload.toc_s == 540000.0
|
||||
assert parsed.payload.clock_bias_s == -100 * 2.0**-34
|
||||
Reference in New Issue
Block a user