Skip to content

Commit

Permalink
- Improvements for moving-base RTK solution
Browse files Browse the repository at this point in the history
- Make baseline constraint independent of moving-base mode
- Add option to specify baseline constraint on command line in rnx2rtkp
- Add option to run RTKRCV with no console
- Add option in defines to RTKPOS to skip initial standard precision estimates to increase run speed
- Minor cleanup
  • Loading branch information
rtklibexplorer committed May 25, 2023
1 parent 1854c43 commit 4b519f3
Show file tree
Hide file tree
Showing 13 changed files with 144 additions and 92 deletions.
4 changes: 2 additions & 2 deletions app/consapp/rnx2rtkp/gcc/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ OPTS = -DTRACE -DENAGLO -DENAQZS -DENAGAL -DENACMP -DENAIRN -DNFREQ=3 -DNEXOB

# for no lapack
CFLAGS = -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I$(SRC) $(OPTS) -pg
#LDLIBS = -lm -lrt
LDLIBS = -lgfortran -lm -lrt -pg
LDLIBS = -lm
#LDLIBS = -lgfortran -lm -lrt -pg

#CFLAGS = -Wall -O3 -ansi -pedantic -Wno-unused-but-set-variable -I$(SRC) -DLAPACK $(OPTS)
#LDLIBS = -lm -lrt -llapack -lblas
Expand Down
4 changes: 4 additions & 0 deletions app/consapp/rnx2rtkp/rnx2rtkp.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static const char *help[]={
" -c forward/backward combined solutions [off]",
" -i instantaneous integer ambiguity resolution [off]",
" -h fix and hold for integer ambiguity resolution [off]",
"-bl bl,blstd baseline dist and stdev",
" -e output x/y/z-ecef position [latitude/longitude/height]",
" -a output e/n/u-baseline [latitude/longitude/height]",
" -n output NMEA-0183 GGA sentence [off]",
Expand Down Expand Up @@ -161,6 +162,9 @@ int main(int argc, char **argv)
else if (!strcmp(argv[i],"-a")) solopt.posf=SOLF_ENU;
else if (!strcmp(argv[i],"-n")) solopt.posf=SOLF_NMEA;
else if (!strcmp(argv[i],"-g")) solopt.degf=1;
else if (!strcmp(argv[i],"-bl")&&i+2<argc) {
for (j=0;j<2;j++) prcopt.baseline[j]=atof(argv[++i]);
}
else if (!strcmp(argv[i],"-r")&&i+3<argc) {
prcopt.refpos=prcopt.rovpos=0;
for (j=0;j<3;j++) prcopt.rb[j]=atof(argv[++i]);
Expand Down
17 changes: 11 additions & 6 deletions app/consapp/rtkrcv/rtkrcv.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ static const char *usage[]={
"usage: rtkrcv [-s][-p port][-d dev][-o file][-w pwd][-r level][-t level][-sta sta]",
"options",
" -s start RTK server on program startup",
" -nc start RTK server on program startup with no console",
" -p port port number for telnet console",
" -m port port number for monitor stream",
" -d dev terminal device for console",
Expand Down Expand Up @@ -420,8 +421,10 @@ static int startsvr(vt_t *vt)
else cmds_periodic[i]=s2[i];
}
/* confirm overwrite */
for (i=3;i<8;i++) {
if (strtype[i]==STR_FILE&&!confwrite(vt,strpath[i])) return 0;
if (vt!=NULL) {
for (i=3;i<8;i++) {
if (strtype[i]==STR_FILE&&!confwrite(vt,strpath[i])) return 0;
}
}
if (prcopt.refpos==4) { /* rtcm */
for (i=0;i<3;i++) prcopt.rb[i]=0.0;
Expand Down Expand Up @@ -1362,7 +1365,7 @@ static void *con_thread(void *arg)
}

/* auto start if option set */
if (start) {
if (start&1) { /* start with console */
cmd_start(args,narg,con->vt);
start=0;
}
Expand Down Expand Up @@ -1633,7 +1636,8 @@ int main(int argc, char **argv)
char *dev="",file[MAXSTR]="";

for (i=1;i<argc;i++) {
if (!strcmp(argv[i],"-s")) start=1;
if (!strcmp(argv[i],"-s")) start|=1; /* console */
else if (!strcmp(argv[i],"-nc")) start|=2; /* no console */
else if (!strcmp(argv[i],"-p")&&i+1<argc) port=atoi(argv[++i]);
else if (!strcmp(argv[i],"-m")&&i+1<argc) moniport=atoi(argv[++i]);
else if (!strcmp(argv[i],"-d")&&i+1<argc) dev=argv[++i];
Expand Down Expand Up @@ -1681,8 +1685,9 @@ int main(int argc, char **argv)
traceclose();
return -1;
}
}
else {
} else if (start&2) { /* start without console */
startsvr(NULL);
} else {
/* open device for local console */
if (!(con[0]=con_open(0,dev))) {
fprintf(stderr,"console open error dev=%s\n",dev);
Expand Down
5 changes: 5 additions & 0 deletions app/winapp/rtkplot/plotmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ __fastcall TPlot::TPlot(TComponent* Owner) : TForm(Owner)
SolStat[i]=solstat0;
SolIndex[i]=0;
}

obs0.data=NULL; obs0.n =obs0.nmax =0;
nav0.eph =NULL; nav0.n =nav0.nmax =0;
nav0.geph=NULL; nav0.ng=nav0.ngmax=0;
nav0.seph=NULL; nav0.ns=nav0.nsmax=0;
ObsIndex=0;
Obs=obs0;
Nav=nav0;
Expand Down
2 changes: 1 addition & 1 deletion app/winapp/rtkpost/postmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ int __fastcall TMainForm::GetOption(prcopt_t &prcopt, solopt_t &solopt,
solopt.sstat =DebugStatus;
solopt.trace =DebugTrace;
strcpy(solopt.sep,FieldSep!=""?FieldSep.c_str():" ");
sprintf(solopt.prog,"%s ver.%s %s",PRGNAME,VER_RTKLIB,PATCH_LEVEL);
sprintf(solopt.prog,"%s %s %s",PRGNAME,VER_RTKLIB,PATCH_LEVEL);

// file options
strcpy(filopt.satantp,SatPcvFile.c_str());
Expand Down
11 changes: 5 additions & 6 deletions app/winapp/rtkpost/postopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,11 @@ void __fastcall TOptDialog::SetOpt(void)
MainForm->GainHoldAmb =str2dbl(GainHoldAmb->Text);
MainForm->SlipThres =str2dbl(SlipThres ->Text);
MainForm->DopThres =str2dbl(DopThres ->Text);
//MainForm->ARIter =ARIter ->Text.ToInt();
MainForm->NumIter =NumIter ->Text.ToInt();
MainForm->MinFixSats =MinFixSats ->Text.ToInt();
MainForm->MinHoldSats =MinHoldSats ->Text.ToInt();
MainForm->MinDropSats =MinDropSats ->Text.ToInt();
MainForm->ARFilter =ARFilter ->ItemIndex;
MainForm->ARFilter =ARFilter ->ItemIndex;
MainForm->MaxPosVarAR =str2dbl(MaxPosVarAR->Text);
MainForm->BaseLine[0] =str2dbl(BaselineLen->Text);
MainForm->BaseLine[1] =str2dbl(BaselineSig->Text);
Expand Down Expand Up @@ -849,7 +848,7 @@ int ppp=PosMode->ItemIndex>=PMODE_PPP_KINEMA;
prcopt.mindropsats=str2dbl(MinDropSats->Text);
prcopt.arfilter =ARFilter->ItemIndex;
prcopt.niter =str2dbl(NumIter ->Text);
if (prcopt.mode==PMODE_MOVEB&&BaselineConst->Checked) {
if (BaselineConst->Checked) {
prcopt.baseline[0]=str2dbl(BaselineLen->Text);
prcopt.baseline[1]=str2dbl(BaselineSig->Text);
}
Expand Down Expand Up @@ -970,9 +969,9 @@ void __fastcall TOptDialog::UpdateEnable(void)
MinDropSats ->Enabled=rel;
MaxPosVarAR ->Enabled=ar&&!ppp;
ARFilter ->Enabled=ar;
BaselineConst ->Enabled=PosMode->ItemIndex==PMODE_MOVEB;
BaselineLen ->Enabled=BaselineConst->Checked&&PosMode->ItemIndex==PMODE_MOVEB;
BaselineSig ->Enabled=BaselineConst->Checked&&PosMode->ItemIndex==PMODE_MOVEB;
BaselineConst ->Enabled=rel;
BaselineLen ->Enabled=BaselineConst->Checked;
BaselineSig ->Enabled=BaselineConst->Checked;

OutputHead ->Enabled=SolFormat->ItemIndex<3;
OutputOpt ->Enabled=SolFormat->ItemIndex<3;
Expand Down
4 changes: 2 additions & 2 deletions app/winapp/rtkpost/rtkpost.cbproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<ILINK_LinkwithRegEx>false</ILINK_LinkwithRegEx>
<ILINK_LinkwithIntebaseTogo>false</ILINK_LinkwithIntebaseTogo>
<SanitizedProjectName>rtkpost</SanitizedProjectName>
<IncludePath>..\..\..\src\;..\appcmn\;..\..\src\;$(IncludePath)</IncludePath>
<IncludePath>..\..\..\src\;..\appcmn\;$(IncludePath)</IncludePath>
<ILINK_LibraryPath>..\..\..\src\;..\appcmn\;..\..\..\lib\openblas;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<BCC_waus>false</BCC_waus>
<BCC_weff>false</BCC_weff>
Expand Down Expand Up @@ -147,7 +147,7 @@
<BT_BuildType>Debug</BT_BuildType>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<BCC_Defines>_Debug;$(BCC_Defines);$(BCC_Defines)</BCC_Defines>
<BCC_Defines>NDEBUG;$(BCC_Defines);$(BCC_Defines)</BCC_Defines>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<LinkPackageStatics>rtl.lib;vcl.lib;vclx.lib</LinkPackageStatics>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
Expand Down
8 changes: 5 additions & 3 deletions src/postpos.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,17 +490,19 @@ static void procpos(FILE *fp, FILE *fptm, const prcopt_t *popt, const solopt_t *
free(obs_ptr); /* moved from stack to heap to kill a stack overflow warning */
}
/* validation of combined solutions ------------------------------------------*/
static int valcomb(const sol_t *solf, const sol_t *solb)
static int valcomb(const sol_t *solf, const sol_t *solb, double *rbf,
double *rbb, const prcopt_t *popt)
{
double dr[3],var[3];
int i;
char tstr[32];

trace(3,"valcomb :\n");
trace(4,"valcomb :\n");

/* compare forward and backward solution */
for (i=0;i<3;i++) {
dr[i]=solf->rr[i]-solb->rr[i];
if (popt->mode==PMODE_MOVEB) dr[i]-=(rbf[i]-rbb[i]);
var[i]=(double)solf->qr[i] + (double)solb->qr[i];
}
for (i=0;i<3;i++) {
Expand Down Expand Up @@ -553,7 +555,7 @@ static void combres(FILE *fp, FILE *fptm, const prcopt_t *popt, const solopt_t *
sols.stat==SOLQ_FIX) {

/* degrade fix to float if validation failed */
if (!valcomb(solf+i,solb+j)) sols.stat=SOLQ_FLOAT;
if (!valcomb(solf+i,solb+j,rbf+i*3,rbb+j*3,popt)) sols.stat=SOLQ_FLOAT;
}
for (k=0;k<3;k++) {
Qf[k+k*3]=solf[i].qr[k];
Expand Down
2 changes: 1 addition & 1 deletion src/preceph.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static int readsp3h(FILE *fp, gtime_t *time, char *type, int *sats,
}
}
else if (i==2*nl+2) {/* %c */
strncpy(tsys,buff+9,3); tsys[3]='\0';
memcpy(tsys,buff+9,3); tsys[3]='\0';
}
else if (i==2*nl+4) {/* %f */
bfact[0]=str2num(buff, 3,10);
Expand Down
4 changes: 2 additions & 2 deletions src/rinex.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ static int readrnxh(FILE *fp, double *ver, char *type, int *sys, int *tsys,

trace(3,"readrnxh:\n");

*ver=2.10; *type=' '; *sys=SYS_GPS;
*ver=2.10; *type=' '; *sys=SYS_GPS; *tsys=TSYS_GPS;

while (fgets(buff,MAXRNXLEN,fp)) {

Expand Down Expand Up @@ -1521,7 +1521,7 @@ static int readrnxclk(FILE *fp, const char *opt, int index, nav_t *nav)
trace(2,"rinex clk invalid epoch: %34.34s\n",buff);
continue;
}
strncpy(satid,buff+3,4);
memcpy(satid,buff+3,4);

/* only read AS (satellite clock) record */
if (strncmp(buff,"AS",2)||!(sat=satid2no(satid))) continue;
Expand Down
5 changes: 1 addition & 4 deletions src/rtklib.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ extern "C" {
#define TROPOPT_SBAS 2 /* troposphere option: SBAS model */
#define TROPOPT_EST 3 /* troposphere option: ZTD estimation */
#define TROPOPT_ESTG 4 /* troposphere option: ZTD+grad estimation */
#define TROPOPT_ZTD 5 /* troposphere option: ZTD correction */

#define EPHOPT_BRDC 0 /* ephemeris option: broadcast ephemeris */
#define EPHOPT_PREC 1 /* ephemeris option: precise ephemeris */
Expand All @@ -420,8 +419,6 @@ extern "C" {
#define ARMODE_CONT 1 /* AR mode: continuous */
#define ARMODE_INST 2 /* AR mode: instantaneous */
#define ARMODE_FIXHOLD 3 /* AR mode: fix and hold */
#define ARMODE_WLNL 4 /* AR mode: wide lane/narrow lane */
#define ARMODE_TCAR 5 /* AR mode: triple carrier ar */

#define GLO_ARMODE_OFF 0 /* GLO AR mode: off */
#define GLO_ARMODE_ON 1 /* GLO AR mode: on */
Expand Down Expand Up @@ -1140,7 +1137,7 @@ typedef struct { /* satellite status type */
uint8_t vsat[NFREQ]; /* valid satellite flag */
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:fix,2:float,3:hold) */
uint8_t fix [NFREQ]; /* ambiguity fix flag (1:float,2:fix,3:hold) */
uint8_t slip[NFREQ]; /* cycle-slip flag */
uint8_t half[NFREQ]; /* half-cycle valid flag */
int lock [NFREQ]; /* lock counter of phase */
Expand Down
Loading

0 comments on commit 4b519f3

Please sign in to comment.