For those who struggling from limited floating points accuracy during GPS tracking in Unity Engine.
Accura GPS – double precision GPS which opens full power of Device Location Processor.
Available on the Asset Store.
Super lightweight. Compatible with latest Unity. Usable from C# API.
Retrieve precise location data; precise altitude data; accuracy in meters;
Supported platforms: IOS / Android
1. Is this plugin works for me?
2. Which platforms are supported?
Current supported platforms are IOS and Android.
3. Which package size is?
It is 7.0 MB including Demo Scene and Documentation.
4. What iOS settings do I set to allow the app to track in the background?
It should be set automatically. But in case you have any trouble:
You must enable these iOS settings. Open the tracked iOS device. Go to Settings -> Your App and make sure the following settings.
Motion & Fitness: enable
Background App Refresh: enable
Use Cellular Data: enable Also in the package there is a special function: AskPermission() for IOS.
5. What Android settings do I set to allow the app to track in the background?
It should be set automatically. But in case you have any trouble:
Location service is required to enabled in the tracked device. Otherwise, the your mobile app cannot track. To enable location service, go to Settings -> Location. Enable it and set the mode to “High Accuracy”.
For Android v6.0 or later, you should make sure that location permission is granted for the app. Go to Settings -> Apps -> Your App -> Permissions. Make sure that location is enabled.
Also in the package there is a special function: AskPermission() for Android which triggers Unity functionality to do this.
6. How GPS Works?
Here’s how GPS works in six logical steps:
- The basis of GPS is “triangulation” from satellites.
- To “triangulate,” a GPS receiver measures distance using the travel time of radio signals.
- To measure travel time, GPS needs very accurate timing which it achieves with some tricks.
- Along with distance, you need to know exactly where the satellites are in space. High orbits and careful monitoring are the secret.
- You must correct for any delays the signal experiences as it travels through the atmosphere.
- Finally (for us), you can now obtain the precise time from the GPS satellites.
We’ll explain each of these points in subsequent sections.
Improbable as it may seem, the whole idea behind GPS is to use satellites in space as reference points for locations here on earth.
That’s right, by very, very accurately measuring our distance from three satellites we can “triangulate” our position anywhere on earth.
Forget for a moment how our receiver measures this distance. We’ll get to that later. First consider how distance measurements from three satellites can pinpoint you in space.
7. What is Triangulation?
- Position is calculated from distance measurements (ranges) to satellites.
- Mathematically we need four satellite ranges to determine exact position.
- Three ranges are enough if we reject ridiculous answers or use other tricks.
- Another range is required for technical reasons to be discussed later.
8. What is the Geometry?
Suppose we measure our distance from a satellite and find it to be 10,000 miles.
Knowing that we’re 10,000 miles from a particular satellite narrows down all the possible locations we could be in the whole universe to the surface of a sphere that is centered on this satellite and has a radius of 10,000 miles
Next, say we measure our distance to a second satellite and find out that it’s 11,000 miles away.
That tells us that we’re not only on the first sphere but we’re also on a sphere that’s 11,000 miles from the second satellite. Or in other words, we’re somewhere on the circle where these two spheres intersect.
If we then make a measurement from a third satellite and find that we’re 12,000 miles from that one, that narrows our position down even further, to the two points where the 12,000 mile sphere cuts through the circle that’s the intersection of the first two spheres.
So by ranging from three satellites we can narrow our position to just two points in space. This arrangement of satellites is also called a “constellation”.
To decide which one is our true location we could make a fourth measurement. But usually one of the two points is a ridiculous answer (either too far from Earth or moving at an impossible velocity) and can be rejected without a measurement.
A fourth measurement does come in very handy for another reason however, but we’ll tell you about that later.
Next we’ll see how the system measures distances to satellites.
9. How Measuring Distance Works?
- Distance to a satellite is determined by measuring how long a radio signal takes to reach us from that satellite.
- To make the measurement we assume that both the satellite and our receiver are generating the same pseudo-random codes at exactly the same time.
- By comparing how late the satellite’s pseudo-random code appears compared to our receiver’s code, we determine how long it took to reach us.
- Multiply that travel time by the speed of light and you’ve got distance.
We saw in the last section that a position is calculated from distance measurements to at least three satellites.
But how can you measure the distance to something that’s floating around in space? We do it by timing how long it takes for a signal sent from the satellite to arrive at our receiver.
10. What is the Math behind it?
In a sense, the whole thing boils down to those “velocity times travel time” math problems we did in high school. Remember the old: “If a car goes 60 miles per hour for two hours, how far does it travel?”
Velocity (60 mph) x Time (2 hours) = Distance (120 miles)
In the case of GPS we’re measuring a radio signal so the velocity is going to be the speed of light or roughly 186,000 miles per second.
The problem is measuring the travel time
The timing problem is tricky. First, the times are going to be awfully short. If a satellite were right overhead the travel time would be something like 0.06 seconds. So we’re going to need some really precise clocks. We’ll talk about those soon.
But assuming we have precise clocks, how do we measure travel time? To explain it let’s use a goofy analogy:
Suppose there was a way to get both the satellite and the receiver to start playing “Stairway to Heaven” at precisely 12 noon. If sound could reach us from space then standing at the receiver we’d hear two versions of the ‘Stairway to Heaven’, one from our receiver and one from the satellite.
These two versions would be out of sync. The version coming from the satellite would be a little delayed because it had to travel more than 11,000 miles.
If we wanted to see just how delayed the satellite’s version was, we could start delaying the receiver’s version until they fell into perfect sync.
The amount we have to shift back the receiver’s version is equal to the travel time of the satellite’s version. So we just multiply that time times the speed of light and voila! we’ve got our distance to the satellite.
That’s basically how GPS works.
Only instead of ‘Stairway to Heaven’ the satellites and receivers use something called a “Pseudo Random Code” – which is probably quicker to sing than ‘Stairway to Heaven’.
11. What’s about Timekeeping?
Although GPS is well-known for navigation, tracking, and mapping, it’s also used to disseminate precise time, time intervals, and frequency. Time is a powerful commodity, and exact time is more powerful still. Knowing that a group of timed events is perfectly synchronized is often very important. GPS makes the job of synchronizing our clocks easy and reliable.
There are three fundamental ways we use time. As a universal marker, time tells us when things happened or when they will. As a way to synchronize people, events, even other types of signals, time helps keep the world on schedule. And as a way to tell how long things last, time provides and accurate, unambiguous sense of duration.
GPS satellites carry highly accurate atomic clocks. And in order for the system to work, our GPS receivers here on the ground synchronize themselves to these clocks. That means that every GPS receiver is, in essence, an atomic accuracy clock.
Astronomers, power companies, computer networks, communications systems, banks, and radio and television stations can benefit from this precise timing. One investment banking firm uses GPS to guarantee their transactions are recorded simultaneously at all offices around the world. And a major Pacific Northwest utility company makes sure their power is distributed at just the right time along their thousands of miles of transmission lines.
We hope you’ve enjoyed our brief discussion about the technology behind GPS.
Good luck and have a Happy coding,
Sincerely yours GigaNeo.