开源目的
鉴于rtklib 的巨大的时间更新间隔,作者在github 上fork了一个仓库,初步用于以下目的,
- 修复代码中的bug/issue
- 对代码或者结构进行尽可能小的调整或者优化,程序性能提升,编译器,操作系统支持等
- 算法性能的提升或优化
- 建立一个
rtklib 的wiki
目前的工作
目前已经进行了部分更行,此部分更新暂时位于分支cmake_support ,等待cmake 的support全部完成后,会merge到master分支 https://github.com/akstuki/RTKLIB_improve/tree/feature/cmake_support
在目前的cmake_support 分支中主要修复了以下两个bug,
- 关于windows下路径下文件读取的bug,windows实际上是支持路径分隔符
/ 的,但在原代码中必须使用\\ - 修复了一个单点定位程序debug下的bug
另外,此分支主要致力于将app下的程序对编译器的依赖抽离出来,使用CMake重新组织代码,这样我们可以有更好的跨平台和多编译器支持,现在rnx2rtkp 的support已经完成,并分别在Windows和Linux下进行了测试。
使用
下边简单介绍一下cmake 对 rnx2rtkp 的support,以linux为例,windows是一样的,
- 首先,我们使用以下命令生成
makefile ,以下命令要在目录rtklib_improve/app/consapp/rnx2rtkp 下执行,
$ cmake -S . -B binn
上述命令的输出大概是下边的样子,
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/app/consapp/rnx2rtkp/binn
- 编译程序
执行以下两行命令, cd binn make
在windows下如果我们安装了visual studio,那么第一步会在binn文件夹下生成visual studio的工程文件,我们使用visual studio打开文件编译即可
编译输出很可能看起来是下边的样子,
[ 4%] Building C object CMakeFiles/rnx2rtkp.dir/rnx2rtkp.c.o
[ 9%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rtkcmn.c.o
/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rtkcmn.c: In function ‘tickget’:
/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rtkcmn.c:1853:21: warning: unused variable ‘tp’ [-Wunused-variable]
1853 | struct timespec tp={0};
| ^~
/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rtkcmn.c: In function ‘readngspcv’:
/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rtkcmn.c:2315:13: warning: ‘strncpy’ output may be truncated copying 61 bytes from a string of length 255 [-Wstringop-truncation]
2315 | strncpy(pcv.type,buff,61); pcv.type[61]='\0';
| ^~~~~~~~~~~~~~~~~~~~~~~~~
[ 13%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rinex.c.o
In function ‘readrnxclk’,
inlined from ‘readrnxfp’ at /cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rinex.c:1511:26:
/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rinex.c:1453:9: warning: ‘strncpy’ output may be truncated copying 4 bytes from a string of length 1024 [-Wstringop-truncation]
1453 | strncpy(satid,buff+3,4);
| ^~~~~~~~~~~~~~~~~~~~~~~
[ 18%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rtkpos.c.o
[ 22%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/postpos.c.o
[ 27%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/solution.c.o
[ 31%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/lambda.c.o
[ 36%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/geoid.c.o
[ 40%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/sbas.c.o
[ 45%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/preceph.c.o
In function ‘readsp3h’,
inlined from ‘readsp3’ at /cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/preceph.c:306:12:
/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/preceph.c:103:13: warning: ‘strncpy’ output may be truncated copying 3 bytes from a string of length 1014 [-Wstringop-truncation]
103 | strncpy(tsys,buff+9,3); tsys[3]='\0';
| ^~~~~~~~~~~~~~~~~~~~~~
[ 50%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/pntpos.c.o
[ 54%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/ephemeris.c.o
[ 59%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/options.c.o
[ 63%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/ppp.c.o
[ 68%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/ppp_ar.c.o
[ 72%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rtcm.c.o
[ 77%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rtcm2.c.o
[ 81%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rtcm3.c.o
[ 86%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/rtcm3e.c.o
[ 90%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/ionex.c.o
[ 95%] Building C object CMakeFiles/rnx2rtkp.dir/cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/src/tides.c.o
[100%] Linking C executable rnx2rtkp.exe
[100%] Built target rnx2rtkp
编译成功,我们查看以下当前目录,发现可执行程序已经生成了,
$ ls
CMakeCache.txt CMakeFiles CTestTestfile.cmake Makefile cmake_install.cmake rnx2rtkp.exe
- run test
我们通过以下命令run以下test, make test 输出大概是下边的样子,
$ make test
Running tests...
Test project /cygdrive/c/xq/1-own/0-code/0rtkapps/rtklib_improve/app/consapp/rnx2rtkp/binn
Start 1: test1
1/21 Test
Start 2: test2
2/21 Test
Start 3: test3
3/21 Test
Start 4: test4
4/21 Test
Start 5: test5
5/21 Test
Start 6: test6
6/21 Test
Start 7: test7
7/21 Test
Start 8: test8
8/21 Test
Start 9: test9
9/21 Test
Start 10: test10
10/21 Test
Start 11: test11
11/21 Test
Start 12: test12
12/21 Test
Start 13: test13
13/21 Test
Start 14: test14
14/21 Test
Start 15: test15
15/21 Test
Start 16: test16
16/21 Test
Start 17: test17
17/21 Test
Start 18: test18
18/21 Test
Start 19: test19
19/21 Test
Start 20: test20
20/21 Test
Start 21: test21
21/21 Test
100% tests passed, 0 tests failed out of 21
Total Test time (real) = 11.82 sec
我们在当前目录下可以查看输出文件, 在windows下我们使用visual studio打开工程,是下边这个样子,如果我们要run所有的test,只需要编译RUN_TESTS 这个项目即可,
写在最后 - 欢迎加入
希望自己能坚持下来,另外也欢迎对这个开源感兴趣的朋友能加入进来,大家一起讨论,一起完善。也希望大家能贡献自己在rtklib使用中遇到的困惑或者问题,可以通过任何方式告诉我们,留言或者github issue。
|