tomojitakasu / RTKLIB

2.56k stars 1.63k forks source link

Several tiny bugs in 2.4.3 #251

Open linkaiqin opened 8 years ago

linkaiqin commented 8 years ago

There may be some bugs in 2.4.3

  1. In relpos()-->satposs(obs,n), parameter n is the number of rover and base observation. The parameter n can reach to 2 MAXOBS. But in satposs(obs,n) function, the max value of n is limit to MAXOBS. Modify MAXOBS to 2 MAXOBS in satposs() may fix the issue. for (i=0;i<n&&i<MAXOBS;i++) ---> for (i=0;i<n&&i<2*MAXOBS;i++)

  2. The value of rtk->ssat[i].lock should be initialized to -opt->minlock in rtkinit() function.

  3. outnmea_gsv() may output zero SNR of a satellite which is not the common satellite between rover and base in kinematic mode. To fix the issue, don't clear rtk->ssat[i].snr[0] in relpos()

    for (i=0;i<MAXSAT;i++) {
        rtk->ssat[i].sys=satsys(i+1,NULL);
        for (j=0;j<NFREQ;j++) rtk->ssat[i].vsat[j]=rtk->ssat[i].snr[j]=0;
    }
    --->
    for (i=0;i<MAXSAT;i++) {
        rtk->ssat[i].sys=satsys(i+1,NULL);
        for (j=0;j<NFREQ;j++) rtk->ssat[i].vsat[j]=0;
        for (j=1;j<NFREQ;j++) rtk->ssat[i].snr[j]=0;
    }
  4. rtksvrfree() should call rtkfree() to free the memory of rtk->xand rtk->P

  5. In streamsvr.c nexsat() for (p=p0>p2?p1:p0+1;p!=p0;p=p>=p2?p1:p+1) should be changed to for (p=p0>=p2?p1:p0+1;p!=p0;p=p>=p2?p1:p+1)

linkaiqin commented 7 years ago

There are several bugs in ublox.c and rtcm3.c

  1. A bug on week handover in decode_trkmeas()
    /* adjust week handover */
    t=time2gpst(raw->time,&week);
    if      (tr<t-302400.0) week--;
    else if (tr>t+302400.0) week++;
    time=gpst2time(week,tr);   

    --->

    /* adjust week handover */
    t=time2gpst(raw->time,&week);
    if      (tr<t-302400.0) week++;
    else if (tr>t+302400.0) week--;
    time=gpst2time(week,tr);
  2. A bug on PRN number in decode_cnav()
    if (prn>=5) { /* IGSO/MEO */
         .....
    }

    --->

    if (prn>5) { /* IGSO/MEO */
         .....
    }
  3. A bug on ephemerides comparing in decode_type63() and decode_type1047(). Compare ephemerides by Toe since Beidou has no IODE ouput.
    if (!strstr(rtcm->opt,"-EPHALL")) {
        if (eph.iode==rtcm->nav.eph[sat-1].iode) return 0; /* unchanged */
    }

    --->

    if (!strstr(rtcm->opt,"-EPHALL")) {
        if(timediff(eph.toe,rtcm->nav.eph[sat-1].toe)==0.0)  return 0; /* unchanged */
    }
tomojitakasu commented 7 years ago

Thanks. They are fixed in 2.4.3 b27. (except for No.2 in the first comment)