Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

event.altitude and event.speed returning wrong values
Started by katie.deely Jul 11 2016 04:50 AM

2 replies to this topic
gps accelerometer altitude event location speed

Best Answer Rob Miracle , 11 July 2016 - 06:50 AM

As far as speed goes, I don't know if the GPS is accurate enough to track walking speeds, if you're just walking around your house. Elevation should change if you change floors. There is also a second issue, if you're testing inside a building you may be getting location services from a local WiFI router instead of the GPS. It can take a couple of minutes for the device to lock onto GPS signals and being inside makes it harder.

 

As far as posting code, click on the blue <> button in the row with Bold, Italics, etc. and use Copy/Paste to show code. i.e. in your editor CTRL-A CTRL-C (CMD-A, CMD-C on a Mac) then click the <> button and then CTRL-V (CMD-V) to paste the code into the window that pops up.

 

Rob

[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

katie.deely

[GLOBAL: userInfoPane.html]
katie.deely
  • Observer

  • 4 posts
  • Corona SDK

Hi there :D

 

I'm just learning to work with the Corona SDK and stumbled across the location (GPS) section. With some help from the examples I got something running, but there are some small problems...

 

The event.altitude should return something between 1000 and 1050. That works right after starting the app, but after a few seconds it goes to zero and stays there. When I "minimise" the app and re-open it again, it works for a few seconds, just to go to zero again.

 

The event.speed is permanently at zero as well. I did the maths and turned it to millimetres/second, kilometres/hour, and a few others. It stays always exactly 0.0000 though... Sometimes I get a negative value (which is always -1 m/s or the equivalent in other units), but that is an error according to the reference.

 

My device is a Sony Xperia Z1 compact with Android 5.1.1 and I code on an ASUS R752M with windows 8.1 if that matters.

 

Is there any way to get those two working properly?

 

The build.settings and main.lua can be found on pastebin, because I'm not permitted to upload them here.

 

Thanks!

 

 



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,075 posts
  • Enterprise

  Best Answer

As far as speed goes, I don't know if the GPS is accurate enough to track walking speeds, if you're just walking around your house. Elevation should change if you change floors. There is also a second issue, if you're testing inside a building you may be getting location services from a local WiFI router instead of the GPS. It can take a couple of minutes for the device to lock onto GPS signals and being inside makes it harder.

 

As far as posting code, click on the blue <> button in the row with Bold, Italics, etc. and use Copy/Paste to show code. i.e. in your editor CTRL-A CTRL-C (CMD-A, CMD-C on a Mac) then click the <> button and then CTRL-V (CMD-V) to paste the code into the window that pops up.

 

Rob



[TOPIC: post.html]
#3

katie.deely

[GLOBAL: userInfoPane.html]
katie.deely
  • Observer

  • 4 posts
  • Corona SDK

Oh, okay :) I thought I made a mistake somewhere in my code and screwed the results up. Good to know that it's rather my phone's, router's and satellites' fault :D thanks ^^




[topic_controls]
[/topic_controls]