예제 #1
0
 def doUpdate(self, sv, parser, namespace, values, option_string):
     if namespace.message_type == "zero":
         messageL1 = ConstMessage(1)
         messageL2 = messageL1
     elif namespace.message_type == "one":
         messageL1 = ConstMessage(-1)
         messageL2 = messageL1
     elif namespace.message_type == "zero+one":
         messageL1 = ZeroOneMessage()
         messageL2 = messageL1
     elif namespace.message_type == "crc":
         if isinstance(sv, GPSSatellite):
             messageL1 = LNavMessage(sv.prn)
             messageL2 = CNavMessage(sv.prn)
         elif isinstance(sv, GLOSatellite):
             messageL1 = GLOMessage(sv.prn)
             messageL2 = GLOMessage(sv.prn)
         else:
             raise ValueError(
                 "Message type is not supported for a satellite type")
     else:
         raise ValueError("Unsupported message type")
     if isinstance(sv, GPSSatellite):
         sv.setL1CAMessage(messageL1)
         sv.setL2CMessage(messageL2)
     elif isinstance(sv, GLOSatellite):
         sv.setL1Message(messageL1)
         sv.setL2Message(messageL2)
     else:
         raise ValueError("Unsupported object type in SV list")
예제 #2
0
def test_GLOSV_messages():
    '''
  GLONASS SV messages test
  '''
    sv = GLOSatellite(1)
    assert sv.l1Message == sv.getL1Message()
    assert sv.l2Message == sv.getL2Message()
    msg = GLOMessage(1)
    sv.setL1Message(msg)
    assert sv.l1Message == sv.getL1Message() == msg
    assert sv.l2Message == sv.getL2Message() == msg
    msg2 = GLOMessage(3)
    sv.setL2Message(msg)
    assert sv.l1Message == sv.getL1Message() != msg2
    assert sv.l2Message == sv.getL2Message() != msg2
예제 #3
0
def test_GLOMessage_init4():
    '''
  GLONASS message: test time stamp roll over
  '''
    msg = GLOMessage(prn=0,
                     tow0=(23 * 60 + 59) * 60 + 30,
                     n_msg=0,
                     n_prefixBits=0)
    assert msg.prn == 0
    assert msg.tow0 == 86370
    assert msg.n_msg0 == 0
    assert msg.n_prefixBits == 00

    assert isinstance(msg.messageBits, numpy.ndarray)
    assert msg.messageBits.shape == (0, )
    assert msg.messageCount == 0
    assert msg.messageLen == 0

    assert msg.nextMsgId == 1
    assert msg.nextTk_h == 23
    assert msg.nextTk_m == 59
    assert msg.nextTk_30s == 1

    msg.addMessages(15)

    assert msg.messageBits.shape == (3000, )
    assert msg.messageCount == 15
    assert msg.messageLen == 3000

    assert msg.nextMsgId == 1
    assert msg.nextTk_h == 0
    assert msg.nextTk_m == 0
    assert msg.nextTk_30s == 0
예제 #4
0
def test_GLOMessage_str():
    '''
  GLONASS message: test string representation
  '''
    msg = GLOMessage(prn=0, tow0=0, n_msg=0, n_prefixBits=0)
    value = str(msg)
    assert value.find('prn=0') >= 0
    assert value.find('tod=00:00:00') >= 0
    assert value.find('pref=0') >= 0
예제 #5
0
def test_GLOMessage_getDataBits0():
    '''
  GLONASS message: test getting bits
  '''
    msg = GLOMessage(prn=0, tow0=0, n_msg=1, n_prefixBits=0)
    dataAll_idx = numpy.linspace(150, 449, 300, dtype=numpy.long)
    bits = msg.getDataBits(dataAll_idx)
    assert isinstance(bits, numpy.ndarray)
    assert bits.shape == (300, )
    assert (bits == msg.messageBits[150:450]).all()
예제 #6
0
def test_GLOMessage_init3():
    '''
  GLONASS message: test time step
  '''
    msg = GLOMessage(prn=0, tow0=0, n_msg=15, n_prefixBits=0)
    assert msg.prn == 0
    assert msg.tow0 == 0
    assert msg.n_msg0 == 15
    assert msg.n_prefixBits == 00

    assert isinstance(msg.messageBits, numpy.ndarray)
    assert msg.messageBits.shape == (3000, )
    assert msg.messageCount == 15
    assert msg.messageLen == 3000

    assert msg.nextMsgId == 1
    assert msg.nextTk_h == 0
    assert msg.nextTk_m == 0
    assert msg.nextTk_30s == 1
예제 #7
0
def test_GLOMessage_init1():
    '''
  GLONASS message: test construction with prefix
  '''
    msg = GLOMessage(prn=0, tow0=0, n_msg=0, n_prefixBits=50)
    assert msg.prn == 0
    assert msg.tow0 == 0
    assert msg.n_msg0 == 0
    assert msg.n_prefixBits == 50

    assert isinstance(msg.messageBits, numpy.ndarray)
    assert msg.messageBits.shape == (50, )
    assert msg.messageCount == 0
    assert msg.messageLen == 50

    assert msg.nextMsgId == 1
    assert msg.nextTk_h == 0
    assert msg.nextTk_m == 0
    assert msg.nextTk_30s == 0