Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtkpos: detect code changes per frequency index #518

Open
wants to merge 1 commit into
base: demo5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/rtklib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,7 @@ typedef struct { /* satellite status type */
uint16_t snr_rover [NFREQ]; /* rover signal strength (0.25 dBHz) */
uint16_t snr_base [NFREQ]; /* base signal strength (0.25 dBHz) */
uint8_t fix [NFREQ]; /* ambiguity fix flag (1:float,2:fix,3:hold) */
int code[NFREQ][2]; // Current code per frequency index for the base and rover.
uint8_t slip[NFREQ]; /* cycle-slip flag */
uint8_t half[NFREQ]; /* half-cycle valid flag */
int lock [NFREQ]; /* lock counter of phase */
Expand Down
24 changes: 24 additions & 0 deletions src/rtkpos.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,26 @@ static void udrcvbias(rtk_t *rtk, double tt)
}
}
}
// Detect a change in the observation code for a given frequency index.
// Only one bias per frequency index per satallite is supported, so if the
// observation code changes then consider it a slip.
static void detslp_code(rtk_t *rtk, const obsd_t *obs, int i, int rcv) {
int sat = obs[i].sat;
for (int f = 0; f < rtk->opt.nf; f++) {
int code = obs[i].code[f];
if (code == CODE_NONE) continue;
int ccode = rtk->ssat[sat - 1].code[f][rcv - 1];
if (code != ccode) {
rtk->ssat[sat - 1].code[f][rcv - 1] = code;
// Skip flagging a slip and emitting a message when initializing.
if (ccode != CODE_NONE) {
rtk->ssat[sat - 1].slip[f] |= LLI_SLIP;
errmsg(rtk, "slip detected, code change (sat=%3d rcv=%d F=%d code=%2d %2s to %2d %2s)\n", sat,
rcv, f, ccode, code2obs(ccode), code, code2obs(code));
}
}
}
}
/* detect cycle slip by LLI --------------------------------------------------*/
static void detslp_ll(rtk_t *rtk, const obsd_t *obs, int i, int rcv)
{
Expand Down Expand Up @@ -795,6 +815,10 @@ static void udbias(rtk_t *rtk, double tt, const obsd_t *obs, const int *sat,
detslp_dop(rtk,obs,ir,ns,2,nav);

for (i=0;i<ns;i++) {
// Detect cycle slip by code change.
detslp_code(rtk, obs, iu[i], 1);
detslp_code(rtk, obs, ir[i], 2);

/* detect cycle slip by LLI */
detslp_ll(rtk,obs,iu[i],1);
detslp_ll(rtk,obs,ir[i],2);
Expand Down