First time to upload my code here. This is a beta version for testing.
This program helps you get RTCM messages from NTRIP caster and get RTK solution:
- Recieve PVT topic from ublox_driver;
- Generate GPGGA string by PVT message;
- Send GPGGA string to NTRIP server(NTRIP caster) by httplib.HTTPConnection, and get RTCM data from response;
- Send recieved RTCM data to Ublox-F9P module via UART when the port is opened and single point position valid;
- Reconnect if network failed.
CSDN blog : https://blog.csdn.net/Millium/article/details/125837995?spm=1001.2014.3001.5502
Realtime test uploaded on Bilibili : https://www.bilibili.com/video/BV1CW4y117Du/
ROS melodic (tested)
Python 2.7 is required, NOT Python 3.
httplib (if not installed, run pip install
to install this module).
I tested this program in Ubuntu 18.04 (with ROS melodic and Python 2.7), it seems to work well.
But in Ubuntu 20.04 (with ROS noetic, Python 3 and http.client), errors occurred.
I did a lot of research, I think the main reason may be that http.client in python 3 DOES NOT support ICY 200 OK
response header sent by NTRIP caster, but the problem does not exist in httplib.HTTPConnection in Python 2.7 .
Clone the code to your workspace and:
catkin_make
The version I'm using is v21.09 , you can test NTRIP username and password in Reciever-NTRIP Client
.
Firstly you need to correctly configure UART port of your F9P module in Configure-PRT
, such as Baudrate
and Protocol in/out
.
In my case, I use UART1 to send UBX-RXM-RAWX
, UBX-RXM-SFRBX
and UBX-PVT
message via USB-UART module to my laptop (and parsed by ublox_driver, published as ROS topic), and send RTCM message to UART2 via USB-UART module to F9P, so UBX
in Potocol out
of UART1 is needed, and RTCM
in Potocol in
of UART2 is needed.
Message rate in Configure-RATE
may also be set, for example 10Hz.
After configuration, you can see messages printed in Packet Console
.
Because I'm using ublox_driver, I need to enable UBX-RXM-RAWX
, UBX-RXM-SFRBX
and UBX-PVT
message in u-center
.
Actually, only UBX-PVT
message is needed for RTK. You can use other ublox driver to extract PVT
message and publish as ROS topic so RAWX
and SFRBX
is not needed anymore. Or you could use ublox driver which supports NMEA, then you just need to enable NMEA-GxGGA and subscribe NMEA message and send it to NTRIP caster.
-
Plug in your F9P's UART ports to your computer via USB-UART module, and check ports' name, like
/dev/ttyUSB0
, then change the port name and baudrate inntripclient.py
(F9P's UART2, for sending RTCM data to module) anddriver_config.yaml
(F9P's UART1, for recieve PVT message from module) of ublox_driver, don't forget to obtain r/w permissions of the ports. -
Launch ublox_driver, and
rostopic echo
topic/ublox_driver/receiver_pvt
, remember tosource devel/setup.bash
in your terminal in ublox_driver workspace. -
Run roscore in a terminal:
roscore
- In the other terminal, run this program in your workspace:
source devel/setup.bash
rosrun ntrip_ros ntripclient.py
If your network is fine, UART successfully opened and GNSS single point position is fixed, the recieved RTCM data is sent to UART2 of F9P module.
Then, wait for carr_soln
of topic /ublox_driver/receiver_pvt
turning to 2
, which means RTK fixed solution (0
means no RTK, 1
means RTK float solution), and enjoy it.
Note that RTK solution is obtained in topic /ublox_driver/receiver_pvt
.
In my case, I'm using
- Beitian BT-F9PK4 module;
- Beitian BT-345 antenna;
- Quectel EC20 4G module;
- CH340 USB to UART module made by myself;
- Lenovo laptop with i5-8265U.
ROS message file GnssPVTSolnMsg.msg
and GnssTimeMsg.msg
are copied from ublox_driver. Many thanks to Dr. Cao for his work.
Thanks to these code contributors:
ntrip_ros by tilk;
ntrip_client by LORD-MicroStrain;
RTK-NTRIP-RTCM by Archfx;
ntrip_ros by MikHut;
ntrip_ros by Road-Balance.
TCP method (send RTCM data to a given port to ublox_driver, like str2str
in RTKLIB) is not supported yet.
Problem in http.client
in Python 3 might be solved by ntrip_ros_python3, need to check it out later.
And using socket
instead of http.client
may be a good idea but script written by myself does not work correctly for now, need to work it out later.