GPS speed
Posted: Sun Apr 28, 2013 2:36 pm
I’m just experimenting with the mobile gps functions and I’ve hit a problem in getting the “speed” from the Location data.
The code is basically as follows:
I’m running LC6 and in the simulator (version 5 and later) this all seams to work OK and all the fields are filled in with the data from the above.
However, when I try it on a real device, everything works apart from the speed, which remains blank. The horizontal accuracy figure is quite poor on the real device where I’ve tested it (65m). I don’t know whether this is causing the problem or whether it’s something wrong with the coding, or whether LC doesn't get the "speed".
I’ve read about the “speed” not being obtainable with LC but I can’t find any reference to this in the release notes for version 6.0. That doesn’t sound like its the problem though if it works OK in the simulator?
I did get it to work by calculating the distance from the latitude / longitude values and dividing it by the time, but I though if I could get the “speed” directly that would be much better.
Any ideas on what could be wrong??
The code is basically as follows:
Code: Select all
mobileStartTrackingSensor "location", true
put mobileSensorReading ("location",true) into geodata
put geodata["latitude"] into tlat
put geodata["longitude"] into tlong
put geodata["horizontal accuracy"] into tHA
put geodata["altitude"] into tAlt
put geodata["vertical accuracy"] into tVA
put geodata["timestamp"] into ttime
put geodata["speed"] into tspeed
However, when I try it on a real device, everything works apart from the speed, which remains blank. The horizontal accuracy figure is quite poor on the real device where I’ve tested it (65m). I don’t know whether this is causing the problem or whether it’s something wrong with the coding, or whether LC doesn't get the "speed".
I’ve read about the “speed” not being obtainable with LC but I can’t find any reference to this in the release notes for version 6.0. That doesn’t sound like its the problem though if it works OK in the simulator?
I did get it to work by calculating the distance from the latitude / longitude values and dividing it by the time, but I though if I could get the “speed” directly that would be much better.
Any ideas on what could be wrong??