如何开发一个GPS应用程序(1)

2010-08-28 10:49:52来源:西部e网作者:

How to Write a GPS Application - Introduction

Introduction

In part one of this article, I described how to write an interpreter for raw GPS NMEA data. The article included source code in VB.NET which harnessed the power of GPS satellites to determine the current location, synchronize the computer clock to atomic time, and point to a satellite on a cloudy day. The interpreter also works with hand-held devices and supports international developers. Yet, the interpreter was really not suitable for commercial use because it did not monitor precision. Without precision, an application could end up making unintelligent business decisions such as accidentally telling a driver to turn left into an alley, or worse. In this second part, I'll cover precision in detail and talk about what it takes to make GPS applications smart enough for in-car navigation and reliable enough for commercial use.

Causes of Precision Error

There are several phenomenon which can cause poor precision. For example, when satellite radio signals are transmitted, they are distorted by the troposphere and especially the ionosphere. In fact, satellites very low on the horizon are not good for getting a fix because the signals travel through so much of the atmosphere. Some GPS devices may even exclude these satellites from a fix to avoid the precision problems they would cause.

Figure 2-1: Satellite 1's radio signal travels through less of the atmosphere, resulting in less distortion. Satellite 2 is low on the horizon, however, resulting in significant atmospheric distortion.

Fortunately, atmospheric distortion can be measured and corrected for the most part. This is achieved by the use of GPS ground stations, fixed locations which constantly measure distortions in satellite radio signals. Calculated corrections are then broadcasted by radio which, when combined with the actual satellite signal, gives a GPS receiver the ability to correct distortions in real-time.

Figure 2-2: Distortions in radio signals are corrected by combining satellite signals (1 and 2) with correction information transmitted via DGPS ground stations (3 and 4).

Precision errors can be compounded by slight inaccuracies in each satellite's “ephemeris”. Ephemeris is a table giving the coordinates of a celestial body over time. If the satellite's actual course deviates from its ephemeris, precision can be further diluted. This sort of error can only be corrected by firing small rockets on the satellites themselves. Adjustments are transmitted from the GPS Master Control Station at Schriever Air Force Base in Colorado Springs, Colorado.

Figure 2-3: Deviations in a satellite's actual orbit path can also cause loss in precision.

As I covered in Part One of this article, each GPS satellite has four on-board atomic clocks: two cesium atomic clocks and two rubidium atomic clocks which are accurate to 1 second per 300,000 years! Still, even microfractions of a second error in these clocks can cause positional error because distance is measured at the speed of light. The Master Control Station keeps these errors at a minimum by uploading corrective information to satellites twice a day, every day.

The last detriment to GPS precision is an effect called "multipath", which is an effect caused when a receiver receives not only the satellite's signal, but additional signals which bounced off buildings and other obstacles. Deflected signals take a longer path to the receiver and are thus delayed. If they are used by the receiver, the measured distance to a satellite is overestimated, resulting in inaccurate multilateration. More advanced receivers solve multipath problems by utilizing only the first signal detected (which is the most direct path from the satellite), then discarding any delayed signals.

Figure 2-4: A receiver is confused by "multipath", where several reflected signals are received (red) along with the direct radio signal (green).

Solving all of these precision problems is done by using more sophisticated GPS receivers which use real-time correction data such as WAAS (for North America) and EGNOS (for Europe). Yet, these problems cause relatively small inaccuracies when compared with Geometric Dilution of Precision, which can cause a receiver to be inaccurate by more than an American football field. Fortunately, Geometric DOP is the easiest to manage with the right programming techniques.

Geometric Dilution of Precision

GPS devices calculate your position using a technique called “3-D multilateration”, which is the process of figuring out where several spheres intersect. In the case of GPS, each sphere has a satellite at its center; the radius of the sphere is the calculated distance from the satellite to the GPS device. Ideally, these spheres would intersect at exactly one point, causing there to be only one possible solution to the current location, but in reality, the intersection forms more of an oddly-shaped area. The device could be located within any point in the area, forcing devices to choose from many possibilities. Figure 2-4 shows such an area created from three satellites (using part one's $GPGSV sentence). The current location could be any point within the gray-colored area. Precision is said to be “diluted” when the area grows larger, which leads to this article's focus: dilution of precision. The monitoring and control of dilution of precision (or DOP for short) is the key to writing high-precision applications.

Figure 2-5: GPS devices must choose one of several possible solutions to the current location.

DOP values are reported in three types of measurements: horizontal, vertical, and mean. Horizontal DOP (or HDOP) measures DOP as it relates to latitude and longitude. Vertical DOP (or VDOP) measures precision as it relates to altitude. Mean DOP, also known as Position DOP (PDOP), gives an overall rating of precision for latitude, longitude and altitude. Each DOP value is reported as a number between one and fifty where fifty represents very poor precision and one represents ideal accuracy. Table 2-1 lists what I believe to be an accurate breakdown of DOP values.

DOP Rating Description
1 Ideal This is the highest possible confidence level to be used for applications demanding the highest possible precision at all times.
2-3 Excellent At this confidence level, positional measurements are considered accurate enough to meet all but the most sensitive applications.
4-6 Good Represents a level that marks the minimum appropriate for making business decisions. Positional measurements could be used to make reliable in-route navigation suggestions to the user.
7-8 Moderate Positional measurements could be used for calculations, but the fix quality could still be improved. A more open view of the sky is recommended.
9-20 Fair Represents a low confidence level. Positional measurements should be discarded or used only to indicate a very rough estimate of the current location.
21-50 Poor At this level, measurements are inaccurate by as much as half a football field and should be discarded.

Table 2-1: Jon's interpretation of dilution of precision values.

Looking again at figure 2-4, three satellites created a large area of possible solutions. This situation could be improved by two factors: adding more satellites to the fix, and using satellites evenly distributed throughout the sky. What would figure 2-4 look like if the situation was improved like this? Figure 2-5 shows figure 2-4 after three more evenly-distributed satellites have been added.

Figure 2-6: Three more evenly-distributed satellites are added to figure 2-4, creating a high-precision environment where dilution of precision is low.

 

Jon Person is the author of the award-winning “GPS.NET Global Positioning SDK” component and has consulted for military companies and the Forest Service on GPS solutions. He welcomes any questions or comments at info@gpsdotnet.com.

原文:http://www.developerfusion.co.uk/show/4634/

关键词:GPS

赞助商链接: