Hi i have one small problem.
I wrote an app in which i log lat,long and alt from gps.
Long and lat is quite ok but altitude is at the start more than 60m above correct one ( correct is ~275 but shows ~345).
During first 1-2 minutes of logging altitude is constantly getting lower and lower till it shows correct one ( 345-> 344 -> ....-> 275->275 and so on).
Can anyone explain it to me why altitude is getting better during the time and after some time it shows good altitude during rest of the walk/ride?
" it shows good altitude during rest of the walk/ride?"
I doubt that altitude is good on the rest of your ride.
altitude via GPS is known to be not very usefull. The error is about twice that of horicontal (lat,lon) error. Thats the reason why professional navigation devices additionally use a barometer sensor instead of GPS altitude alone.
The reason why it gets better, is that the averaging algorithm had more time to average the errors out. On my ios devcie and i my app, the altitude jumps so much that it shows some hundreds meters ascending / descending even when I am moving level at a lake.
But you always can check the value of vertical accuracy. Use the altitude only when it gets below 30m vert. accuracy.
In order to get accurate coordinates, a GPS system should listen to at least 4 sattelites of the GPS constellation. Also, those sattelites broadcast messages that are 30 seconds long.
Since most users nowadays have some level of ADHD, a 30 seconds time to get the first fix (and a further 30 seconds more for every other fix after that) would make many project managers and device designers scream. They also want your cell phone to divine where you are even with only two or three sattelites in view - theoretically possible, but you get results with poor accuracy doing that. With three sattelites you can get an approximation, but with only two you're no better than if you were using a compass and an astrolabe.
So that's what happens: your device doesn't wait to get the whole message from the sattelites, and keeps approaching a more accurate result as more and more of the GPS message pours through. After a while, some time after the first few messages, it gets the correct fix and its stops trying to guess your coordinates.
Related
I am in need to develop an android app where the device will track the distance traveled while the user is in a moving vehicle. I am getting the GPS values at small interval so that I can retrieve the distance and sum them up. But the problem I am facing is, while the user is in the vehicle, the device is not getting a clear view of the sky. Hence, the GPS device cannot get values as frequently as I desire. Thus, the result produced contains huge fluctuations. I tried using the network provider, but that is even worse in this scenario.
It would be very much helpful if anyone can suggest me a solution to this problem.
Just put the receiver onto the inner side of the windshield, like all navigation systems do. This should give an acuracy of about 3-6m. (when SBAS correction is available in your location) or up to 10m if not.
If the receiver is not state of the art (combined GPS + GLONASS or BEIDOU) then you will have problem in cities, especially in urban canyons with location jumps up to 30m.
This is normal. To get correct result for a GPS application within a city you need advanced algorithms. Just summing up the distance between two consecutive locations is to primitive, this never works well. Distance calculation by GPS has be answered some times her at SO. Use the search engine, to get more info at that topic.
Of course, set the device to GPS provider only, with maximum precision.
I have a question regarding my programming approach for android - whether it's efficient or not. Just to give you an idea what I try to accomplish:
There are multiple points of interests on a map. If the user gets nearer to a PIT, a notification about the distance shall appear. There are let's say 3 notifications: At a distance of 1 mile, 0.5 miles and 0.1 mile. When the user is more or less exactly at the PIT, no more notifications are shown. The user is supposed to drive a car or another vehicle.
I'm currently using Geofences to detect whether the user has entered a radius of 1 mile. If so, I check the distance of his current location to the PIT. If it's about 0.5 or 0.1 miles away, a notification is fired. Therefore, I check the current location frequently (right now every 10 seconds). If the user is like at the PIT or rather very close, the Geofence is exited and done.
The code is working fine and this approach is the first thing that came to my mind while reading the Android Developer's tutorials etc. But is there another approach that is MORE EFFICIENT?
Although this is (currently) meeting my needs, I have two major concerns:
It seems to drain the battery quite a lot. Since the user is most likely to be in a car where he can charge his phone during usage, this might be less of a problem.
I read the number of PITs from a file on the SD card. In my example I have just a few PITs. But the user is able to modify the source data so that he can add as many as he wants to. Google says that only 100 active Geofences are supported per user. But what if my user has more than 100 PITs? Since I'm using a Geofence to sense whether I have to fire the first notification or not - this is a severe problem. So is there an alternative?
I have a few suggestions :
1) To lower the amount of gps fixes, you could calculate a sleep time. The idea is to do frequent gps fixes when near a 'border' and few when far away. This could be further enhanced by taking the speed parameter returned by the GPS into account.
If for instance the user is 20 miles from the nearest border while driving 20mph, you can easily wait 30 minutes before turning on the gps again, just to give a simple example.
2) I have run in to the same problem. My solution was simply to select only the POI's within X miles. This way ensuring never to risk hitting the limit of 100. When the user has moved (X-1) miles from his initial position, the geofences are rebuild using the new location.
If you think there is a high risk of having such a high density of points that the above strategy still might fall, I would consider making your own proximity checking entirely based on gps instead of geofences.
I am reading my coordinates every 20 seconds or 10 meters an displaying them with a Toast. At the same time I read the GPS values from the notifications panel in the system bar. The values are not the same.
Altitude is in my program always around 560 metres and in the notifications panel 430 (430 is correct). I get similar errors with lat. and long. The error is not due to difference in time. The Toast shows the values onLocationChange. I used the code based on this project and rely only on the GPS sensor.
Why is this so? Does anybody know why I'm getting different values?
I am developing an app, where I need (GPS) coordinates every couple of seconds, unfortunately the GPS uses a lot of battery.
Is it possible to get a good estimated position (including altitude) based on the last GPS position(s) and motion sensors from an Android smartphone, for let's say 1 minute?
What algorithms would I need to look into?
This does not work with GPS.
The GPS chip has to track the sattelites all the time, so it makes no difference for battery consumption if you get once a minute or once a second.
Things changes when you only need a position evry 5 minutes, then it could make sense to stop location service, and restart again. (but even that is only a vague estimation).
Finally you have to measure which intervall really saves battery.
bye the way: i can record 8 hours of gps with one fix per second, on iphone 4
I made a simple GPS. app. for android, storing the route coordinates into file.
I'm confused, I got more onLocationChanged event when I stand in one place. The bearing and speed was zero of course in the Location when the event comes, but it Is interested, because I used 1 meter for minDistance when I registered the LocationListener. (the minTime was zero)
Are you sure that the values returned by getLatitude and getLongitude are identical to their previous values? Normal GPS is only accurate to within a meter or two, so it seems to me that random shifting of your location as perceived by your GPS sensor could be the problem.
You may be registering with more GPS satellites as your app runs and this may shift your position and reduce the error in all the times received from all the gps signals. Also, as you stand still position will become more and more accurate it is possible to get a gps signal accuracy down to cms see: http://atarist.home.xs4all.nl/geo/gps_accuracy.htm and wiki link on real time kinematic especially if you get a connection to a reference signal