下載的源碼程序包中,共有16個例子,這里記錄它們的調試及運行結果,尤其是哪些可用,哪些不可用,今后使用時用作參考。
總結:
(1)在 18 個示例程序中,example16 和 example17 編譯報錯,example7 和 example12 編譯正常但是運行時報錯(“已放棄(吐核)”),example3 運行正常但結果錯誤,其余程序可以正常運行。
(2)對庫文件 libgpstk.so 文件的依賴,使庫內函數的調試很麻煩:這是因為在安裝 GPSTK 時由編譯 cmake 和安裝命令 sudo make install 生成了libgpstk.so 文件,這就與源代碼切斷了聯系;后續對源代碼做的修改,需要再次執行 GPSTK 的編譯和安裝命令才能更新 libgpstk.so 尤其是安裝命令需要10-20分鍾,比較耗時。而且對 libgpstk.so 文件的調試也很麻煩,它不能方便地設置斷點, 不方便查看程序的跳轉和變量,令調試工作一度陷入困頓中。
(3)鑒於 example3.cpp 程序中關於 P1 & P2 只能識別出 P1 變量, 以及 Rinex 3.02 文件中不支持含有北斗衛星觀測文件的問題,我們最終放棄了對 GPSTK 源代碼的依賴,轉而自行開發相應的讀取程序,以避開其中的 bug。
各程序的運行示例詳列在此。
1. example1.cpp
$ ../example1 Hello world! The current civil time is 06/07/2017 08:28:57 UTC The current year is 2017 The current day of year is 158 The current second of day is 30537.5 The current full GPS week is 1952 The current short GPS week is 928 The current day of GPS week is 3 The current second of GPS week is 289738 The current Modified Julian Date is 57911.353443289 UTC
2. example2.cpp, OK。
自動生成新文件:bahr1620.04o.new
./example2
3. example3.cpp, 看似正常,其實有誤!
[She@she-centos7 examples]$ ./example3 Required argument is a RINEX obs file. [She@she-centos7 examples]$ ./example3 bahr1620.04o Name your PRN of interest (by number: 1 through 32): 3 Reading bahr1620.04o. ---------------------------------- REQUIRED ---------------------------------- Rinex Version 2.10, File type Observation, System G (GPS). Prgm: GFW - ROW, Run: 06/09/2004 23:59:50, By: NIMA Marker type: . Observer : NIMA, Agency: NATIONAL IMAGERY AND MAPPING AGENCY Rec#: 03215, Type: ASHTECH Z-XII3, Vers: 1Y07-1DY4 Antenna # : 11942, Type : ASH700936B_M SNOW Position (XYZ,m) : (3633909.1016, 4425275.5033, 2799861.2736). Antenna Delta (HEN,m) : (3.1220, 0.0000, 0.0000). GPS Observation types (9): Type #01 (L1C) L1 GPSC/A phase Type #02 (L2X) L2 GPSC2L+M phase Type #03 (C1C) L1 GPSC/A pseudorange Type #04 (C1P) L1 GPSP pseudorange Type #05 (C2W) L2 GPScodelessZ pseudorange Type #06 (D1C) L1 GPSC/A doppler Type #07 (D2X) L2 GPSC2L+M doppler Type #08 (S1C) L1 GPSC/A snr Type #09 (S2X) L2 GPSC2L+M snr Time of first obs 2004/06/10 00:00:00.000 UNK (This header is VALID) ---------------------------------- OPTIONAL ---------------------------------- Marker number : 24901M002 Signal Strenth Unit = Interval = 30.000 Wavelength factor L1: 1 L2: 1 Comments (1) : Data are thinned (not smoothed) 30s. observations -------------------------------- END OF HEADER -------------------------------- text 0:GC2P RinexObsID is not stored!. location 0:/home/She/Downloads/GPSTK/gpstk-2.5.src/dev/ext/lib/FileHandling/RINEX3/Rinex3ObsHeader.cpp:2163
實際上,該觀測文件的觀測變量包括 P1 和 P2 參量,但是該程序卻只能讀出 P1 的值,找不到 P2 的值,導致程序中斷退出。
[She@she-centos7 examples]$ cat bahr1620.04o | grep "# / TYPES OF OBSERV" 9 L1 L2 C1 P1 P2 D1 D2 S1 S2# / TYPES OF OBSERV
4. example4.cpp, OK。
[She@she-centos7 examples]$ ./example4 bahr1620.04o bahr1620.04n 3633917.14508 4425281.93387 2799868.07476 3633916.70007 4425281.95696 2799867.33565 3633916.53802 4425282.23082 2799867.57637 3633917.38703 4425282.2806 2799867.85073 3633917.09456 4425282.76769 2799868.04387 3633916.55241 4425282.22131 2799867.29408 3633917.55883 4425282.49571 2799867.32582 3633917.44541 4425281.83514 2799867.2195 3633917.31666 4425281.71065 2799867.09384 3633917.19143 4425281.94326 2799867.20896 ...
5. example5.cpp,OK。
[She@she-centos7 examples]$ ./example5 Required option -i | --datainput was not found. Required option -n | --navinput was not found. Usage: example5 [OPTION] ... Program to print the position solution in ECEF and longitude, latitude, height, based in C1 and given a RINEX observations file and a RINEX broadcast navigation file. The output is: Time(sec) X(m) Y(m) Z(m) Lon(deg) Lat(deg) Height(m) Required arguments: -i, --datainput=ARG [-i|--datainput] Name of RINEX observations file. -n, --navinput=ARG [-n|--navinput] Name of RINEX broadcast navigation file. Optional arguments: -d, --debug Increase debug level -v, --verbose Increase verbosity -h, --help Print help usage
[She@she-centos7 examples]$ ./example5 -i bahr1620.04o -n bahr1620.04n
WARNING: Navigation file bahr1620.04n doesn't have valid ionospheric correction parameters.
Bancroft method was used at epoch 0
Bancroft method was used at epoch 30
30.00000000 3633911.61526279 4425277.16374086 2799864.64313676 50.60813429 26.20915473 -12.95938696
60.00000000 3633911.27294441 4425277.29382556 2799864.72140608 50.60813776 26.20915583 -13.02953000
90.00000000 3633911.72144069 4425276.53504681 2799864.39705302 50.60812947 26.20915441 -13.44353101
120.00000000 3633912.70730754 4425277.96528185 2799865.20612008 50.60813093 26.20915406 -11.53320100
150.00000000 3633911.50029482 4425277.35231622 2799863.95125127 50.60813637 26.20914884 -13.19966526
...
3510.00000000 3633915.05584311 4425279.01996892 2799863.23598481 50.60811947 26.20912891 -10.33482742
3540.00000000 3633914.02925495 4425278.45113254 2799862.44004908 50.60812379 26.20912682 -11.66527738
3570.00000000 3633914.94178493 4425279.25564098 2799863.64853409 50.60812185 26.20913182 -10.05415985
[She@she-centos7 examples]$ ./example5 -i bell0300.02o -n brdc0300.02n
Bancroft method was used at epoch 0
0.00000000 4775853.47654020 116813.84203186 4213023.93446090 1.40113300 41.59962739 859.74948096
30.00000000 4775853.92901513 116814.01332576 4213024.06419099 1.40113492 41.59962554 860.17700436
60.00000000 4775853.79906886 116814.08023521 4213024.16856845 1.40113576 41.59962701 860.15038115
90.00000000 4775853.61836924 116814.07826280 4213024.23307484 1.40113579 41.59962852 860.05808505
120.00000000 4775853.58267418 116814.07468504 4213024.20737107 1.40113576 41.59962856 860.01426948
150.00000000 4775853.67207896 116814.10319962 4213024.24733056 1.40113608 41.59962829 860.10815795
180.00000000 4775853.60199151 116814.07684942 4213024.24030878 1.40113578 41.59962867 860.05061833
210.00000000 4775853.49177923 116814.03766845 4213024.28838846 1.40113534 41.59962966 859.99943066
240.00000000 4775853.50161516 116814.00936825 4213024.28751768 1.40113500 41.59962960 860.00568818
...
86249.98900000 4775850.73846418 116816.59904808 4213026.24533273 1.40116686 41.59965891 859.28720471
86279.98900000 4775850.70088181 116816.57470326 4213026.24143232 1.40116658 41.59965911 859.25607420
86309.98900000 4775850.71443751 116816.53725675 4213026.23800576 1.40116613 41.59965901 859.26324846
86339.98900000 4775850.70538967 116816.53198443 4213026.34238378 1.40116607 41.59965977 859.32568691
86369.98900000 4775850.58927617 116816.52446428 4213026.36751647 1.40116601 41.59966063 859.25543160
6. example6.cpp, OK。
[She@she-centos7 examples]$ ./example6 WARNING: Navigation file bahr1620.04n doesn't have valid ionospheric correction parameters. Exception at epoch: 2453167 00000000 0.000000000000000 GPS 0.00000000 3633909.10160000 4425275.50330000 2799861.27360000 50.60814318 26.20913892 -17.03005082 30.00000000 3633911.74073445 4425277.20389675 2799864.68208009 50.60813357 26.20915461 -12.84290456 60.00000000 3633911.54304831 4425277.19265836 2799865.01849144 50.60813503 26.20915787 -12.81467844 90.00000000 3633911.81361812 4425276.26562604 2799864.73369240 50.60812705 26.20915773 -13.42917878 120.00000000 3633913.22368762 4425278.04550679 2799865.35504803 50.60812745 26.20915371 -11.11778824 150.00000000 3633911.88342197 4425277.11127474 2799864.48218737 50.60813188 26.20915291 -12.91416557 180.00000000 3633911.83589123 4425276.61525403 2799864.34496730 50.60812910 26.20915345 -13.34575635 ...
7. example7.cpp, Error。
[She@she-centos7 examples]$ ./example7 39600.009 Case 1. Exception at epoch: 2452305 39600008 0.000999999998196 GPS terminate called after throwing an instance of 'gpstk::GeometryException' 已放棄(吐核)
8. example8.cpp,OK。
[She@she-centos7 examples]$ ./example8 0.000 2.565 0.291 -6.283 1.379 1.401 0.399 11.800 0.650 9 2.504 2.170 1.250 1.168 1.828 900.000 0.441 -0.464 -1.616 0.149 0.773 0.188 6.838 0.398 10 2.764 2.371 1.420 1.291 1.989 1800.000 -0.012 -0.120 -0.054 0.110 0.006 0.009 0.016 0.000 9 2.934 2.522 1.499 1.488 2.036 2700.000 -0.013 -0.021 -0.059 0.111 0.002 0.004 0.006 0.000 8 3.839 3.236 2.066 1.911 2.611 3600.000 -0.033 -0.018 -0.076 0.111 0.001 0.002 0.002 0.000 8 3.498 2.978 1.836 1.875 2.314 4500.000 -0.021 -0.027 -0.056 0.103 0.000 0.002 0.001 0.000 7 3.135 2.751 1.505 1.718 2.148 ...
9. example9.cpp,OK。
[She@she-centos7 examples]$ ./example9 Starting processing for station: 'COCO'. Processing finished for station: 'COCO'. Results in file: 'coco2370-04.out'. Starting processing for station: 'MADR'. Processing finished for station: 'MADR'. Results in file: 'madr1480-08.out'. Starting processing for station: 'ONSA'. Processing finished for station: 'ONSA'. Results in file: 'onsa2240-05.out'.
10. example10.cpp,OK???。
[She@she-centos7 examples]$ ./example10 Exception at epoch: 2452305 00000000 0.000000000000000 GPS; text 0:SolverPPP:text 0:Weight matrix is not square location 0:/home/She/Downloads/GPSTK/gpstk-2.5.src/dev/ext/lib/Procframe/SolverPPP.cpp:192 location 0:/home/She/Downloads/GPSTK/gpstk-2.5.src/dev/ext/lib/Procframe/SolverPPP.cpp:722 Exception at epoch: 2452305 00030000 0.000000000000000 GPS; text 0:SolverPPP:text 0:Weight matrix is not square location 0:/home/She/Downloads/GPSTK/gpstk-2.5.src/dev/ext/lib/Procframe/SolverPPP.cpp:192 location 0:/home/She/Downloads/GPSTK/gpstk-2.5.src/dev/ext/lib/Procframe/SolverPPP.cpp:722 Exception at epoch: 2452305 00060000 0.000000000000000 GPS; text 0:SolverPPP:text 0:Weight matrix is not square location 0:/home/She/Downloads/GPSTK/gpstk-2.5.src/dev/ext/lib/Procframe/SolverPPP.cpp:192 location 0:/home/She/Downloads/GPSTK/gpstk-2.5.src/dev/ext/lib/Procframe/SolverPPP.cpp:722 Exception at epoch: 2452305 00090000 0.000000000000000 GPS; text 0:SolverPPP:text 0:Weight matrix is not square location 0:/home/She/Downloads/GPSTK/gpstk-2.5.src/dev/ext/lib/Procframe/SolverPPP.cpp:192 location 0:/home/She/Downloads/GPSTK/gpstk-2.5.src/dev/ext/lib/Procframe/SolverPPP.cpp:722
11. example11.cpp,添加gv軟件包( $ sudo yum install gv )之后, OK。
[She@she-centos7 examples]$ ./example11 Going to launch ggv sh: ggv: 未找到命令 ... couldn't execute: ggv lineScatterPlotsExample.eps Going to launch gv sh: gv: 未找到命令 ... couldn't execute: gv lineScatterPlotsExample.eps Going to launch kghostview --portrait sh: kghostview: 未找到命令 ... couldn't execute: kghostview --portrait lineScatterPlotsExample.eps Going to launch ghostview Warning: Cannot convert string "-*-Helvetica-Medium-R-Normal--*-140-*-*-P-*-ISO8859-1" to type FontStruct Warning: Missing charsets in String to FontSet conversion Warning: Cannot convert string "-*-Helvetica-Medium-R-Normal--*-120-*-*-P-*-ISO8859-1" to type FontStruct Warning: Cannot convert string "-*-Helvetica-Medium-R-Normal--*-100-*-*-P-*-ISO8859-1" to type FontStruct Warning: Cannot convert string "-*-Helvetica-Bold-R-Normal--*-120-*-*-P-*-ISO8859-1" to type FontStruct
在CentOS 7 系統上安裝 gv 軟件包之后,可以打開圖片文件 ~/GPSTK/gpstk-2.5.src/dev/examples/lineScatterPlotsExample.eps。
12. example12.cpp,Error。
[She@she-centos7 examples]$ ./example12 terminate called after throwing an instance of 'gpstk::InvalidParameter' 已放棄(吐核)
13. example13.cpp,OK。
功能是打開一張圖片 surfacePlotExample.eps 。
[She@she-centos7 examples]$ ./example13 Going to launch ggv sh: ggv: 未找到命令 ... couldn't execute: ggv surfacePlotExample.eps Going to launch kghostview --portrait sh: kghostview: 未找到命令 ... couldn't execute: kghostview --portrait surfacePlotExample.eps Going to launch ghostview Warning: Cannot convert string "-*-Helvetica-Medium-R-Normal--*-140-*-*-P-*-ISO8859-1" to type FontStruct Warning: Missing charsets in String to FontSet conversion Warning: Cannot convert string "-*-Helvetica-Medium-R-Normal--*-120-*-*-P-*-ISO8859-1" to type FontStruct Warning: Cannot convert string "-*-Helvetica-Medium-R-Normal--*-100-*-*-P-*-ISO8859-1" to type FontStruct Warning: Cannot convert string "-*-Helvetica-Bold-R-Normal--*-120-*-*-P-*-ISO8859-1" to type FontStruct
14. example14.cpp,OK。
[She@she-centos7 examples]$ ./example14 Starting processing for station: 'ACOR'. Processing finished for station: 'ACOR'. Starting processing for station: 'MADR'. Processing finished for station: 'MADR'. Starting processing for station: 'SCOA'. Processing finished for station: 'SCOA'. Starting processing for station: 'SFER'. Processing finished for station: 'SFER'. Starting processing for station: 'TLSE'. Processing finished for station: 'TLSE'. 0.00000 0.96351 0.36898 2.63270 1.27138 30.00000 1.51249 -0.80217 2.74550 1.76894 60.00000 -1.05850 -0.59825 7.78966 0.82128 90.00000 0.72250 -1.04334 5.51055 0.60794 120.00000 0.88845 -1.38029 8.63975 0.14118 150.00000 0.69855 -0.38192 3.98268 0.89917 180.00000 0.62761 -0.12038 1.11617 1.30303 210.00000 0.49831 -0.18068 0.12812 1.62024 240.00000 0.33078 -0.02410 0.10592 1.73208 270.00000 0.25720 -0.22573 0.11656 2.02044 300.00000 0.07949 -0.31696 0.14422 2.17535 330.00000 0.00535 -0.19065 0.09094 2.24695 360.00000 -0.07861 -0.22373 0.29576 2.18388 390.00000 -0.06248 -0.28896 0.31730 2.15903
15. example15.cpp,OK。
[She@she-centos7 examples]$ ./example15 Before perturbation: sample mean is 10.0586, sample standard deviation is 1.99072 Altering measurement 773 to take the value of 10000 After perturbation: sample mean is 20.0485, sample standard deviation is 315.916 Robust statistics: number = 1000 quartiles = 8.6755863 11.334482 median = 10.126592 MAD = 1.9174815 Using robust stats: sample mean is 10.058538, sample standard deviation is 1.9917154
16. example16.cpp, Error:編譯報錯。
[She@she-centos7 examples]$ make g++ -c -o example16.o example16.cpp example16.cpp: 在函數‘int main(int, char**)’中: example16.cpp:1025:18: 錯誤:‘class gpstk::SP3EphemerisStore’沒有名為‘enableDataGapCheck’的成員 SP3EphList.enableDataGapCheck(); ^ example16.cpp:1026:18: 錯誤:‘class gpstk::SP3EphemerisStore’沒有名為‘setGapInterval’的成員 SP3EphList.setGapInterval( ^ example16.cpp:1033:18: 錯誤:‘class gpstk::SP3EphemerisStore’沒有名為‘enableIntervalCheck’的成員 SP3EphList.enableIntervalCheck(); ^ example16.cpp:1034:18: 錯誤:‘class gpstk::SP3EphemerisStore’沒有名為‘setMaxInterval’的成員 SP3EphList.setMaxInterval( ^ example16.cpp:2040:54: 錯誤:expression cannot be used as a function << YDSTime(gRover.header.epoch).sod() ^ example16.cpp:2270:45: 錯誤:‘class gpstk::CommonTime’沒有名為‘DOYsecond’的成員 fAverage << gRover.header.epoch.DOYsecond() ^ example16.cpp:2294:38: 錯誤:‘class gpstk::CommonTime’沒有名為‘DOYsecond’的成員 cout << gRover.header.epoch.DOYsecond() << " " // #1 ^ make: *** [example16.o] 錯誤 1
17 example17.cpp,Error:編譯報錯。
[She@she-centos7 examples]$ make g++ -c -o example17.o example17.cpp example17.cpp: 在成員函數‘virtual void example17::process()’中: example17.cpp:433:18: 錯誤:‘class gpstk::SP3EphemerisStore’沒有名為‘enableDataGapCheck’的成員 SP3EphList.enableDataGapCheck(); ^ example17.cpp:434:18: 錯誤:‘class gpstk::SP3EphemerisStore’沒有名為‘setGapInterval’的成員 SP3EphList.setGapInterval( ^ example17.cpp:441:18: 錯誤:‘class gpstk::SP3EphemerisStore’沒有名為‘enableIntervalCheck’的成員 SP3EphList.enableIntervalCheck(); ^ example17.cpp:442:18: 錯誤:‘class gpstk::SP3EphemerisStore’沒有名為‘setMaxInterval’的成員 SP3EphList.setMaxInterval( ^ example17.cpp: 在成員函數‘virtual void example17::shutDown()’中: example17.cpp:1576:31: 錯誤:‘class gpstk::CommonTime’沒有名為‘DOYsecond’的成員 << workEpoch.DOYsecond() << endl; ^ make: *** [example17.o] 錯誤 1
18. example18.cpp,OK。
[She@she-centos7 examples]$ ./example18 This is example 18 of GPSTk. process... 0 1.000000 2.004536 4.000000 1 1.000000 2.002924 4.000000 2 1.000000 1.999229 4.000000 3 1.000000 1.994481 4.000000 4 1.000000 1.996261 4.000000 5 1.000000 1.996434 4.000000 6 1.000000 1.994959 4.000000 ... 97 1.000000 2.000722 4.000000 98 1.000000 2.000658 4.000000 99 1.000000 2.000705 4.000000 Finished.