Stefal / rtkbase

Your own GNSS base station for RTK localization with a Web GUI
GNU Affero General Public License v3.0
469 stars 114 forks source link

How to configure Quectel LC29HBS #425

Open jupiter9595 opened 3 weeks ago

jupiter9595 commented 3 weeks ago

Waveshare has refered RTKBase in their LC29HBS board description https://www.waveshare.com/wiki/LC29H(XX)_GPS/RTK_HAT

Looks like their configuration was successful but they did not show Main Service configuration details.

Has anyone successfully configure this GNSS unit?

RTKBase does not detect this unit. How to correctly configure this unit? Are Base coordinates fill in automatically when unit is detected? I put the following coordinates: 49.208601 19.072489 1050 and RTKBase says format is not correct.

Please help to configure RTKBase unit

jupiter9595 commented 3 weeks ago

Coordinates format I've figured out myself by looking at input fields defined pattern. Altitude should have at least 2 decimal places 1050.00 in this case

deece commented 1 week ago

LC29H(BS) Initial Configuration: Connect to the unit using QGNSS. In the console, data input, Advanced, select: Text format: ASCII, Checksum Type: NMEA, Suffix: CRLF

In Data Input, enter the following (as per Quectel_LC29HBS_GNSS_Protocol_Specification_V1.1-1.pdf):

Check firmware version: $PQTMVERNO*

Enable MSM7 messages $PAIR432,1*

Enable Station Reference Message 1005 $PAIR434,1*

Enable Ephemeris messages $PAIR436,1*

Crank the baud rate up (Could also go 3000000) $PAIR864,0,0,921600*

Enable NMEA GGA Time, position, and fix related data $PAIR062,0,1*

Enable NMEA GLL Position data: position fix, time of position fix, and status $PAIR062,1,1*

Enable NMEA GSA GPS DOP and active satellites $PAIR062,2,1*

Enable NMEA GSV Satellite information $PAIR062,3,1*

Enable NMEA RMC Position, velocity, and time $PAIR062,4,1*

Enable NMEA VTG Track made good and speed over ground $PAIR062,5,1*

Enable NMEA ZDA UTC day, month, and year, and local time zone offset $PAIR062,6,1*

Enable NMEA GRS GRS range residuals $PAIR062,7,1*

Enable NMEA GST Position error statistics $PAIR062,8,1*

Save parameters $PQTMSAVEPAR*

Power cycle the unit, reconnect at the new baud rate

Start Survey-in (1 day duration) $PQTMCFGSVIN,W,1,86400,0,0,0,0*

You will see PQTMSVINSTATUS repeating, when the third field=2, the survey-in is complete. Fields 8, 9 & 10 are the mean ECEF coordinates. Convert these to lat/long/elevation above ellipsoid to enter into RTKBase. You may have to prune some places after the decimal point for height before the parser will accept it:

import numpy as np

# Constants
a = 6378137.0  # WGS-84 Earth semimajor axis (m)
f = 1 / 298.257223563  # WGS-84 flattening
e2 = f * (2 - f)  # Square of eccentricity

# Input ECEF coordinates (X, Y, Z)
X, Y, Z = -123456789.0000, 1263456789.000, -123456789.1234

# Calculate longitude
longitude = np.arctan2(Y, X)

# Iterative calculation of latitude and height
p = np.sqrt(X**2 + Y**2)
lat = np.arctan2(Z, p * (1 - e2))  # Initial guess for latitude
lat_prev = 0
h = 0

# Iterate until convergence
while abs(lat - lat_prev) > 1e-12:
    lat_prev = lat
    N = a / np.sqrt(1 - e2 * np.sin(lat)**2)  # Prime vertical radius of curvature
    h = p / np.cos(lat) - N
    lat = np.arctan2(Z, p * (1 - e2 * N / (N + h)))

# Convert latitude and longitude to degrees
latitude = np.degrees(lat)
longitude = np.degrees(longitude)

latitude, longitude, h

When complete, save parameters $PQTMSAVEPAR*

deece commented 1 week ago

For detection: $PQTMVERNO*

returns: $PQTMVERNO,LC29HBSNR11A01S,2023/02/13,10:14:06*

The pertinent information to detect this is: LC29HBS

jupiter9595 commented 1 week ago

@deece - thanks a lot for this comprehensive guide! Have you ever got RTK fix status with this board? I read in internet, people get RTK float only.

deece commented 1 week ago

I only got my base station functional tonight, I probably won't be at a point where I have rover for months.