Getting Started GNSS Application Develop

1. ntrip官方资料

http://software.rtcm-ntrip.org/

https://igs.bkg.bund.de/ntrip/download

 

2. rtklib手册

RTKLIB-rtklib_2.4.3b33/doc/manual_2.4.2.pdf

RTKLIB-rtklib_2.4.3b33/doc/doc/manual.docx

 

3. rtklib二次开发

https://github.com/libing64/learning_rtklib

 

4. 应用示例

/RTKLIB_2.4.3_b34/src

├── rtcm2.c
├── rtcm3.c
├── rtcm3e.c
├── rtcm.c
├── rtkcmn.c
├── rtklib.h

rtcm3.x fiter and decoder

#if 0
   for (it=rawData; it<rawData+len; it++){
 
        unsigned char cFirst = *it;
       
       if( 0xD3 == (cFirst & 0xFF) ){
           unsigned char cTemp1 = *(++it);
           // check reserved 6 bits == 0, 0xFC = 111111 00
           if( 0 != (cTemp1 & 0xFC) ){
               continue;
           }

           unsigned char cTemp2 = *(++it);
           // read message length
           nMsgLen = (cTemp1 & 0x03)*256 + (cTemp2 & 0xFF);

           msgBuf[0] = cFirst;
           msgBuf[1] = cTemp1;
           msgBuf[2] = cTemp2;

           // read message contents
           for(unsigned int j = 0; j < nMsgLen; j++){
               msgBuf[j+3] = *(++it);
           }

           // read CRC-24 parity
           for(unsigned int j = 0; j < 3; j++){
              crcBuf[j] = *(++it);
           }

           // perform CRC check
           unsigned int crc_calculated = 0;
           crc_calculated = crc_octests(msgBuf,nMsgLen + 3);
           if(crc_calculated == (crcBuf[0] << 16) + (crcBuf[1] << 8) + crcBuf[2] ){

               // parse the detail of RTCM
               //nMsgID = msgBuf[3+0]*16 + (msgBuf[3+1] & 0xF0)/16;
               nMsgID = getbitu(msgBuf, 24, 12);

                #if LOG_RTCM
                printf("\n%d  %d\n",++num, nMsgID);
                for(j=0; j<nMsgLen; j++) printf("%02x ",(uint8_t)msgBuf[j]);
                printf("\n");
                #endif
                
                rtcm_t *rtcm = malloc(sizeof(rtcm_t));
                init_rtcm (rtcm);
                for(j=0; j<nMsgLen; j++) input_rtcm3 (rtcm, (uint8_t)msgBuf[j]);
                decode_rtcm3(rtcm, Ntrip_ctx);
                free_rtcm (rtcm);
                free(rtcm);
                
           }
           //continue;
       }
   }
#else
   for (i=0; i<len; i++){

     if (len > i + 5 && (rawData[i] & 0xFF) == 0XD3) {

         // D3后面6bit为0,非0则不是
         if ((rawData[i+1] & 0xff) >> 2 != 0) {
            continue;
         }

         // 计算数据长度
         int length = ((rawData[i + 1] & 0x03) << 8)
                 | (rawData[i + 2] & 0xff);
         length += 6;
         if (len < i + length) {
             break;
         }

         // 获取数据并移除缓存
         memcpy(&msgBuf[0], &rawData[i], length);
         nMsgLen = length-3;
         // 校验
         if (checkRTCM(msgBuf, length) == true) {
               // parse the detail of RTCM

               //nMsgID = msgBuf[3+0]*16 + (msgBuf[3+1] & 0xF0)/16;
               nMsgID = getbitu(msgBuf, 24, 12);

                #if LOG_RTCM
                printf("\n%d  %d\n",++num, nMsgID);
                for(j=0; j<nMsgLen; j++) printf("%02x ",(uint8_t)msgBuf[j]);
                printf("\n");
                #endif
   
                rtcm_t *rtcm = malloc(sizeof(rtcm_t));
                init_rtcm (rtcm);
                for(j=0; j<nMsgLen; j++) input_rtcm3 (rtcm, (uint8_t)msgBuf[j]);
                decode_rtcm3(rtcm, Ntrip_ctx);
                free_rtcm (rtcm);
                free(rtcm);     
         }
     }
   }
#endif

rtcm3.x  encoder

void NtripServer::TheradHandler(void) {
  int cnt = 100;
  rtcm_t *rtcm = (rtcm_t *)malloc(sizeof(rtcm_t));
    
  while (thread_is_running_) {
    // TODO(mengyuming@hotmail.com) : Now just send test data.
    if (--cnt == 0) {  // Near once per second.
      init_rtcm (rtcm);
      //填充自己的星历数据
      //rtcm->nav.eph.[0] = ?
      gen_rtcm3(rtcm, 1019, 0, 0);
      ret = send(socket_fd_, rtcm->buff, rtcm->len, 0);
      cnt = 100;
      free_rtcm (rtcm);
    }
    std::this_thread::sleep_for(std::chrono::milliseconds(10));
  }    
  free(rtcm);
}

Simple NTRIP caster/client/server example programs, support the NTRIP 1.0/2.0 protocol

https://github.com/hanoi404/ntrip

 

5. 一个简单完整的ntrip系统

Simple NTRIP caster/client/server example programs, support the NTRIP 1.0/2.0 protocol; 

https://github.com/sevensx/ntrip

 

6. 第三方补充

使用Rtklib进行PPP定位和RTK差分定位

https://www.jianshu.com/p/ccca8d06d9eb

RTKLIB 手册解读及代码调试知识总结

https://zhuanlan.zhihu.com/p/145313467

 

7. ublox soc

https://www.u-blox.com

https://hunterwlong.com/u-blox-m8-configuration/

https://www.u-blox.com/sites/default/files/products/documents/u-blox8-M8_ReceiverDescrProtSpec_%28UBX-13003221%29.pdf 

https://www.u-blox.com/sites/default/files/ZED-F9P_InterfaceDescription_%28UBX-18010854%29.pdf

 

posted @ 2020-11-26 01:23  dong1  阅读(153)  评论(0编辑  收藏  举报