Using CloudLocate with M8/M9 GNSS
Set-up the connection with GNSS
Note: In order to get an understanding of how the commands are structured, and created, and what are the commands available, please use the above mentioned protocol specification document and look for the 3 message format used for the configuration
In this section
The above section allows you to understanding on how to configure the GNSS module and get the raw measurement (UBX-RXM-MEASX) using GNSS receiver. However, in a real use case, you need to filter the real-time messages coming from the GNSS to validate the quality of the satellite signals and avoid no-fix condition, and also to apply a fallback strategy if the quality of the signal is not good enough. The main goal is balance the power consumption versus the location accuracy and to avoid no-fix situations in the cloud
u-blox provides a sample code for host processor that allows you modify few parameters to achieve the best result according to your strategy.
collects real-time UBX-RXM-MEASX messages from an M8/M9 GNSS,
filters the messages to met the given criteria
send the correct payload to CloudLocate when the configured conditions are met, or apply a fallback option
The sample code for M8 (and M9) is available in the Download area of the Thingstream portal in the IoT Location-as-a- service > CloudLocate section.
The next sections provides more details about the code, the settings and the fallback options
Note: the code is provided just as reference and you are allowed to modify it accordingly to your needs
In this section you can find the explanation of the general settings to connect to GNSS and the custom parameters to optimize the validate the quality the satellite information contained in the UBX-RXM-MEASX message so that you can filter out low quality signals.
COMPORT is the port on which you've connected the EVK
BAUD_RATE is the rate on which your EVK is configured. In order to see what is your EVK's baud rate see the corresponding products user guide.
GNSS_TPYE is the preferred constellation that will be used for the target UBX-RXM-MEASX messages. The script will ignore any satellite that does not belong to the configured constellation. Our tests shows that the best performance can be achieved with GPS, but this can change from region to region. Only one constellation is allowed
TIMEOUT is the maximum number of seconds the script will try to get a UBX-RXM-MEASX message that falls under given criteria.
MIN_NO_OF_SATELLITES: each UBX-RXM-MEASX message contains information for more than 1 satellite. This parameter allows you to set the minimum number of satellites to consider valid the UBX-RXM-MEASX message. The minimum value is 5; a low number could affect the accuracy, a high number (i.e. 16) affects the size of the payload and the time to meet this condition (and the risk to not meet the condition) and so finally the power consumption. An acceptable range for constrained devices can be between 5 and 10
It's worth remembering that a MEASX message comprises 44 bytes for the header plus 24 bytes for each satellite.
CNO_THRESHOLD: it is the carrier-to-noise ratio threshold. Any satellite with a CNO below this threshold will be ignored and all the UBX-RXM-MEASX will be discarded. The higher the value, the better the message. A good threshold is 35 dB/Hz, but the correct one can be achieved only by doing some testing in your real environment
MULTIPATH_INDEX: multipath index determines the path that the GNSS signal took to reach the receiver (whether it had a straight line of sight, or it bounced off buildings or other obstacles). The lower value the better (2 can be used as starting point for testing, 1 = low, 2 = medium, 3 = high). More information about the the index can be found in the specifications of GNSS Signal Measurement field of the 3GPP Radio Resource Location Protocol.
PSEUDO_RANGE_ERR: this parameter determines pseudo-range RMS error value. The index represents the range of the error of the calculated distance between the satellite and the GNSS receiver. This is an index that can span from 0 to 63; setting a low value can lead to a better accuracy in good sky conditions, but it brings also the risk to not being able to converge to a solution in bad sky conditions. More information about the meaning of the index can be found in the specifications of GNSS Signal Measurement field of the 3GPP Radio Resource Location Protocol. The value has two effects:
if any of the satellite reported in the MEASX message does not met this condition, the entire frame is discarded and a new one will be considered, thus increasing the time that the GNSS is switched on and the corresponding power consumption
A satellite with a lower value will be considered as more reliable by the CloudLocate location engine
An acceptable index to start testing can be 39.
EPOCHS: each MEASX message is 1 epoch. This parameter lets us configure number of epochs to record (which fall under above parameters) before sending the payload to CloudLocate. The recommended setting is 1 epoch since an higher value increase significantly the payload size.
SEND_BINARY: set this flag when you want to send the raw measurement as a binary messages (exactly as provided by GNSS) to CloudLocate service endpoint. Otherwise, Base64 encoded JSON payload will be sent. JSON format is the only option that you can use whenever you need to send not real-time (delayed) measurements, because you need to add also date and time. A delayed message is a raw measurement that reaches CloudLocate endpoint more than 59 seconds after the generation, useful for example if you do not have the connectivity and you want to store the measurement in the device for post-processing.
FALLBACK_METHODOLOGY: controls the way the script behaves if it does not find required MEASX messages as per main configuration. There are a few fallback methodologies defined in the code, and which one to use depends on this parameter. Available fallback methodologies (configurations) are:
FALLBACK_DO_NOT_SEND will not use any fallback, and is the default when running this script.
FALLBACK_NO_OF_SATELLITIES_ONLY will fallback to only match # of satellites (irrespective of CNO value).
FALLBACK_EXTEND_TIMEOUT will extend the timeout value, so if a match is not found without original time, it will add this more seconds.
FALLBACK_EPOCHS will use main configuration but override number of epochs set to 1.
FALLBACK_RECEIVER_POSITION: this option allows to use the position estimated by the GNSS and forward it to CloudLocate endpoint. See Mixed mode section for more information
Capturing raw measurements
Once you have adjusted the parameters, you can capture real-time UBX-RXM-MEASX measurements using the following code snippet: