I realized u-blox provides this capability that you can freeze the position data like heading when stationary and its called “static hold” and there are threshold to be set for that.
Is this feature enabled by default? based on u-box data sheet, it is NOT. So how can we enable it through Sparkfun library?
Also, I did find the threshold values for static hold on config key header file. But they are in hex numbers. I am no following what the decimal numbers mean when I convert them. How can I set the position and speed threshold values to an arbitrary number?
The newer u-blox modules, like the ZED-F9 and MAX-M10, support a “configuration interface”. This allows you to configure the module’s settings individually - using Keys. UBLOX_CFG_MOT_GNSSSPEED_THRS sets the “GNSS speed threshold below which platform is considered as stationary (a.k.a. static hold threshold)”. UBLOX_CFG_MOT_GNSSDIST_THRS sets the “Distance above which GNSS-based stationary motion is exit (a.k.a. static hold distance threshold)”. But, unfortunately, the M8 does not support the configuration interface.
On the M8U, you can set the Static hold threshold and Static hold distance threshold, but you have to do it through the UBX-CFG-NAV5 message. It is the same message which sets the “dynamic model” to automotive.
There are three ways forward:
You could edit the library source code for setDynamicModel and copy it or alter it so it can set: staticHoldThresh (payload byte 22, uint8_t), staticHoldMaxDist (payload bytes 28 and 29, uint16_t) and the mask (payload bytes 0 and 1, uint16_t, set bit 6 staticHoldMask).
I went ahead and used u-center to set that up. it works but only for position. It does not freeze the heading that I needed. my heading drifts over 20 deg in stationary mode overnight.
I thought about writing a logic that does the same thing and freeze heading below a certain value of speed. the problemn with that is, I am reading gps values every 2 seconds and that might be too slow if the driver creeps a little bit at the end of parking maneuvers. it might not catch the last heading change in some situatations.