GPS SPEED

190 views
Skip to first unread message

Esmael Nastroga

unread,
Nov 4, 2019, 8:23:18 AM11/4/19
to MIT App Inventor Forum
error in speed values received by gps, someone was able to use accurately?

TimAI2

unread,
Nov 4, 2019, 8:40:34 AM11/4/19
to MIT App Inventor Forum
GPS will generally return new values @ every 30 seconds, if it has a good fix on three satellites then the returned position will be within a few metres

SteveJG

unread,
Nov 4, 2019, 8:42:58 AM11/4/19
to MIT App Inventor Forum
Error?  What do you mean Esmael? The speed value works fine.    
Do you understand how a GPS receiver works and how the LocationSensor can determine speed?  To understand why you see what happens, a reading of this tutorial  Using the Location Sensor
   will help you understand.

A calculation of speed  when using the speed property requires that the LocationSensor capture two separate satellite fixes and two LocationChanged events.  The sensor cannot calculate instantaneous velocity.  It has to have a history of at least two points. 

 LocationChanged(number latitude, number longitude, number altitude, number speed)
Indicates that a new location has been detected. 

Called when the Android device reports a new location.


speed units - the LocationSensor reports speed in m/sec units), convert to km/hr if you want speed in kilometers (1000 meters) and also be aware m/sec must be addressed to convert kilometers/hour.  m/sec * km/1000m * 60 sec/min * 60 min/hour = km/hour .

Speed has a second component, the TimeInterval ... how frequently you update the LocationSensor to determine a satellite fix.  The initial satellite fix usually takes about 30-40 seconds; subsequent fixes dependent on factors discussed in the tutorial takes at least 10 to 20 seconds and how good a GPS receiver is in your Android, so it makes little sense to set the TimeInteral to less than about 20000 ms (20 seconds).  This means, the speed will update at the best, every 20 seconds if even that.

Does this information help?


Regards,

Steve


Reply all
Reply to author
Forward
0 new messages