/* set system options ---------------------------------------------------------- * set system options * args : prcopt_t *prcopt I processing options (NULL: default) * solopt_t *solopt I solution options (NULL: default) * filopt_t *filopt I file options (NULL: default) * return : none * notes : to save system options, use saveopts() after calling the function *-----------------------------------------------------------------------------*/ extern void setsysopts(const prcopt_t *prcopt, const solopt_t *solopt, const filopt_t *filopt) { trace(3,"setsysopts:\n"); resetsysopts(); if (prcopt) prcopt_=*prcopt; if (solopt) solopt_=*solopt; if (filopt) filopt_=*filopt; sysopts2buff(); }
int loadrosopts(opt_t *opts); int start_rtkrcv(int argc, char **argv) { int i; for (i=1;i<argc;i++) { if (!strcmp(argv[i],"-m")&&i+1<argc) moniport=atoi(argv[++i]); else if (!strcmp(argv[i],"-r")&&i+1<argc) outstat=atoi(argv[++i]); else if (!strcmp(argv[i],"-t")&&i+1<argc) rcv_trace=atoi(argv[++i]); else fprintf(stderr,"Unknown option: %s\n",argv[i]); } if (rcv_trace>0) { traceopen(TRACEFILE); tracelevel(rcv_trace); } /* initialize rtk server and monitor port */ rtksvrinit(&svr); strinit(&moni); /* load options from ROS */ resetsysopts(); loadrosopts(rcvopts); loadrosopts(sysopts); getsysopts(&prcopt,solopt,&filopt); /* read navigation data */ if (!readnav(NAVIFILE,&svr.nav)) { fprintf(stderr,"no navigation data: %s\n",NAVIFILE); } if (outstat>0) { rtkopenstat(STATFILE,outstat); } /* open monitor port */ if (moniport>0&&!openmoni(moniport)) { fprintf(stderr,"monitor port open error: %d\n",moniport); return 0; } /* start rtk server */ if (!startsvr(&svr_vt)) return 0;
//--------------------------------------------------------------------------- void __fastcall TOptDialog::LoadOpt(AnsiString file) { int itype[]={STR_SERIAL,STR_TCPCLI,STR_TCPSVR,STR_NTRIPCLI,STR_FILE,STR_FTP,STR_HTTP}; int otype[]={STR_SERIAL,STR_TCPCLI,STR_TCPSVR,STR_NTRIPSVR,STR_FILE}; TEdit *editu[]={RovPos1,RovPos2,RovPos3}; TEdit *editr[]={RefPos1,RefPos2,RefPos3}; AnsiString s; char buff[1024]="",*p,id[32]; int sat; prcopt_t prcopt=prcopt_default; solopt_t solopt=solopt_default; filopt_t filopt={""}; resetsysopts(); if (!loadopts(file.c_str(),sysopts)|| !loadopts(file.c_str(),rcvopts)) return; getsysopts(&prcopt,&solopt,&filopt); for (int i=0;i<8;i++) { MainForm->StreamC[i]=strtype[i]!=STR_NONE; MainForm->Stream[i]=STR_NONE; for (int j=0;j<(i<3?7:5);j++) { if (strtype[i]!=(i<3?itype[j]:otype[j])) continue; MainForm->Stream[i]=j; break; } if (i<5) MainForm->Format[i]=strfmt[i]; if (strtype[i]==STR_SERIAL) { MainForm->Paths[i][0]=strpath[i]; } else if (strtype[i]==STR_FILE) { MainForm->Paths[i][2]=strpath[i]; } else if (strtype[i]<=STR_NTRIPCLI) { MainForm->Paths[i][1]=strpath[i]; } else if (strtype[i]<=STR_HTTP) { MainForm->Paths[i][3]=strpath[i]; } } MainForm->NmeaReq=nmeareq; MainForm->NmeaPos[0]=nmeapos[0]; MainForm->NmeaPos[1]=nmeapos[1]; SbasSatE ->Text =s.sprintf("%d",prcopt.sbassatsel); PosMode ->ItemIndex =prcopt.mode; Freq ->ItemIndex =prcopt.nf>NFREQ-1?NFREQ-1:prcopt.nf-1; Solution ->ItemIndex =prcopt.soltype; ElMask ->Text =s.sprintf("%.0f",prcopt.elmin*R2D); DynamicModel ->ItemIndex =prcopt.dynamics; TideCorr ->ItemIndex =prcopt.tidecorr; IonoOpt ->ItemIndex =prcopt.ionoopt; TropOpt ->ItemIndex =prcopt.tropopt; SatEphem ->ItemIndex =prcopt.sateph; ExSatsE ->Text =""; for (sat=1,p=buff;sat<=MAXSAT;sat++) { if (!prcopt.exsats[sat-1]) continue; satno2id(sat,id); p+=sprintf(p,"%s%s%s",p==buff?"":" ",prcopt.exsats[sat-1]==2?"+":"",id); } ExSatsE ->Text =buff; NavSys1 ->Checked =prcopt.navsys&SYS_GPS; NavSys2 ->Checked =prcopt.navsys&SYS_GLO; NavSys3 ->Checked =prcopt.navsys&SYS_GAL; NavSys4 ->Checked =prcopt.navsys&SYS_QZS; NavSys5 ->Checked =prcopt.navsys&SYS_SBS; NavSys6 ->Checked =prcopt.navsys&SYS_CMP; PosOpt1 ->Checked =prcopt.posopt[0]; PosOpt2 ->Checked =prcopt.posopt[1]; PosOpt3 ->Checked =prcopt.posopt[2]; PosOpt4 ->Checked =prcopt.posopt[3]; PosOpt5 ->Checked =prcopt.posopt[4]; AmbRes ->ItemIndex =prcopt.modear; GloAmbRes ->ItemIndex =prcopt.glomodear; ValidThresAR ->Text =s.sprintf("%.1f",prcopt.thresar[0]); OutCntResetAmb->Text =s.sprintf("%d" ,prcopt.maxout ); FixCntHoldAmb->Text =s.sprintf("%d" ,prcopt.minfix ); LockCntFixAmb->Text =s.sprintf("%d" ,prcopt.minlock ); ElMaskAR ->Text =s.sprintf("%.0f",prcopt.elmaskar*R2D); ElMaskHold ->Text =s.sprintf("%.0f",prcopt.elmaskhold*R2D); MaxAgeDiff ->Text =s.sprintf("%.1f",prcopt.maxtdiff ); RejectGdop ->Text =s.sprintf("%.1f",prcopt.maxgdop ); RejectThres ->Text =s.sprintf("%.1f",prcopt.maxinno ); SlipThres ->Text =s.sprintf("%.3f",prcopt.thresslip); NumIter ->Text =s.sprintf("%d", prcopt.niter ); SyncSol ->ItemIndex =prcopt.syncsol; BaselineLen ->Text =s.sprintf("%.3f",prcopt.baseline[0]); BaselineSig ->Text =s.sprintf("%.3f",prcopt.baseline[1]); BaselineConst->Checked =prcopt.baseline[0]>0.0; SolFormat ->ItemIndex =solopt.posf; TimeFormat ->ItemIndex =solopt.timef==0?0:solopt.times+1; TimeDecimal ->Text =s.sprintf("%d",solopt.timeu); LatLonFormat ->ItemIndex =solopt.degf; FieldSep ->Text =solopt.sep; OutputHead ->ItemIndex =solopt.outhead; OutputOpt ->ItemIndex =solopt.outopt; OutputDatum ->ItemIndex =solopt.datum; OutputHeight ->ItemIndex =solopt.height; OutputGeoid ->ItemIndex =solopt.geoid; NmeaIntv1 ->Text =s.sprintf("%.2g",solopt.nmeaintv[0]); NmeaIntv2 ->Text =s.sprintf("%.2g",solopt.nmeaintv[1]); DebugTrace ->ItemIndex =solopt.trace; DebugStatus ->ItemIndex =solopt.sstat; MeasErrR1 ->Text =s.sprintf("%.1f",prcopt.eratio[0]); MeasErrR2 ->Text =s.sprintf("%.3f",prcopt.eratio[1]); MeasErr2 ->Text =s.sprintf("%.3f",prcopt.err[1]); MeasErr3 ->Text =s.sprintf("%.3f",prcopt.err[2]); MeasErr4 ->Text =s.sprintf("%.3f",prcopt.err[3]); MeasErr5 ->Text =s.sprintf("%.3f",prcopt.err[4]); SatClkStab ->Text =s.sprintf("%.2E",prcopt.sclkstab); PrNoise1 ->Text =s.sprintf("%.2E",prcopt.prn[0]); PrNoise2 ->Text =s.sprintf("%.2E",prcopt.prn[1]); PrNoise3 ->Text =s.sprintf("%.2E",prcopt.prn[2]); PrNoise4 ->Text =s.sprintf("%.2E",prcopt.prn[3]); PrNoise5 ->Text =s.sprintf("%.2E",prcopt.prn[4]); RovAntPcv ->Checked =*prcopt.anttype[0]; RefAntPcv ->Checked =*prcopt.anttype[1]; RovAnt ->Text =prcopt.anttype[0]; RefAnt ->Text =prcopt.anttype[1]; RovAntE ->Text =s.sprintf("%.4f",prcopt.antdel[0][0]); RovAntN ->Text =s.sprintf("%.4f",prcopt.antdel[0][1]); RovAntU ->Text =s.sprintf("%.4f",prcopt.antdel[0][2]); RefAntE ->Text =s.sprintf("%.4f",prcopt.antdel[1][0]); RefAntN ->Text =s.sprintf("%.4f",prcopt.antdel[1][1]); RefAntU ->Text =s.sprintf("%.4f",prcopt.antdel[1][2]); RovPosTypeP ->ItemIndex =prcopt.rovpos==0?0:3; RefPosTypeP ->ItemIndex =prcopt.refpos==0?0:3; RovPosTypeF =RovPosTypeP->ItemIndex; RefPosTypeF =RefPosTypeP->ItemIndex; SetPos(RovPosTypeP->ItemIndex,editu,prcopt.ru); SetPos(RefPosTypeP->ItemIndex,editr,prcopt.rb); SatPcvFile ->Text =filopt.satantp; AntPcvFile ->Text =filopt.rcvantp; StaPosFile ->Text =filopt.stapos; GeoidDataFile->Text =filopt.geoid; DCBFile ->Text =filopt.dcb; LocalDir ->Text =filopt.tempdir; ReadAntList(); UpdateEnable(); }
/* rnx2rtkp main -------------------------------------------------------------*/ int main(int argc, char **argv) { prcopt_t prcopt=prcopt_default; solopt_t solopt=solopt_default; filopt_t filopt={""}; gtime_t ts={0},te={0}; double tint=0.0,es[]={2000,1,1,0,0,0},ee[]={2000,12,31,23,59,59},pos[3]; int i,j,n,ret; char *infile[MAXFILE],*outfile=""; prcopt.mode =PMODE_KINEMA; prcopt.navsys=SYS_GPS|SYS_GLO; prcopt.refpos=1; prcopt.glomodear=1; sprintf(solopt.prog ,"%s ver.%s",PROGNAME,VER_RTKLIB); sprintf(filopt.trace,"%s.trace",PROGNAME); /* load options from configuration file */ for (i=1;i<argc;i++) { if (!strcmp(argv[i],"-k")&&i+1<argc) { resetsysopts(); if (!loadopts(argv[++i],sysopts)) return -1; getsysopts(&prcopt,&solopt,&filopt); } } for (i=1,n=0;i<argc;i++) { if (!strcmp(argv[i],"-o")&&i+1<argc) outfile=argv[++i]; else if (!strcmp(argv[i],"-ts")&&i+2<argc) { sscanf(argv[++i],"%lf/%lf/%lf",es,es+1,es+2); sscanf(argv[++i],"%lf:%lf:%lf",es+3,es+4,es+5); ts=epoch2time(es); } else if (!strcmp(argv[i],"-te")&&i+2<argc) { sscanf(argv[++i],"%lf/%lf/%lf",ee,ee+1,ee+2); sscanf(argv[++i],"%lf:%lf:%lf",ee+3,ee+4,ee+5); te=epoch2time(ee); } else if (!strcmp(argv[i],"-ti")&&i+1<argc) tint=atof(argv[++i]); else if (!strcmp(argv[i],"-k")&&i+1<argc) {++i; continue;} else if (!strcmp(argv[i],"-p")&&i+1<argc) prcopt.mode=atoi(argv[++i]); else if (!strcmp(argv[i],"-f")&&i+1<argc) prcopt.nf=atoi(argv[++i]); else if (!strcmp(argv[i],"-m")&&i+1<argc) prcopt.elmin=atof(argv[++i])*D2R; else if (!strcmp(argv[i],"-v")&&i+1<argc) prcopt.thresar[0]=atof(argv[++i]); else if (!strcmp(argv[i],"-s")&&i+1<argc) strcpy(solopt.sep,argv[++i]); else if (!strcmp(argv[i],"-d")&&i+1<argc) solopt.timeu=atoi(argv[++i]); else if (!strcmp(argv[i],"-b")) prcopt.soltype=1; else if (!strcmp(argv[i],"-c")) prcopt.soltype=2; else if (!strcmp(argv[i],"-i")) prcopt.modear=2; else if (!strcmp(argv[i],"-h")) prcopt.modear=3; else if (!strcmp(argv[i],"-t")) solopt.timef=1; else if (!strcmp(argv[i],"-u")) solopt.times=TIMES_UTC; else if (!strcmp(argv[i],"-e")) solopt.posf=SOLF_XYZ; 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],"-r")&&i+3<argc) { prcopt.refpos=0; for (j=0;j<3;j++) prcopt.rb[j]=atof(argv[++i]); } else if (!strcmp(argv[i],"-l")&&i+3<argc) { prcopt.refpos=0; for (j=0;j<3;j++) pos[j]=atof(argv[++i]); for (j=0;j<2;j++) pos[j]*=D2R; pos2ecef(pos,prcopt.rb); } else if (!strcmp(argv[i],"-y")&&i+1<argc) solopt.sstat=atoi(argv[++i]); else if (!strcmp(argv[i],"-x")&&i+1<argc) solopt.trace=atoi(argv[++i]); else if (*argv[i]=='-') printhelp(); else if (n<MAXFILE) infile[n++]=argv[i]; } if (n<=0) { showmsg("error : no input file"); return -2; } ret=postpos(ts,te,tint,0.0,&prcopt,&solopt,&filopt,infile,n,outfile,"",""); if (!ret) fprintf(stderr,"%40s\r",""); return ret; }