Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dvisser opened this issue Mar 30, 2023 · 28 comments

Comments

@dvisser
Copy link

dvisser commented Mar 30, 2023

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
Copy link
Author

dvisser commented Mar 30, 2023

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
Copy link
Contributor

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
Copy link
Author

dvisser commented Mar 30, 2023

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
Copy link
Author

dvisser commented Apr 2, 2023

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
Copy link
Author

dvisser commented Apr 2, 2023

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

@beegee-tokyo
Copy link
Contributor

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
Copy link
Author

dvisser commented May 8, 2023

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
Copy link
Author

dvisser commented May 8, 2023

gps screenshot

@beegee-tokyo
Copy link
Contributor

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
Copy link
Author

dvisser commented May 8, 2023

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

@beegee-tokyo
Copy link
Contributor

So what is the expected latitude?

Testing here with the latest firmware version works fine.

@dvisser
Copy link
Author

dvisser commented May 8, 2023

approx -24.4428XX

@beegee-tokyo
Copy link
Contributor

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
Copy link
Author

dvisser commented May 8, 2023

I am outside

@beegee-tokyo
Copy link
Contributor

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
Copy link
Author

dvisser commented May 8, 2023

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
Copy link
Author

dvisser commented May 8, 2023

The test code reads the latitude perfectly.

@dvisser
Copy link
Author

dvisser commented May 9, 2023

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
Copy link
Contributor

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
Copy link
Contributor

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

  • Unzip the file, so that you have the UF2 file in a folder
  • connect the WisBlock and double-push reset to force bootloader UF2 mode. There will be a new external drive called RAK4631
  • drag the UF2 file to the new drive and it will be flashed on the RAK4631

@dvisser
Copy link
Author

dvisser commented May 10, 2023

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
Copy link
Author

dvisser commented May 10, 2023

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

@beegee-tokyo
Copy link
Contributor

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
Copy link
Contributor

@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
Copy link
Author

dvisser commented May 15, 2023

@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
Copy link
Author

dvisser commented May 15, 2023

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

@beegee-tokyo
Copy link
Contributor

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
Copy link
Contributor

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

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

No branches or pull requests

2 participants