RAKWireless / LPWAN-Tracker-Solution

LPWAN Tracker Solution "Built with RAK's WisBlock"
12 stars 6 forks source link

Latitude always returns as "0"? - ArduinoIDE version with Chirpstack decoder #1

Open dvisser opened 1 year ago

dvisser commented 1 year ago

I have deployed this solution using the ArduinoIDE version and used the chirpstack decoder, however the returned gps latitude is always "0" whilst longitude appears correct. Please can this issue be addresses? All other functionality appears to be working correctly.

dvisser commented 1 year ago

I skimmed the code and it doesnt appear obvious at first glance. I am using Wisblock 2 kit also (RAK1900 GPS module, so it uses the TinyGPSPlus library).

@beegee-tokyo what do you think?

beegee-tokyo commented 1 year ago

I guess you are using the latest code from this repo. What payload decoder are you using in Chirpstack? I was testing with our RAKwireless_Standardized_Payload.

Just run a test and it works as expected.

BLE Log:

10:44:48->GNSS Task wake up
10:44:48->
10:44:48->+EVT:START_LOCATION
10:44:48->poll_gnss
10:44:48->
10:44:48->GNSS timeout 90000
10:44:48->
10:44:48->Using RAK1910
10:44:48->
10:45:23->Location valid
10:45:23->
10:45:23->Location valid
10:45:23->
10:45:23->Altitude valid
10:45:23->
10:45:23->Lat: 14.4214 Lon: 121.0069
10:45:23->
10:45:23->Alt: 55.30
10:45:23->
10:45:23->Acy: 99.99
10:45:23->
10:45:23->+EVT:LOCATION FIX
10:45:23->GNSS Task finished
10:45:23->
10:45:28->Packet enqueued
10:45:28->
10:45:31->LPWAN TX cycle finished ACK
10:45:31->
10:45:31->+EVT:SEND OK

Output in Chirpstack: image

dvisser commented 1 year ago

Yes I am using the latest code. However, I used the chirpstack decoder from the decoder folder and not the one you mentioned.

I will try the decoder you suggest on Monday and advise.

Thankyou for the prompt response.

dvisser commented 1 year ago

Hi @beegee-tokyo I had to modify the decoder you mention slightly such that it would work with latest chirpstack version (decodeUplink method with input and requirement to return 'data').

See below output, as latitude is still reading 0.

function decodeUplink(input) {

    bytes = input.bytes;
    fPort = input.fPort;

    // flat output (like original decoder):
    var response = {};
    lppDecode(bytes, 1).forEach(function (field) {
        response[field['name'] + '_' + field['channel']] = field['value'];
    });

    return {
       data: {
           response
         }
     }; 
}

image

dvisser commented 1 year ago

I have also set "AT+GNSS=1" as well if that helps?

beegee-tokyo commented 1 year ago

What do you get in the direct log output of the device? Like what I showed in my test:

10:44:48->Using RAK1910
10:44:48->
10:45:23->Location valid
10:45:23->
10:45:23->Location valid
10:45:23->
10:45:23->Altitude valid
10:45:23->
10:45:23->Lat: 14.4214 Lon: 121.0069
10:45:23->
10:45:23->Alt: 55.30
10:45:23->
10:45:23->Acy: 99.99
10:45:23->

You can get this through USB and it should be as well available on BLE UART connection.

dvisser commented 1 year ago

OK so firmware confirmed to be 1.1.2 Jan 17 2023 13:24:19

I also tried your RAKwireless_Standardized_Payload decoder.

I am still getting latitude of 0, as well as on the local log output of the device via USB, I will screenshot a copy of the output for you.

dvisser commented 1 year ago

gps screenshot

beegee-tokyo commented 1 year ago

That is strange, I know there was a problem with negative lat/long values before, but that was solved.

What is the latitude that you would expect to get? Do you have by any chance another RAK1910 module that you could try to use?

dvisser commented 1 year ago

I have six wisblock kits here all doing the same thing.

beegee-tokyo commented 1 year ago

So what is the expected latitude?

Testing here with the latest firmware version works fine.

dvisser commented 1 year ago

approx -24.4428XX

beegee-tokyo commented 1 year ago

You are testing outside of a building or inside? I cannot find any problem and the negative latitude should be no problem. RAK members in South America tested it and they are on negative lat and negative long.

dvisser commented 1 year ago

I am outside

beegee-tokyo commented 1 year ago

I have honestly no idea what happens. I cannot see any problem when testing here. Can you try our very simple RAK1910 example code? But it requires a laptop connected to see the output. RAK1910_GPS_UBLOX7

dvisser commented 1 year ago

I tried your test on the same wisblock unit, and it seems to work. I believe there is an issue in your lpwan tracker code now. gps test results

dvisser commented 1 year ago

The test code reads the latitude perfectly.

dvisser commented 1 year ago

image

Still outputting Latitude as 0. I built from source using PlatformIO.

There has to be a bug in the LPWAN Tracker code, as the RAK1910_GPS_UBLOX7 test was successful.

beegee-tokyo commented 1 year ago

The only relevant difference I can see between the _RAK1910_GPS_UBLOX7.ino and the LPWAN-Tracker-Solution.ino_ is the used library. The first one uses the TinyGPS library, the second one the TinyGPSPlus library.

Can you check which version of the TinyGPSPlus library you have installed. My TinyGPSPlus library is version 1.0.3 which seems to be the latest.

Can you try to flash this UF2 file on your tracker? This is the code that I am using and I don't see your problem with it. WisBlock_LPWAN_Tracker_V1.1.2_2023.05.02.10.47.05.uf2.zip

beegee-tokyo commented 1 year ago

I guess you know how to flash the UF2 file, but just in case:

dvisser commented 1 year ago

The only relevant difference I can see between the _RAK1910_GPS_UBLOX7.ino and the LPWAN-Tracker-Solution.ino_ is the used library. The first one uses the TinyGPS library, the second one the TinyGPSPlus library.

Can you check which version of the TinyGPSPlus library you have installed. My TinyGPSPlus library is version 1.0.3 which seems to be the latest.

Can you try to flash this UF2 file on your tracker? This is the code that I am using and I don't see your problem with it. WisBlock_LPWAN_Tracker_V1.1.2_2023.05.02.10.47.05.uf2.zip

Thanks, I am testing this now, will report back shortly.

dvisser commented 1 year ago

No change, I am still seeing latitude as 0 with your UF2 file.

beegee-tokyo commented 1 year ago

Still no idea why it does not work for you. This code is for the RAK10700 which uses the RAK12500 GNSS module, not the RAK1910. So I created a test version that runs with a different library for the RAK1910, but as I didn't see the problem before, I am not sure whether it changes anything.

Can you give it a try? WisBlock_LPWAN_Tracker_V1.1.3_2023.05.15.14.35.13.uf2.zip

beegee-tokyo commented 1 year ago

@dvisser I made a mistake in the altitude. The old library was returning meters, the new one is returning centimeter.

Please use this version: WisBlock_LPWAN_Tracker_V1.1.3_2023.05.15.15.04.55.uf2.zip

dvisser commented 1 year ago

@dvisser I made a mistake in the altitude. The old library was returning meters, the new one is returning centimeter.

Please use this version: WisBlock_LPWAN_Tracker_V1.1.3_2023.05.15.15.04.55.uf2.zip

OK I will test now and report back ASAP

dvisser commented 1 year ago

image Latitude still reading 0. I don't understand!

beegee-tokyo commented 1 year ago

I changed the code to use the library that is used in the RAK1910_GPS_UBLOX7 example that you tried before.

I have no more ideas. It simply works with both libraries for me.

beegee-tokyo commented 1 year ago

I was running the app with fake coordinates with all possible negative/positive lat/Long combinations and it works. so everything after reading the data from the GPS library is ok.

I have no idea why you get 0 as latitude.

image