The release packages now are built with github actions. And windows support is testing. They are available on linux, macos, and windows now. If you find any bug, please submit issues.
Python | Linux(After 2010) | Macos Sonoma(M1) | Macos Ventura(Intel) | Windows |
---|---|---|---|---|
3.6 | ❌ | ❌ | ❌ | ✅ |
3.7 | ✅ | ❌ | ❌ | ✅ |
3.8 | ✅ | ✅ | ✅ | ✅ |
3.9 | ✅ | ✅ | ✅ | ✅ |
3.10 | ✅ | ✅ | ✅ | ✅ |
3.11 | ✅ | ✅ | ✅ | ✅ |
In previous versions, the .so file is directly in site-packages folder, which is disgusting. To let the code editor can make use of the .pyi, the .so file is moved, and is loaded by the init.py file now.
I found that there is a more recent branch on rtklib, thus I update the rtklib to 2.4.3 b34.
This version contains follow updates:
output_path = Arr1Dchar("pyexample_output.txt")
obs = obs_t()
data = Arr1Dobsd_t(100)
obs.data = data
obs.n = len(data)
obs.nmax = obs.n
But it's not recommended to do so, because this may lead memory leakage. Many pointers in rtklib may refer to anther variable, thus, call free() to directly clear it may cause other problems. Please make sure you won't modify it too often.
raw = raw_t()
ret = input_rawt(raw,STRFMT_UBX,Arr1Dchar("example.ubx"),Arr1Dchar("rb"))
Big Progress!!!!
Now you can install it via pip
pip install pyrtklib
This is a Python binding for RTKLIB, the most popular GNSS-RTK positioning C library. However, many researchers are currently using Python for research, especially in deep learning field. Thus, we implement this Python interface of RTKLIB to build a bridge between Python and positioning. By means of RTKLIB, you can easily read data from rinex file and process the positioning using the methods provided by RTKLIB, such as SPP, RTK, PPP.
If you want to use the rtklib deeply, please refer to the point position example.
If you just need the result, please refer to the post position example.
If you want to use the rtklib version based on rtklibexplorer/rtklib_demo5, please refer to pyrtklib_demo5.
Project | pyrtklib | rtklib-py | pyRTKLib |
---|---|---|---|
Author | Runzhi Hu | Tim Everett | Alain Muls |
Implementation Method | C++ with pybind11 | Pure python | Directly use rtklib binary |
pros | All functions and structures in rtklib are available. | Modern and easy interface | easy to plot |
cons | Interfaces are in C style, need further wrapping for convenience | No support for BDS, and only supports PPK solutions currently. | More focus on plotting, can't be used for deep process of positioning |
Installation | pip install | git clone | git clone |
![Python Code](https://github.com/IPNL-POLYU/pyrtklib/blob/main/image/rtkpy.png?raw=true) | ![C Code](https://github.com/IPNL-POLYU/pyrtklib/blob/main/image/rtkc.png?raw=true) |
pip install pyrtklib
The package relies on both system version and python version. The release packages are built with github actions. They are available on linux, macos, and windows now.
Python | Linux(After 2010) | Macos Sonoma(M1) | Macos Ventura(Intel) | Windows |
---|---|---|---|---|
3.6 | ❌ | ❌ | ❌ | ✅ |
3.7 | ✅ | ❌ | ❌ | ✅ |
3.8 | ✅ | ✅ | ✅ | ✅ |
3.9 | ✅ | ✅ | ✅ | ✅ |
3.10 | ✅ | ✅ | ✅ | ✅ |
3.11 | ✅ | ✅ | ✅ | ✅ |
❌
Installation of pyrtklib is very easy, just clone the code and install it.
Dependencies
We don't provide pre-compiled package so far, thus, this library will be compiled in time. (Looking forward one day it can be directly installed by pip!) It requires several dependencies, including gcc and cmake. If you are using on a MacOS, please first install gcc by brew and set the compiler path, because RTKLIB used GNU C features, which is hard to solve in clang. MSVC is not tested.
git clone git@github.com:IPNL-POLYU/pyrtklib.git
cd pyrtklib
python3 setup.py install
Then you can use this lib by importing it.
from pyrtklib import *
The aim for this binding is to make a interface of RTKLIB, without changing any code in RTKLIB. However the biggest obstucle is that RTKLIB enoumously uses function side effect. For example, the reading function readrnx, you should pass the obs, nav, sta as input parameters, and the process result will be directly written to obs, nav, and sta. Thus, these functions only receive the pointer and it requires the Python interface contains the original pointer. Unfortunately, the STL container can't satisfy this requirement because STL container will copy the data. If Python receives a STL container, it's not the original version of the data.
Thus, we implement Arr1D and Arr2D to handle the array and can also be used as the pointer. Arr1D has a structure like this:
template<class T>
struct Arr1D<T>{
T* src;
int len;
}
If you want to create it in Python, just use "Arr1D"+"ctype", for example, if you want a char type array, then, it should be:
myarr = Arr1Dchar(3)
The constructor parameter is the length. In the above example, the length is 5. You can directly to modify the data:
myarr[0]='a'
myarr[1]='b'
myarr[2]='c'
And you can also use the slides:
yourarr=myarr[0:2]
So far, the Arr1D and Arr2D don't have the ability to print itself, if you use
print(myarr)
you'll get:
<pyrtklib.Arr1Dchar object at 0x7fe3799a6ef0>
So, if you want to see the content, you can change it to a list by:
list(myarr)
Then the result will be:
['a','b','c']
Warning: Be really carefull to use Arr1D and Arr2D, because it doesn't have a bounary check. In some cases, it's a pure pointer and doesn't know how long itself is. So be careful to set the index, or the segmentation fault will occur.
This binding provides all the functions and data structures in rtklib. The structures in rtklib is used as a class in Python. For example, if you want a obs_t, then you can use it by:
obs = obs_t()
And the data in obs can be accessed by:
obs.data[0]
Notice that obs.data is a Arr1Dobsd_t class. In other words, this is an array of obsd_t. For more detail, you can see in the example.py.
If you find this tool useful, you can cite our paper as:
@inproceedings{hu2023fisheye,
title={Fisheye camera aided NLOS exclusion and learning-based pseudorange correction},
author={Hu, Runzhi and Wen, Weisong and Hsu, Li-ta},
booktitle={2023 IEEE 26th International Conference on Intelligent Transportation Systems (ITSC)},
pages={1--8},
year={2023},
organization={IEEE}
}