代码调用:

一、main函数:

如何调试?

1、调试一:使用配置文件进行调试

(1)设置命令参数:-k opts1.conf -o mypos.pos hksl3570.21o brdm3570.21p

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="",*p;prcopt.mode  =PMODE_KINEMA;prcopt.navsys=0;prcopt.refpos=1;prcopt.glomodear=1;solopt.timef=0;sprintf(solopt.prog ,"%s ver.%s %s",PROGNAME,VER_RTKLIB,PATCH_LEVEL);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],"-sys")&&i+1<argc) {for (p=argv[++i];*p;p++) {switch (*p) {case 'G': prcopt.navsys|=SYS_GPS;case 'R': prcopt.navsys|=SYS_GLO;case 'E': prcopt.navsys|=SYS_GAL;case 'J': prcopt.navsys|=SYS_QZS;case 'C': prcopt.navsys|=SYS_CMP;case 'I': prcopt.navsys|=SYS_IRN;}if (!(p=strchr(p,','))) break;}}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=prcopt.rovpos=0;for (j=0;j<3;j++) prcopt.rb[j]=atof(argv[++i]);matcpy(prcopt.ru,prcopt.rb,3,1);}else if (!strcmp(argv[i],"-l")&&i+3<argc) {prcopt.refpos=prcopt.rovpos=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);matcpy(prcopt.ru,prcopt.rb,3,1);}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 (!prcopt.navsys) {prcopt.navsys=SYS_GPS|SYS_GLO;}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;
}

2、调试二:

int main() {char* infile[] = { {"hksl3570.21o"},{"brdm3570.21p"} };char* ofile = { "myposbyVS.pos" };gtime_t ts = { 0 }, te = { 0 };double ti = 0.0;      //  processing interval(s) (0:all) 时间间隔double tu = 0.0;    //   processing unit time(s) (0:all)prcopt_t opt = prcopt_default;  //processing optionssolopt_t sopt = solopt_default; //solution optionsfilopt_t fopt = { 0 }; //file optionsint n = 2;  //number of input files//GPS单点定位参数设置opt.navsys = SYS_GPS;opt.mode = PMODE_SINGLE; // PMODE_SINGLE; // PMODE_MOVEB; // ; PMODE_FIXED           opt.nf = 2;             /* number of frequencies (1:L1,2:L1+L2,3:L1+L2+L5) */opt.elmin = 10 * D2R;opt.ionoopt = IONOOPT_IFLC;       /* ionosphere option (IONOOPT_???) */opt.tropopt = TROPOPT_EST;       /* troposphere option (TROPOPT_???) */opt.sateph = EPHOPT_BRDC;//求解选项定义sopt.posf = SOLF_XYZ; // SOLF_XYZ; //  SOLF_ENU;sopt.times = TIMES_GPST; /* time system: gps time */sopt.timef = 1; /* time format (0:sssss.s,1:yyyy/mm/dd hh:mm:ss.s) */sopt.timeu = 3; /* time digits under decimal point */sopt.degf = 0; /* latitude/longitude format (0:ddd.ddd,1:ddd mm ss) */sopt.outhead = 1;        /* output header (0:no,1:yes) */sopt.outopt = 1;         /* output processing options (0:no,1:yes) */sopt.outvel = 1;         /* output velocity options (0:no,1:yes) */sopt.datum = 0;          /* datum (0:WGS84,1:Tokyo) */sopt.height = 0;         /* height (0:ellipsoidal,1:geodetic) */sopt.geoid = 0;          /* geoid model (0:EGM96,1:JGD2000) */sopt.solstatic = 0;      /* solution of static mode (0:all,1:single) */sopt.sstat = 1;          /* solution statistics level (0:off,1:states,2:residuals) */sopt.trace = 3;          /* debug trace level (0:off,1-5:debug) */

函数作用?

1、定义配置参数:

prcopt_t:

typedef struct {        /* processing options type */int mode;           /* positioning mode (PMODE_???) */int soltype;        /* solution type (0:forward,1:backward,2:combined) */int nf;             /* number of frequencies (1:L1,2:L1+L2,3:L1+L2+L5) */int navsys;         /* navigation system */double elmin;       /* elevation mask angle (rad) */snrmask_t snrmask;  /* SNR mask */int sateph;         /* satellite ephemeris/clock (EPHOPT_???) */int modear;         /* AR mode (0:off,1:continuous,2:instantaneous,3:fix and hold,4:ppp-ar) */int glomodear;      /* GLONASS AR mode (0:off,1:on,2:auto cal,3:ext cal) */int bdsmodear;      /* BeiDou AR mode (0:off,1:on) */int maxout;         /* obs outage count to reset bias */int minlock;        /* min lock count to fix ambiguity */int minfix;         /* min fix count to hold ambiguity */int armaxiter;      /* max iteration to resolve ambiguity */int ionoopt;        /* ionosphere option (IONOOPT_???) */int tropopt;        /* troposphere option (TROPOPT_???) */int dynamics;       /* dynamics model (0:none,1:velociy,2:accel) */int tidecorr;       /* earth tide correction (0:off,1:solid,2:solid+otl+pole) */int niter;          /* number of filter iteration */int codesmooth;     /* code smoothing window size (0:none) */int intpref;        /* interpolate reference obs (for post mission) */int sbascorr;       /* SBAS correction options */int sbassatsel;     /* SBAS satellite selection (0:all) */int rovpos;         /* rover position for fixed mode */int refpos;         /* base position for relative mode *//* (0:pos in prcopt,  1:average of single pos, *//*  2:read from file, 3:rinex header, 4:rtcm pos) */double eratio[NFREQ]; /* code/phase error ratio */double err[5];      /* measurement error factor *//* [0]:reserved *//* [1-3]:error factor a/b/c of phase (m) *//* [4]:doppler frequency (hz) */double std[3];      /* initial-state std [0]bias,[1]iono [2]trop */double prn[6];      /* process-noise std [0]bias,[1]iono [2]trop [3]acch [4]accv [5] pos */double sclkstab;    /* satellite clock stability (sec/sec) */double thresar[8];  /* AR validation threshold */double elmaskar;    /* elevation mask of AR for rising satellite (deg) */double elmaskhold;  /* elevation mask to hold ambiguity (deg) */double thresslip;   /* slip threshold of geometry-free phase (m) */double maxtdiff;    /* max difference of time (sec) */double maxinno;     /* reject threshold of innovation (m) */double maxgdop;     /* reject threshold of gdop */double baseline[2]; /* baseline length constraint {const,sigma} (m) */double ru[3];       /* rover position for fixed mode {x,y,z} (ecef) (m) */double rb[3];       /* base position for relative mode {x,y,z} (ecef) (m) */char anttype[2][MAXANT]; /* antenna types {rover,base} */double antdel[2][3]; /* antenna delta {{rov_e,rov_n,rov_u},{ref_e,ref_n,ref_u}} */pcv_t pcvr[2];      /* receiver antenna parameters {rov,base} */uint8_t exsats[MAXSAT]; /* excluded satellites (1:excluded,2:included) */int  maxaveep;      /* max averaging epoches */int  initrst;       /* initialize by restart */int  outsingle;     /* output single by dgps/float/fix/ppp outage */char rnxopt[2][256]; /* rinex options {rover,base} */int  posopt[6];     /* positioning options */int  syncsol;       /* solution sync mode (0:off,1:on) */double odisp[2][6*11]; /* ocean tide loading parameters {rov,base} */int  freqopt;       /* disable L2-AR */char pppopt[256];   /* ppp option */
} prcopt_t;
/*默认值*/
const prcopt_t prcopt_default={ /* defaults processing options */PMODE_SINGLE,0,2,SYS_GPS,   /* mode,soltype,nf,navsys */15.0*D2R,{{0,0}},           /* elmin,snrmask */0,1,1,1,                    /* sateph,modear,glomodear,bdsmodear */5,0,10,1,                   /* maxout,minlock,minfix,armaxiter */0,0,0,0,                    /* estion,esttrop,dynamics,tidecorr */1,0,0,0,0,                  /* niter,codesmooth,intpref,sbascorr,sbassatsel */0,0,                        /* rovpos,refpos */{100.0,100.0},              /* eratio[] */{100.0,0.003,0.003,0.0,1.0}, /* err[] */{30.0,0.03,0.3},            /* std[] */{1E-4,1E-3,1E-4,1E-1,1E-2,0.0}, /* prn[] */5E-12,                      /* sclkstab */{3.0,0.9999,0.25,0.1,0.05}, /* thresar */0.0,0.0,0.05,               /* elmaskar,almaskhold,thresslip */30.0,30.0,30.0,             /* maxtdif,maxinno,maxgdop */{0},{0},{0},                /* baseline,ru,rb */{"",""},                    /* anttype */{{0}},{{0}},{0}             /* antdel,pcv,exsats */
};
/*navsys*/
#define SYS_NONE    0x00                /* navigation system: none */
#define SYS_GPS     0x01                /* navigation system: GPS */
#define SYS_SBS     0x02                /* navigation system: SBAS */
#define SYS_GLO     0x04                /* navigation system: GLONASS */
#define SYS_GAL     0x08                /* navigation system: Galileo */
#define SYS_QZS     0x10                /* navigation system: QZSS */
#define SYS_CMP     0x20                /* navigation system: BeiDou */
#define SYS_IRN     0x40                /* navigation system: IRNS */
#define SYS_LEO     0x80                /* navigation system: LEO */
#define SYS_ALL     0xFF                /* navigation system: all */#define PMODE_SINGLE 0                  /* positioning mode: single */
#define PMODE_DGPS   1                  /* positioning mode: DGPS/DGNSS */
#define PMODE_KINEMA 2                  /* positioning mode: kinematic */
#define PMODE_STATIC 3                  /* positioning mode: static */
#define PMODE_MOVEB  4                  /* positioning mode: moving-base */
#define PMODE_FIXED  5                  /* positioning mode: fixed */
#define PMODE_PPP_KINEMA 6              /* positioning mode: PPP-kinemaric */
#define PMODE_PPP_STATIC 7              /* positioning mode: PPP-static */
#define PMODE_PPP_FIXED 8               /* positioning mode: PPP-fixed */#define EPHOPT_BRDC 0                   /* ephemeris option: broadcast ephemeris */
#define EPHOPT_PREC 1                   /* ephemeris option: precise ephemeris */
#define EPHOPT_SBAS 2                   /* ephemeris option: broadcast + SBAS */
#define EPHOPT_SSRAPC 3                 /* ephemeris option: broadcast + SSR_APC */
#define EPHOPT_SSRCOM 4                 /* ephemeris option: broadcast + SSR_COM */#define IONOOPT_OFF 0                   /* ionosphere option: correction off */
#define IONOOPT_BRDC 1                  /* ionosphere option: broadcast model */
#define IONOOPT_SBAS 2                  /* ionosphere option: SBAS model */
#define IONOOPT_IFLC 3                  /* ionosphere option: L1/L2 iono-free LC */
#define IONOOPT_EST 4                   /* ionosphere option: estimation */
#define IONOOPT_TEC 5                   /* ionosphere option: IONEX TEC model */
#define IONOOPT_QZS 6                   /* ionosphere option: QZSS broadcast model */
#define IONOOPT_STEC 8                  /* ionosphere option: SLANT TEC model */#define TROPOPT_OFF 0                   /* troposphere option: correction off */
#define TROPOPT_SAAS 1                  /* troposphere option: Saastamoinen model */
#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 */

  

solopt_t:

typedef struct {        /* solution options type */int posf;           /* solution format (SOLF_???) */int times;          /* time system (TIMES_???) */int timef;          /* time format (0:sssss.s,1:yyyy/mm/dd hh:mm:ss.s) */int timeu;          /* time digits under decimal point */int degf;           /* latitude/longitude format (0:ddd.ddd,1:ddd mm ss) */int outhead;        /* output header (0:no,1:yes) */int outopt;         /* output processing options (0:no,1:yes) */int outvel;         /* output velocity options (0:no,1:yes) */int datum;          /* datum (0:WGS84,1:Tokyo) */int height;         /* height (0:ellipsoidal,1:geodetic) */int geoid;          /* geoid model (0:EGM96,1:JGD2000) */int solstatic;      /* solution of static mode (0:all,1:single) */int sstat;          /* solution statistics level (0:off,1:states,2:residuals) */int trace;          /* debug trace level (0:off,1-5:debug) */double nmeaintv[2]; /* nmea output interval (s) (<0:no,0:all) *//* nmeaintv[0]:gprmc,gpgga,nmeaintv[1]:gpgsv */char sep[64];       /* field separator */char prog[64];      /* program name */double maxsolstd;   /* max std-dev for solution output (m) (0:all) */
} solopt_t;const solopt_t solopt_default={ /* defaults solution output options */SOLF_LLH,TIMES_GPST,1,3,    /* posf,times,timef,timeu */0,1,0,0,0,0,0,              /* degf,outhead,outopt,outvel,datum,height,geoid */0,0,0,                      /* solstatic,sstat,trace */{0.0,0.0},                  /* nmeaintv */" ",""                      /* separator/program name */
};#define SOLF_LLH    0                   /* solution format: lat/lon/height */
#define SOLF_XYZ    1                   /* solution format: x/y/z-ecef */
#define SOLF_ENU    2                   /* solution format: e/n/u-baseline */
#define SOLF_NMEA   3                   /* solution format: NMEA-183 */
#define SOLF_STAT   4                   /* solution format: solution status */
#define SOLF_GSIF   5                   /* solution format: GSI F1/F2 */#define TIMES_GPST  0                   /* time system: gps time */
#define TIMES_UTC   1                   /* time system: utc */
#define TIMES_JST   2                   /* time system: jst */

filopt_t:

typedef struct {        /* file options type */char satantp[MAXSTRPATH]; /* satellite antenna parameters file */char rcvantp[MAXSTRPATH]; /* receiver antenna parameters file */char stapos [MAXSTRPATH]; /* station positions file */char geoid  [MAXSTRPATH]; /* external geoid data file */char iono   [MAXSTRPATH]; /* ionosphere data file */char dcb    [MAXSTRPATH]; /* dcb data file */char eop    [MAXSTRPATH]; /* eop data file */char blq    [MAXSTRPATH]; /* ocean tide loading blq file */char tempdir[MAXSTRPATH]; /* ftp/http temporaly directory */char geexe  [MAXSTRPATH]; /* google earth exec file */char solstat[MAXSTRPATH]; /* solution statistics file */char trace  [MAXSTRPATH]; /* debug trace file */
} filopt_t;

2、定义输入文件路径infile,输出文件路径outfile

输入文件包括,如果是相对定位,则需要输入流动站数据和基准站数据;如果是单点定位,则需要输入观测值文件和广播星历或者精密星历和精密钟差文件。

3、输入文件的个数n

RTKLIB进行伪距单点定位1——main函数相关推荐

  1. RTKLIB中伪距单点定位的函数(一)

    procpo 目录 procpos rtkinit:rtkinit(&rtk,popt); inputobs:nobs=inputobs(obs,rtk.sol.stat,popt) sats ...

  2. RTKLIB中利用Kalman滤波进行伪距单点定位

    之前发布的博客利用Kalman滤波进行伪距单点定位取得了很好的精度提升,有小伙伴也想知道具体如何修改的,现在将我的代码放出,供大家参考. 源码中的流程可能比较难懂,因为每个人写代码的思路和风格不一样, ...

  3. 【Python】伪距单点定位

    一.算法原理 1.关于伪距单点定位 GPS伪距单点定位的原理比较简单,主要是利用空间距离的后方交会,用一台接收机同时接受四颗卫星的位置坐标和卫星与接收机的距离,运用后方交会原理解算出接收机的三维坐标. ...

  4. 用c++设计i一个伪距单点定位程序

    在设计伪距单点定位程序时,需要考虑以下几个步骤: 获取伪距信息:需要使用GPS接收机或其他设备来接收卫星的信号,并计算出相对于接收机的伪距. 获取卫星位置信息:需要使用卫星星历数据来计算出每颗卫星在接 ...

  5. 【测绘程序设计】C#伪距单点定位

    文章目录 一.题目解读 二.界面设计 三.矩阵计算实现 1.矩阵定义Matrix 2.矩阵构造Matrix() 3.单位矩阵MatrixE() 4.加减乘操作符重载+-* 5.矩阵转置transpos ...

  6. GNSS伪距单点定位、DOP值为什么和卫星分布有关

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言 一.伪距单点定位原理 1.距离交汇 2.伪距观测方程建立 3.观测方程线性化(适用于编程理解) 3.最小二乘解算误差方 ...

  7. Java实现伪距单点定位

    最近上课有点忙,所以没来得急更新最后的一节,上几期文章已经给出了读取观测值文件和广播星历文件以及计算GPS中圆轨道卫星的空间坐标(不知道的可以看之前的文章,有详细的代码),所以本期最后给出根据观测历元 ...

  8. 北斗导航 | 北斗伪距定位、测速与授时——PNT:最小二乘法、加权最小二乘:伪距单点定位

    ================================================ 博主github:https://github.com/MichaelBeechan 博主CSDN:h ...

  9. INS/伪距组合导航(1)

    前言 在以伪距.伪距率为观测量的GNSS/INS紧组合系统中,通常要估计每个卫星系统的接收机钟差和接收机钟差漂移,这不仅会增加滤波的估计参数,而且由于接收机的钟一般为石英钟,会导致钟差数值很大,变化快 ...

  10. INS/伪距组合导航(2)

    前言 伪距定位中,主要误差源有卫星轨道误差.对流层误差.电离层误差.接收机钟差.卫星钟差.硬件延迟误差.码随机误差. 不同系统的卫星轨道误差不同,参考论文对滤波噪声进行调整: 对流层误差和电离层误差能 ...

最新文章

  1. centos 关机命令_Docker 常用命令速查手册
  2. oracle隐藏游标,Oracle 存储过程隐藏游标
  3. Java工作笔记-Spring Boot上传图片并显示
  4. ArcGIS 10.2数字化线状要素时自己主动拼接成一条线
  5. python互相转换组合_Python中基本类型的连接组合和互相转换13种方式
  6. golang | 空结构体struct{}的用法
  7. JavaScript 一维数组、二维数组(某个属性)去重方法
  8. 工程思想——继电器特性抖动处理
  9. [redis] 介绍安装
  10. 1.ZooKeeper Java客户端的基本使用「第三章 ZooKeeper Java客户端」「架构之路ZooKeeper理论和实战」
  11. c语言程序输出三角,C语言小程序之输出“上三角”
  12. Hanlp词性对照表 中文词性对照表 英文词性对照表_CodingPark编程公园
  13. win32 绘制超酷界面(二)
  14. 芒种节气的含义,都藏在这些芒种节气设计海报里啦!
  15. 深度学习环境配置避坑-CUDA11.0+DGL1.8
  16. 用计算机知道函数值求度数,怎么计算出余弦的度数
  17. python利用range生成包含1-10的列表_Python列表干货:创建数字列表:range()函数用法...
  18. EPLAN P8部件库 EPLAN P8部件库,包含低压电气 控制系统设计常用品牌型号,全部部件均为本人整理自己创建,可大大提高电气控制行业同仁的工作效率!
  19. 程序员--经典10道脑力题
  20. 利息积数的计算方法及应用

热门文章

  1. Spring bean配置单例或多例模式
  2. 违反GPL协议赔偿50万,国内首例!
  3. CSP-M2 B - HRZ 学英语
  4. 用MATLAB对语音进行基频搬移,语音信号变声处理系.doc
  5. 关于pend post 与 accept
  6. 4.1-4.30推荐文章汇总
  7. 财帮子(caibangzi.com)网站架构
  8. 游戏项目开发的简单流程
  9. 数据处理的神来之笔 解决缓存击穿的终极利器
  10. Flutter CircularProgressIndicator圆形进度指示器