Skip to content

Commit

Permalink
rtklib 2.4.2 p3
Browse files Browse the repository at this point in the history
  • Loading branch information
tomojitakasu committed Jun 2, 2013
1 parent b416a94 commit 8f5ad10
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 27 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.o
*.obs
*.ini
*.local
Release
Release_Build
Debug_Build
__history
7 changes: 5 additions & 2 deletions app/convbin/convbin.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* support compass
* 2012/11/19 1.6 fix bug on setting code mask in rinex options
* 2013/02/18 1.7 support binex
* 2013/05/19 1.8 support auto format for file path with wild-card
*-----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -255,7 +256,7 @@ static int cmdopts(int argc, char **argv, rnxopt_t *opt, char **ifile,
double eps[]={1980,1,1,0,0,0},epe[]={2037,12,31,0,0,0};
double epr[]={2010,1,1,0,0,0};
int i,j,sat,nf=2,nc=2,format=-1;
char *p,*sys,*fmt="";
char *p,*sys,*fmt="",*paths[1],path[1024];

opt->rnxver =2.11;
opt->obstype=OBSTYPE_PR|OBSTYPE_CP;
Expand Down Expand Up @@ -400,7 +401,9 @@ static int cmdopts(int argc, char **argv, rnxopt_t *opt, char **ifile,
else if (!strcmp(fmt,"binex")) format=STRFMT_BINEX;
else if (!strcmp(fmt,"rinex")) format=STRFMT_RINEX;
}
else if ((p=strrchr(*ifile,'.'))) {
else {
paths[0]=path;
if (!expath(*ifile,paths,1)||!(p=strrchr(path,'.'))) return -1;
if (!strcmp(p,".rtcm2")) format=STRFMT_RTCM2;
else if (!strcmp(p,".rtcm3")) format=STRFMT_RTCM3;
else if (!strcmp(p,".gps" )) format=STRFMT_OEM4;
Expand Down
14 changes: 7 additions & 7 deletions app/rnx2rtkp/gcc/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ SRC = ../../../src
OPTS = -DTRACE -DENAGLO -DENAQZS -DENAGAL -DNFREQ=3

# for no lapack
#CFLAGS = -Wall -O3 -ansi -pedantic -I$(SRC) $(OPTS)
#LDLIBS = -lm -lrt
CFLAGS = -Wall -O3 -ansi -pedantic -I$(SRC) $(OPTS)
LDLIBS = -lm -lrt

CFLAGS = -Wall -O3 -ansi -pedantic -I$(SRC) -DLAPACK $(OPTS)
LDLIBS = -lm -lrt -llapack -lblas
#CFLAGS = -Wall -O3 -ansi -pedantic -I$(SRC) -DLAPACK $(OPTS)
#LDLIBS = -lm -lrt -llapack -lblas

# for gprof
#CFLAGS = -Wall -O3 -ansi -pedantic -I$(SRC) -DLAPACK $(OPTS) -pg
#LDLIBS = -lm -lrt -llapack -lblas -pg

# for mkl
#MKLDIR = /opt/intel
#CFLAGS = -O3 -ansi -pedantic -I$(SRC) $(OPTS) -DMKL -I$(MKLDIR)/include
#LDLIBS = -L$(MKLDIR)/lib/32 -lm -lmkl_core -lmkl_intel -lmkl_gnu_thread -liomp5 -lpthread
#MKLDIR = /opt/intel/mkl
#CFLAGS = -O3 -ansi -pedantic -I$(SRC) $(OPTS) -DMKL
#LDLIBS = -L$(MKLDIR)/lib/intel64 -lm -lrt -lmkl_core -lmkl_intel_lp64 -lmkl_gnu_thread -liomp5 -lpthread

all : rnx2rtkp
rnx2rtkp : rnx2rtkp.o rtkcmn.o rinex.o rtkpos.o postpos.o solution.o
Expand Down
1 change: 0 additions & 1 deletion app/rtkplot/plotmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,6 @@ void __fastcall TPlot::TimerTimer(TObject *Sender)
else return;

UpdateTime();
UpdatePlot();
}
// set center of x-axis -----------------------------------------------------
void __fastcall TPlot::SetCentX(double c)
Expand Down
3 changes: 2 additions & 1 deletion src/download.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*
* version : $Revision:$ $Date:$
* history : 2012/12/28 1.0 new
* 2013/06/02 1.1 replace S_IREAD by S_IRUSR
*-----------------------------------------------------------------------------*/
#include <errno.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -133,7 +134,7 @@ static int exist_file(const char *local)
#else
struct stat buff;
if (stat(local,&buff)) return 0;
return buff.st_mode&S_IREAD;
return buff.st_mode&S_IRUSR;
#endif
}
/* test file existance -------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion src/rcv/javad.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static int decode_eph(raw_t *raw, int sys)
eph.code =U1(p); /* navtype: 0:E1B(INAV),1:E5A(FNAV) */
/* 3:GIOVE E1B,4:GIOVE E5A */

/* gst week -> galileo week */
/* gst week -> gps week */
eph.week=week+1024;
eph.toe=gpst2time(eph.week,eph.toes);

Expand Down
25 changes: 14 additions & 11 deletions src/rcv/novatel.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
* 2012/11/19 1.12 fix bug on decodeing rangeb
* 2013/02/23 1.13 fix memory access violation problem on arm
* 2013/03/28 1.14 fix invalid phase if glonass wavelen unavailable
* 2013/06/02 1.15 fix bug on reading galephemrisb,galalmanacb,
* galclockb,galionob
* fix bug on decoding rawwaasframeb for qzss-saif
*-----------------------------------------------------------------------------*/
#include "rtklib.h"

Expand Down Expand Up @@ -500,7 +503,7 @@ static int decode_rawwaasframeb(raw_t *raw)
}
prn=U4(p+4);

if (MINPRNQZS_S<=prn&&prn<=MINPRNQZS_S) {
if (MINPRNQZS_S<=prn&&prn<=MAXPRNQZS_S) {
prn+=10; /* QZSS SAIF PRN -> QZSS PRN */
}
else if (prn<MINPRNSBS||MAXPRNSBS<prn) return 0;
Expand Down Expand Up @@ -694,7 +697,7 @@ static int decode_galephemerisb(raw_t *raw)

trace(3,"decode_galephemerisb: len=%d\n",raw->len);

if (raw->len<OEM4HLEN+224) {
if (raw->len<OEM4HLEN+220) {
trace(2,"oem4 galephemrisb length error: len=%d\n",raw->len);
return -1;
}
Expand Down Expand Up @@ -752,15 +755,15 @@ static int decode_galephemerisb(raw_t *raw)
trace(2,"oemv galephemeris satellite error: prn=%d\n",prn);
return -1;
}
tow=time2gst(raw->time,&week);
eph.week=week;
eph.toe=gst2time(eph.week,eph.toes);
tow=time2gpst(raw->time,&week);
eph.week=week; /* gps week */
eph.toe=gpst2time(eph.week,eph.toes);

/* for week-handover problem */
tt=timediff(eph.toe,raw->time);
if (tt<-302400.0) eph.week++;
else if (tt> 302400.0) eph.week--;
eph.toe=gst2time(eph.week,eph.toes);
eph.toe=gpst2time(eph.week,eph.toes);
eph.toc=adjweek(eph.toe,rcv_fnav?toc_fnav:toc_inav);
eph.ttr=adjweek(eph.toe,tow);

Expand All @@ -782,7 +785,7 @@ static int decode_galalmanacb(raw_t *raw)

trace(3,"decode_galalmanacb: len=%d\n",raw->len);

if (raw->len<OEM4HLEN+104) {
if (raw->len<OEM4HLEN+100) {
trace(2,"oem4 galephemrisb length error: len=%d\n",raw->len);
return -1;
}
Expand All @@ -793,7 +796,7 @@ static int decode_galalmanacb(raw_t *raw)
svh_e5a =U1(p)&3; p+=1;
svh_e5b =U1(p)&3; p+=1+1;
ioda =U4(p); p+=4;
alm.week=U4(p); p+=4;
alm.week=U4(p); p+=4; /* gst week */
alm.toas=U4(p); p+=4;
alm.e =R8(p); p+=8;
alm.OMGd=R8(p); p+=8;
Expand Down Expand Up @@ -824,7 +827,7 @@ static int decode_galclockb(raw_t *raw)

trace(3,"decode_galclockb: len=%d\n",raw->len);

if (raw->len<OEM4HLEN+68) {
if (raw->len<OEM4HLEN+64) {
trace(2,"oem4 galclockb length error: len=%d\n",raw->len);
return -1;
}
Expand Down Expand Up @@ -856,7 +859,7 @@ static int decode_galionob(raw_t *raw)

trace(3,"decode_galionob: len=%d\n",raw->len);

if (raw->len<OEM4HLEN+33) {
if (raw->len<OEM4HLEN+29) {
trace(2,"oem4 galionob length error: len=%d\n",raw->len);
return -1;
}
Expand Down Expand Up @@ -927,7 +930,7 @@ static int decode_galinavrawwordb(raw_t *raw)
}
type=getbitu(buff,0,6);
if (type==0&&getbitu(buff,6,2)==2) {
week=getbitu(buff, 96,12);
week=getbitu(buff, 96,12); /* gst week */
tow =getbitu(buff,108,20);
time=gst2time(week,tow);
}
Expand Down
6 changes: 5 additions & 1 deletion src/rcv/rcvlex.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
*
* version : $Revision:$ $Date:$
* history : 2011/05/27 1.0 new
* 2013/06/02 1.1 fix bug on unable compile
*-----------------------------------------------------------------------------*/
#include "rtklib.h"

#ifdef EXTLEX /* lex extention */

#define LEXFRMPREAMB 0x1ACFFC1Du /* lex message frame preamble */

#define LEXRSYNC1 0xAA /* lex receiver message sync code 1 */
Expand Down Expand Up @@ -239,7 +242,7 @@ static int decode_lexr(raw_t *raw)
if (raw->outtype) {
sprintf(raw->msgtype,"LEXR 0x%04X (%4d): stat=%08X week=%d tow=%10.3f",
type,raw->len,stat,week,tow/1000.0);

}
switch (type) {
case ID_LEXRAW: return decode_lexraw(raw);
case ID_LEXMSG: return decode_lexmsg(raw);
Expand Down Expand Up @@ -419,3 +422,4 @@ extern int gen_lexr(const char *msg, unsigned char *buff)
trace(5,"gen_lexr: buff=\n"); traceb(5,buff,len);
return len;
}
#endif /* EXTLEX */
7 changes: 7 additions & 0 deletions src/rtcm3.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* 2012/12/25 1.2 change compass msm id table
* 2013/01/31 1.3 change signal id by the latest draft (ref [13])
* 2013/02/23 1.4 change reference for rtcm 3 message (ref [14])
* 2013/05/19 1.5 gpst -> bdt of time-tag in beidou msm message
*-----------------------------------------------------------------------------*/
#include "rtklib.h"

Expand Down Expand Up @@ -1672,6 +1673,11 @@ static int decode_msm_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
tod =getbitu(rtcm->buff,i,27)*0.001; i+=27;
adjday_glot(rtcm,tod);
}
else if (sys==SYS_CMP) {
tow =getbitu(rtcm->buff,i,30)*0.001; i+=30;
tow+=14.0; /* BDT -> GPST */
adjweek(rtcm,tow);
}
else {
tow =getbitu(rtcm->buff,i,30)*0.001; i+=30;
adjweek(rtcm,tow);
Expand Down Expand Up @@ -1971,6 +1977,7 @@ static int decode_msm7(rtcm_t *rtcm, int sys)
/* save obs data in msm message */
save_msm_obs(rtcm,sys,&h,r,pr,cp,rr,rrf,cnr,lock,ex,half);

trace(2,"rtcm3 %d: sync=%d\n",type,sync);
rtcm->obsflag=!sync;
return sync?0:1;
}
Expand Down
5 changes: 5 additions & 0 deletions src/rtcm3e.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* 2012/12/28 1.3 fix bug on compass carrier wave length
* 2013/01/18 1.4 fix bug on ssr message generation
* 2013/05/11 1.5 change type of arg value of setbig()
* 2013/05/19 1.5 gpst -> bdt of time-tag in beidou msm message
*-----------------------------------------------------------------------------*/
#include "rtklib.h"

Expand Down Expand Up @@ -1598,6 +1599,10 @@ static int encode_msm_head(int type, rtcm_t *rtcm, int sys, int sync, int *nsat,
dow=(unsigned int)(tow/86400.0);
epoch=(dow<<27)+ROUND_U(fmod(tow,86400.0)*1E3);
}
else if (sys==SYS_CMP) {
/* beidou time (tow-ms) */
epoch=ROUND_U(time2gpst(gpst2bdt(rtcm->time),NULL)*1E3);
}
else {
/* gps, qzs and galileo time (tow-ms) */
epoch=ROUND_U(time2gpst(rtcm->time,NULL)*1E3);
Expand Down
9 changes: 8 additions & 1 deletion src/rtkcmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* -DWIN32 use WIN32 API
* -DNOCALLOC no use calloc for zero matrix
* -DIERS_MODEL use GMF instead of NMF
* -DDLL built for shared library
*
* references :
* [1] IS-GPS-200D, Navstar GPS Space Segment/Navigation User Interfaces,
Expand Down Expand Up @@ -90,6 +91,7 @@
* change api eci2ecef(),sunmoonpos()
* 2013/03/26 1.21 tickget() uses clock_gettime() for linux
* 2013/05/08 1.22 fix bug on nutation coefficients for ast_args()
* 2013/06/02 1.23 add #ifdef for undefined CLOCK_MONOTONIC_RAW
*-----------------------------------------------------------------------------*/
#define _POSIX_C_SOURCE 199309
#include <stdarg.h>
Expand Down Expand Up @@ -1509,6 +1511,7 @@ extern unsigned int tickget(void)
struct timespec tp={0};
struct timeval tv={0};

#ifdef CLOCK_MONOTONIC_RAW
/* linux kernel > 2.6.28 */
if (!clock_gettime(CLOCK_MONOTONIC_RAW,&tp)) {
return tp.tv_sec*1000u+tp.tv_nsec/1000000u;
Expand All @@ -1517,7 +1520,11 @@ extern unsigned int tickget(void)
gettimeofday(&tv,NULL);
return tv.tv_sec*1000u+tv.tv_usec/1000u;
}
#else
gettimeofday(&tv,NULL);
return tv.tv_sec*1000u+tv.tv_usec/1000u;
#endif
#endif /* WIN32 */
}
/* sleep ms --------------------------------------------------------------------
* sleep ms
Expand Down Expand Up @@ -3680,7 +3687,7 @@ extern void settspan(gtime_t ts, gtime_t te) {}
extern void settime(gtime_t time) {}
#endif

/* dummy functions for extentions --------------------------------------------*/
/* dummy functions for lex extentions ----------------------------------------*/
#ifndef EXTLEX
extern int input_lexr(raw_t *raw, unsigned char data) {return 0;}
extern int input_lexrf(raw_t *raw, FILE *fp) {return 0;}
Expand Down
2 changes: 2 additions & 0 deletions src/rtklib.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ extern "C" {
#else
#define MINPRNQZS 0
#define MAXPRNQZS 0
#define MINPRNQZS_S 0
#define MAXPRNQZS_S 0
#define NSATQZS 0
#define NSYSQZS 0
#endif
Expand Down
6 changes: 4 additions & 2 deletions src/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* 2012/12/25 1.9 compile option SVR_REUSEADDR added
* 2013/03/10 1.10 fix problem with ntrip mountpoint containing "/"
* 2013/04/15 1.11 fix bug on swapping files if swapmargin=0
* 2013/05/28 1.12 fix bug on playback of file with 64 bit size_t
*-----------------------------------------------------------------------------*/
#include <ctype.h>
#include "rtklib.h"
Expand Down Expand Up @@ -613,7 +614,8 @@ static int statefile(file_t *file)
/* read file -----------------------------------------------------------------*/
static int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
{
unsigned int nr=0,t,tick,fpos;
unsigned int nr=0,t,tick;
size_t fpos;

tracet(4,"readfile: fp=%d nmax=%d\n",file->fp,nmax);

Expand Down Expand Up @@ -648,7 +650,7 @@ static int readfile(file_t *file, unsigned char *buff, int nmax, char *msg)
nmax=(int)(fpos-file->fpos);

if (file->repmode||file->speed>0.0) {
fseek(file->fp_tag,-(long)sizeof(tick)*2,SEEK_CUR);
fseek(file->fp_tag,-(long)(sizeof(tick)+sizeof(fpos)),SEEK_CUR);
}
break;
}
Expand Down
Binary file added util/testlex/20130428_lex.jaxa
Binary file not shown.
Binary file added util/testlex/20130429_lex.jaxa
Binary file not shown.

0 comments on commit 8f5ad10

Please sign in to comment.