¡¡ |
Project Maintainer: Yu Lu |
![]() |
|
|
|
|
|
|
|
|
Provide functions to communicate with device driver, to control hardware, also provide functions to copy raw data from GP2021 to navthread, and to get processing result from navthread. | |
Provide funtions to implement tracking loop with 4 states: acquisition, confirm, pullin, tracking. When signal is being locked, read measurement to calculate accurate transmitting time. Also read navigation message from tracking loop. | |
Provide gps-related functions, including Geodetic to ECEF frame transformation (and vice vesa), calculate satellite's position from Almanac data and ephemeris data, resolve estimation of PVT ,etc | |
Implement display of raw data, tracking loop status for each channel, also navigation result. This class is also responsible of system initialization, global variable initialization, etc. |
     ...
     ca_t = ch[idx].theta[l] - ch[idx].theta[l-1];
    
     if( fabs(ca_t) > PI )
      ca_theta = ca_t > 0? ca_t - 2*PI : ca_t + 2*PI;
     else
      ca_theta = ca_t;
     ch[idx].total_theta += ca_theta;
     ...
After this PI-compensation,ch[idx].total_theta
stores the correct phase change for these 4 accumulation data, it can be used to control FLL of carrier loop.
     ...
    
     int ms_diff, tic_ms_mod20, compensate_ms;
    
     ms_diff = (frm_4ms_6ch.ch_cntl[idx].epoch) & 0xff;
     ms_diff -= ch[idx].epoch_ref; // minus epoch_check value
     if(ms_diff < 0) ms_diff += 20;// get the value of [0 -- 19]
     tic_ms_mod20 = ch[idx].TIC_mscount %20;
     if( fabs( ms_diff - tic_ms_mod20) < 10)
      compensate_ms = ms_diff - tic_ms_mod20;
     else // ms_diff and tic_ms_mod20 should be very close,
      {
      if( ms_diff > tic_ms_mod20)
        compensate_ms = -(tic_ms_mod20 - ms_diff + 20);
      else
       compensate_ms = (ms_diff - tic_ms_mod20 + 20);
      }
    
    
     ch[idx].tr_time = ch[idx].tr_time_HOW+(ch[idx].TIC_mscount+compensate_ms)*0.001+
     (frm_4ms_6ch.ch_cntl[idx].code_phase)/2.046e6 +
     (frm_4ms_6ch.ch_cntl[idx].cd_dco_phase)/2.046e6L/1024.;
    
     ...
Here ch[idx].epoch_ref
stores the value of EPOCH_CHECK for that channel,
ms_diff
stores the value of ch[idx].epoch - ch[idx].epoch_ref
.
And compensate_ms
is the value that should be added to ch[idx].TIC_mscount
in order to solve 1ms ambiguity.
The value of compensate_ms
is small, such as -2,1,or 0.
In most time, this method will give correct transmitting time; but sometimes( although seldomly ),
it will fail. If someone can find better and more stable method to solve this problem,
welcome to tell me.