Skip to content

Conversation

@slgrobotics
Copy link
Contributor

Currently LAT/LON/ALT values come mostly from UBX_MSG_NAV_PVT message, which does not deliver high precision components to _gps_position ORB message (a.k.a. SensorGps.msg).

This PR seeks to add parsing of the MSG_NAV_HPPOSLLH message and delivering high precision components of the coordinates to the PX4 codebase.

My code works fine on my rover, removing random jerking which was caused by low precision "rounding" of the coordinates. With centimeter accuracy my rover (lawnmower) moves smoothly and precisely, which is critical for agricultural vehicles.

I have dual antenna F9P configuration and also take advantage of precise heading (RELPOSNED).

Here is the code that utilizes the added fields:

// must be float64 (a.k.a. double) for RTK precision:
double f_lat = _sensor_gps_data.lat / 1.0e7 + _sensor_gps_data.lat_hp / 1.0e9;
double f_lon = _sensor_gps_data.lon / 1.0e7 + _sensor_gps_data.lon_hp / 1.0e9;

matrix::Vector2d cp(f_lat, f_lon);

PX4_INFO("Lat: %.12f  %.12f  Lon: %.12f  %.12f", f_lat, _global_pos.lat, f_lon, _global_pos.lon);

_current_position = cp;

I'd guess that the added components must be also passed to EKF2 for better estimates. It could also prioritize RTK precision data, when available.

Note:
The following block must be added to PX4-Autopilot/msg/SensorGps.msg, to generate sensor_gps_s structure:

...
int32 alt_ellipsoid          # Altitude in 1E-3 meters above Ellipsoid, (millimetres)

# RTK GPS high precision components:
int8  lat_hp                 # Latitude high precision component, -99 to +99 in 1E-9 degrees
int8  lon_hp                 # Longitude high precision component, -99 to +99 in 1E-9 degrees
int8  alt_hp                 # high precision component of altitude above mean sea level, -9 to +9 in 0.1 mm
int8  alt_ellipsoid_hp       # high precision component of altitude above Ellipsoid, -9 to +9 in 0.1 mm

float32 s_variance_m_s       # GPS speed accuracy estimate, (meters/sec)
...

Note: gps_position message uses raw uint32 fro lat and lon, so I had to use alt_ellipsoid to pass high precision components
Requires changes to .../PX4-Autopilot/msg/SensorGps.msg:

# RTK GPS high precision components:
int8 lat_hp			# Latitude high precision component, -99 to +99 in 1E-9 degrees
int8 lon_hp			# Longitude high precision component, -99 to +99 in 1E-9 degrees
int8  alt_hp				# high precision component of altitude above mean sea level, -9 to +9 in 0.1 mm
int8  alt_ellipsoid_hp		# high precision component of altitude above Ellipsoid, -9 to +9 in 0.1 mm
WIP: back to one config message for Rover USB RELPOSNED and HPPOSLLH
Removed tracing, version ready for PR
Restored original order in _got_posllh /  _got_velned
Original whitespace restored
@slgrobotics
Copy link
Contributor Author

I opened PX4/PX4-Autopilot#21678 to match these changes (specifically, to add lines to SensorGps.msg)

@slgrobotics
Copy link
Contributor Author

I opened #136 to replace this PR, as there is a lot of changes related to renaming lat/lon/alt fields in SensorGPS.msg (as suggested by @dagar )

This PR must be closed.

@slgrobotics
Copy link
Contributor Author

See #136 for further action

bkueng pushed a commit to PX4/PX4-Autopilot that referenced this pull request Jul 13, 2023
To match PX4/PX4-GPSDrivers#132 - adding high precision RTK lat/lon/alt components
antbre pushed a commit to BioMorphic-Intelligence-Lab/PX4-Autopilot that referenced this pull request Sep 14, 2023
To match PX4/PX4-GPSDrivers#132 - adding high precision RTK lat/lon/alt components
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant