I am finding conflicting info on web search so am hoping for a more official answer here:
Am I able to get loc-enhanced data on a M-SoM device? Or is it just GNSS location?
If so, how do I enable it and how do I access it?
I am finding conflicting info on web search so am hoping for a more official answer here:
Am I able to get loc-enhanced data on a M-SoM device? Or is it just GNSS location?
If so, how do I enable it and how do I access it?
Yes, with caveats:
You must typically be on an enterprise plan. Basic and plus plans do not have location fusion.
You can also be on the free plan, but since each location fusion counts as 50 data operations, you may exceed the monthly limit.
There is no equivalent to Tracker Edge for M-SoM; you will need to manually generate the appropriate loc events. While the Wi-Fi hardware on the M-SoM could generate the access point information in the same way as the Tracker, and you can add the cellular tower information to it, there isn't a pre-made library for doing it at this time.
Another caveat is that if you include GNSS information including a lock, location fusion is not done for non-Tracker devices. It's expensive, and only the GNSS location is used. The Tracker will still do location fusion if you have a GNSS lock.
Thank you for the response!
Do you have any code example of how to manually generate an appropriate loc event where I can pull coordinates even if GNSS couldnât get a lock?
There is no sample library, however the location event is documented. The code in Tracker Edge for buildWpsInfo shows how the Wi-Fi data is built. That function should work on M-SoM, but remove the calls to turn on and off Wi-Fi since it should be left on on the M-SoM so connection management works properly.
To include tower information, instead of using the TrackerCellular method in Tracker Edge, you should use Cellular global identity and only include the serving cell.
Thanks @rickkas7
Looks like the link to âlocation eventâ doc is not working. Hoping that is where I can see how exactly I can take the wifi-data and cell data collected from the other two links and pass it to Particle to generate location ehanced data?
I fixed the link.
Thanks again @rickkas7 !
Ok I think I am starting to finally get the process, but please bear with me on a few more clarifications:
Now that I created this json, I guess I call Particle.publish - is the event name here âlocâ or âloc-enhancedâ?
Then how do I receive the results back in the firmware once I publish this? Do I do a Particle subscribe to something else to receive it?
One last thing- I noticed also mention of having to make sure we have location fusion enabled in our account - however I cannot find in my console where these settings are. My role is administrator, so it shouldnât be hidden. And based on documentation I read it should be under a Fleet Settings tab once I click devices and click my product. But I never see a Fleet Settings tab or any sort of settings tab besides the general âSettingsâ tab between âTeamâ and âWeb IDEâ
Very close.
towers array because the API only returns the serving cell. This is supported by location fusion.loc. If it has a lock then location fusion will not be done.trig.cmd should be just loc.@rickkas7 Ok I believe I have the json objects built out correctly, example:
data={"cmd":"loc","time":148325,"loc":{"lck":0},"towers":[{"mcc":310,"mnc":410,"lac":28682,"cid":211475727}],"req_id":1234567}
But I suspect my publish/subscribe are not correct - I donât know what to set their event names to. For publish i tried âlocâ initially then switched to âdeviceLocatorâ based on other code but neither of these calls seem to do anything - like if I go into the console and look at the device location there, it is not updated since couple weeks ago.
Then for subscribe to get the location fusion data back to the firmware what is the event name to subscribe there?
Publish the loc event. Subscribe to loc-enhanced.
I believe the device will need to be in a product, and you must enable location services for the product in order for it to work as well. You should be able to see the events in the console when viewing the product event stream.
@rickkas7 Awesome, thanks to your assistance I got it working now. I will attach the necessary code for reference if anyone else needs to do this (this code only does the cell tower data, wifi data can be used instead)
code to gather cell data and publish:
CellularGlobalIdentity cgi = {0};
cgi.size = sizeof(CellularGlobalIdentity); cgi.version = CGI_VERSION_LATEST; cellular_result_t res = cellular_global_identity(&cgi, NULL); Log.info("res=%d", res); if (res == SYSTEM_ERROR_NONE) { char data\[256\]; sprintf(data, "{\\"cmd\\":\\"%s\\",\\"time\\":%lu,\\"loc\\":{\\"lck\\":0},\\"towers\\":\[{\\"mcc\\":%d,\\"mnc\\":%d,\\"lac\\":%d,\\"cid\\":%lu}\],\\"req_id\\":%d}", "loc", millis(), cgi.mobile_country_code, cgi.mobile_network_code, cgi.location_area_code, cgi.cell_id, req_id++); Log.info("data=%s", data); Particle.publish("loc", data, PRIVATE);
In setup():
Particle.subscribe("loc-enhanced", locEnhancedEventHandler);
Callback function:
void locEnhancedEventHandler(const char* name, const char* data) {
Log.info("location enhanced event: %s data: %s", name, data ? data : "NULL");
}
you should see something like this when data is published:
[app] INFO: data={"cmd":"loc","time":382215,"loc":{"lck":0},"towers":[{"mcc":310,"mnc":410,"lac":28682,"cid":211475727}],"req_id":3}
And then receive a response like this:
[app] INFO: location enhanced event: loc-enhanced data: {"cmd":"loc","time":503028,"loc":{"lck":0,"time":503028,"lat":30.213769,"lon":-97.753806,"h_acc":894},"req_id":4,~
There is now a library to get neighboring cells on devices with Quectel cellular modems including the M404 and M524. See QuectelTowerRK. This functionality was already built into Tracker Edge and Monitor Edge, but this library works on non-Tracker devices.
Oh thank you @rickkas7 !
I actually have been in communication with someone at Particle via emails and they pointed me to a similar library and I have since done my own AT+QENG="neighbourcell" calls and parse the response.
The new problem now is - how do I utilize this neighbor cell data in the loc event json data in order for Particleâs location fusion to use the extra towers to triangulate a position?
It seems like I should only need to send the ânidâ property set to the PCI value returned by the AT query, and perhaps also âstrâ property set to the RSSI value. However in practice, it seems to have no effect to the location fusion. I even tried adding the mcc/mnc/cid properties to the extra towers as well, to no effect. Basically the loc-enhanced event I am getting back is still just the exact GPS coords of the serving tower, and the h-acc is like 900 meters- so essentially the entire radius of the serving tower.
Do you have any idea how exactly to structure the towers array so that location fusion takes the serving cell & neigbors to triangulate a position?
The library I posted produces the same JSON as Tracker Edge. I'll have some more information in a week or two and another library that does the rest of the location fusion support for non-Tracker devices.
@rickkas7 Oh yes, I didnât catch that- i see it now! Looks like the only thing it adds that I didnât consider is the âchâ prop - I will try that out! Thanks!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.