GPS定位

Allen5G發表於2018-11-17

球面距離

      球面上兩點之間的最短連線的長度,就是經過這兩點的大圓在這兩點間的一段劣弧的長度(大圓就是經過球心的平面截球面所得的圓)。這個弧長叫做兩點的球面距離。

求法如下:

      設若角AOB(球心角)為θ,大球的半徑為R,A點維度、經度為(x1,y1),B點維度、經度為(x2,y2),則球面距離為Rθ。球面距離計算公式:d(x1,y1,x2,y2)=r*arccos(sin(x1)*sin(x2)+cos(x1)*cos(x2)*cos(y1-y2)) * Pi/180      // x,y是緯度\經度的角度單位,若x,y用弧度表示,比如sin(x1)需要修正為sin(x1*Pi/180),r 為地球半徑。

       這裡忽略地球表面地形對計算帶來的誤差,僅僅是理論上的估算值。按照0度經線的基準,東經取經度的正值(Longitude),西經取經度負值(-Longitude),北緯取90-維度值(90-Latitude),南緯取90+維度值(90+Latitude);假設都是北半球(南半球只有澳洲具有應用意義),可以僅對經度作正負處理,而不對維度作 90-Latitude。

地球的相關知識:

(1)形狀和大小:

       地球形狀是一個兩極部位略扁的不規則的球體。地球的平均半徑為6371千米,赤道半徑6378千米,極半徑6357千米。赤道周長約為4萬千米。

(2)緯線和緯度、經線和經度 

① 緯線:緯線都是圓,也稱為緯線圈,長度不等。赤道最長,由赤道向兩極逐漸縮短,最後成一點。緯線指向東西方向。

② 緯度:赤道是零度緯線。赤道以北的緯度,叫北緯,用“N”作代號;赤道以南的緯度叫南緯,用“S”作代號。北緯、南緯各有90°。

③ 經線:也叫子午線。經線是半圓,所有經線長相等。經線指向南北方向。

④ 經度:零度經線叫做本初子午線。本初子午線向東、向西各分作180度,以東的180°屬於東經,用“E”作代號;以西的180°屬於西經,用“W”作代號。(因為經線圈都過極點,所以就把經線圈,拆分成半圓,這樣就有了東經、西經的區分了;而維線圈相互之間沒有相交,所以即使是圓圈,同樣可以區分緯、緯)


全球定位系統組成部分

         GPS系統包括三大部分: 空間部分—GPS星座(GPS星座是由24顆衛星組成的星座,其中21顆是工作衛星,3顆是備份衛星);地面控制部分—地面監控系統;使用者裝置部分—GPS 訊號接收機。 

空間部分

        GPS的空間部分是由24 顆工作衛星組成,它位於距地表2_0200km的上空,均勻分佈在6 個軌道面上(每個軌道面4 顆) ,軌道傾角為55°。此外,還有4 顆有源備份衛星在軌執行。衛星的分佈使得在全球任何地方、任何時間都可觀測到4 顆以上的衛星,並能保持良好定位解算精度的幾何圖象。這就提供了在時間上連續的全球導航能力。GPS 衛星產生兩組電碼, 一組稱為C/A 碼( Coarse/ Acquisition Code1.023MHz) ;一組稱為P 碼(Procise Code 10.23MHz) ,P 碼因頻率較高,不易受干擾,定位精度高,因此受美國軍方管制,並設有密碼,一般民間無法解讀,主要為美國軍方服務。C/A 碼人為採取措施而刻意降低精度後,主要開放給民間使用。

定位原理

        GPS的基本定位原理是衛星不間斷地傳送自身的星曆引數和時間資訊,使用者接收到這些資訊後,經過計算求出接收機的三維位置,三維方向以及運動速度和時間資訊。

        當蘇聯發射了第一顆人造衛星後,美國約翰·霍布金斯大學應用物理實驗室的研究人員提出既然可以已知觀測站的位置知道衛星位置,那麼如果已知衛星位置,應該也能測量出接收者的所在位置。這是導航衛星的基本設想。GPS導航系統的基本原理是測量出已知位置的衛星到使用者接收機之間的距離,然後綜合多顆衛星的資料就可知道接收機的具體位置。要達到這一目的,衛星的位置可以根據星載時鐘所記錄的時間在衛星星曆中 查出。而使用者到衛星的距離則通過紀錄衛星訊號傳播到使用者所經歷的時間,再將其乘以光速得到(由於大氣層電離層的干擾,這一距離並不是使用者與衛星之間的真實距離,而是偽距(PR):當GPS衛星正常工作時,會不斷地用1和0二進位制碼元組成的偽隨機碼(簡稱偽碼)發射導航電文。GPS系統使用的偽碼一共有兩種,分別是民用的C/A碼和軍用的P(Y)碼。C/A碼頻率1.023MHz,重複週期一毫秒,碼間距1微秒,相當於300m;P碼頻率 10.23MHz,重複週期266.4天,碼間距0.1微秒,相當於30m。而Y碼是在P碼的基礎上形成的,保密效能更佳。導航電文包括衛星星曆、工作狀況、時鐘改正、電離層時延修正、大氣折射修正等資訊。

差分技術

        為了使民用的精確度提升,科學界發展另一種技術,稱為差分全球定位系統(Differential GPS), 簡稱DGPS。亦即利用附近的已知參考座標點(由其它測量方法所得), 來修正 GPS 的誤差。再把這個即時(real time)誤差值加入本身座標運算的考慮, 便可獲得更精確的值。

        GPS有2D導航和3D導航分,在衛星訊號不夠時無法提供3D導航服務,而且海拔高度精度明顯不夠,有時達到10倍誤差。但是在經緯度方面經改進誤差很小。衛星定位儀在高樓林立的地區撲捉衛星訊號要花較長時間。

基本定位知識

收到兩顆衛星以下無法定位 
收到三顆衛星只能做平面基本定位 
收到四顆衛星可作立體(含高度)基本定位 
收到五顆衛星以上可作立體(含高度)精準定位 

GPS接收器拿來完成標準的3D定位是需要4顆沒錯 
最簡單的解釋是以解這個方程式來說明 (dx^2+dy^2+dz^2)^(1/2)=Pseudorange 
這個方程式有三個未知數 同時也是一個二階的方程式 
理論上必須要有四顆衛星才能解 可是因為我們接收器都假設使用者在地球上 
所以把外太空的那個解去掉就可以只需三顆衛星來解這個方程式 

但是我們知道GPS的工作原理包括瞭解出使用者的時鐘誤差 
所以必須多一顆衛星來解這個未知數 這就是為何需要四顆的原因

時鐘相位偏差

        相位偏差測量不是用本地時鐘跟收到的衛星時鐘做比較得出的.而是多顆衛星的資料列方程組求解得到的.

        一點的座標有三個未知量,這樣本來只需要三個衛星的相位偏差訊號就可以唯一的確定三維座標了,可事實上不行,因為本地沒有絕對準確的時鐘,所以就需要第四顆衛星,把接收機和衛星同步時鐘的相對鐘差做為一個未知量列入方程組,4個方程,4個未知量,就可以精確求解xyzt了。事實上,接收機也可以根據上述計算得到的鐘差將本地時鐘校準.實際使用中,這個本地時鐘準確與否對座標測量是沒有什麼影響的.

距離測量:

        衛星座標(x1,y1,z1)...(x4,y4,z4)到接收機座標x,y,z.;接收機有時鐘,儘管不同步,設收到訊號時侯按照接收機的時鐘跟衛星訊號中的時鐘資料相減的傳輸時間是t1,t2,t3,t4.
事實上接收機的時鐘可能是跟衛星同步時鐘有偏差的.設這個偏差是dt。那麼實際的訊號傳輸時間應該是,t1-dt....t4-dt.   方程組如下式:
√[(x1-x)^2+(y1-y)^2+(z1-z)^2]=c*(t1-dt)    (球體半徑)★★★★★
...4個這樣的方程


        未知數是4個x,y,z,t,可以求解.就是說接收機時鐘儘管不同步,我們解完方程也就知道這個鐘差t到底多大了,xyz也同時得到了.距離是不用關心的中間資料,若需要的話也可以求.我們只需要xyz座標資料.偽距就是上面解得的t乘以光速.
       接收機的時鐘資料是否需要校準呢?(出廠注入時間後需要更改嗎?) 如果需要,是根據上次得出的 dT 進行校準,還是通過其他的人工方式 ?
       理論上講是無須校準的,這與接收機的設計思路有關的,他們在軟體處理上可以定期用算出來的dt校準,也可以根據dt的大小校準,比如dt超出某範圍就校準一次,儘管接收機的時鐘精度不夠,但是短時間積累的鐘差不會很大,使接收機與衛星保持一種準同步狀態,使每次計算出來的dt都不會很大,這樣就可以在環境不好不能接收4顆衛星訊號的時候可以用dt=0,簡單求解座標值.總之這些要看接收機設計人員的思路了.不同的人會有不同的習慣,只要最終得出的資料是滿足精度要求的就可以了.

最少幾顆衛星即可確定地面準確位置?

        首先,我們忽略地球的高度,把它假想成一個純平面,也就是一個純的球面。也就是說我們只關心物體的位置,不關心他的高度、速度等等其他資訊 。這時候其實三顆(甚至兩顆)就可以定出平面上的位置,如果衛星的資料十分精確的話。
        因為每顆衛星可以精確定出距離,忽略地面位置的高度,那麼一顆衛星就可以在地球上畫出一個圓,圓弧上每點到衛星的距離一樣。如果有兩顆衛星,就可以畫出兩個圈,那麼這兩個圈的兩個交點(如圖,A和B點)就是這個物體可能所處的位置。我們可以根據一定的條件排除另外一個交點,那麼我們就可以得到所關心物體的位置了。但如果A、B兩點相距太近,這時候就需要三顆衛星,三顆衛星定出的圓弧交於一點,這個時候就可以準確知道物體的位置(所以三星定位時,與海平面高度差越大,位置誤差就越大)。

          但如果要考慮物體的高度的話,也就是考慮實際的三維情況 (也就是真實的GPS的情形),2-3顆衛星就不夠了。而這個時候,如(三維立體)圖所示:

          兩顆衛星定出來的會是一個圓弧,也就是隻能確定位置處於圓弧上某一點(右上圖):三顆衛星可以定出來兩個點(左下圖):而如果你需要精確得到一個點的空間位置,你至少需要四顆衛星(右下圖)。

You need four satellites because each data from one satellite put you in a sphere around the satellite. By computing the intersections you can narrow the possibilities to a single point.

Two satellites intersection places you on a circle. (all points possible)(兩個球面的交點組成一個圓弧)

Three satellites intersection places you on two possible points.

The last satellite give you the exact location.

You can avoid using four satellite if you already know the altitude, for example when you drive, you can use the ground level as the last intersection. But you can't possibly do this in a plane, since you are not bound to the ground.

relates to the geometry of being able to pin point a uav position. example: if all the sats were in the same location you might not get a fix at all.

if there is not a good spread of sat positions in relation to the earths globe then the accuracy of the uav position or "fix" is reduced. 3D is the best and you should be able to get 3D outside. Is the gps view of the sky obstucted by wires or copter frame etc?

2-D vs. 3-D Fixes

 Most receivers calculate a horizontal(水平面,水平線;水平的) position after they acquire three satellites. To do this they must make presumptions(假定,推定) on their altitude. Usually the last calculated altitude is used. If the altitude assumed by the receiver is in error, the accuracy of the horizontal position is impacted. For example, if the receiver assumed mean sea level and it was at 10,000 feet, a horizontal error of more than a mile could result. On the other hand, if the assumed value is very accurate the horizontal error may be less than if four satellites are tracked. 

 I’m going to try to present a simplified description of the GPS position calculation procedure to help the reader understand why the above is true. If a receiver is tracking four satellites, it is able to make simultaneous(同步的) pseudo('sjuːdəʊ;冒充的,假的;偽君子)-range measurements from each. Each pseudo-range can be thought of as being equal to the range to the satellite plus the offset in the receiver’s clock, scaled to distance units. Since the receiver can calculate the satellite’s position from the Navigation Message, there are four unknowns in the pseudo-range equations: the three components of  the receiver’s position, and the offset in the receiver’s clock. To determine its location it then must solve the four equations for the four unknowns.  The receiver uses suitable algorithms to perform this arithmetic [Note for the more mathematically inclined. You’ve noticed that the equations are non-linear which makes the task non-trivial. If a rough estimate of position is available a Taylor series expansion about the estimated position is generally used. The partial derivatives of the pseudo-range wrt to receiver position are equal to the satellite-to-receiver unit line of sight vector.]

If the receiver “knows” one of the three position components, then measurements from only three satellites are required to solve for the other two components and the receiver clock offset (3 equations and 3 unknowns). If, for example, the altitude is known perfectly, this is equivalent to tracking a satellite directly above (or below) the user, and having a perfect pseudo-range measurement to it. Since a real fourth satellite will never provide a perfect pseudo-range, the three-satellite solution will be better than the four-satellite solution (assuming similar geometry quality, i.e., PDOP). If on the other hand the assumed altitude is in error, then the two sides of the equations will be equal only if a compensating error is added to the horizontal position components and clock offset. 

How does a receiver calculate its position if more than four satellites are tracked? Well, without getting into the mathematics it will be a little difficult to explain, but I’ll try. This description will be conceptual, that is should not be taken literally. As was described above, with four satellites (and good geometry) the position (and necessarily the clock offset) can be calculated. If a measurement from a fifth satellite is available, the receiver can calculate what the measurement should be (expected pseudo-range is range plus clock offset, based on the four satellite solution). The difference between the actual pseudo-range and the expected pseudo-range indicates whether the fifth satellite “agrees” with the four-satellite position solution. That is, if the difference is zero the five-satellite solution is the same as the four-satellite solution. If it is non-zero, then the value is used to adjust the four satellite position (and clock offset) to produce the five satellite position. How is the adjustment done? Well mathematically, linear algebra techniques are used to produce a least square solution. Conceptually think about it like this. You guess a position (and clock) solution, then use it to calculate the five expected pseudo-range values as described above. You then square each of the pseudo-range differences (expected minus actual pseudo-range) and sum them up. This is a measure of the quality of the five-satellite solution. You try many different position solutions, calculating the quality measure for each. The one with the smallest quality measure is your least squares five satellite position. A similar technique is used to calculate a least squares solution for more than five satellites.

How GPS Works

The Global Positioning System, also called NavStar, that we use was built by the US military and has been fully operational since 1995. Many modern GPS receivers use a combination of both GPS and the Russian GLONASS satellites for improved coverage and accuracy.

The GPS system currently has 31 active satellites in orbits inclined 55 degrees to the equator(赤道). The satellites orbit about 20,000km from the earth's surface and make two orbits per day. The orbits are designed so that there are always 6 satellites in view, from most places on the earth.

GPS uses a lot of complex technology, but the concept is simple.

The GPS receiver gets a signal from each GPS satellite. The satellites transmit the exact time the signals are sent. By subtracting the time the signal was transmitted from the time it was received, the GPS can tell how far it is from each satellite. The GPS receiver also knows the exact position in the sky of the satellites, at the moment they sent their signals. So given the travel time of the GPS signals from three satellites and their exact position in the sky, the GPS receiver can determine your position in three dimensions - east, north and altitude.(longitude latitude)

There is a complication. To calculate the time the GPS signals took to arrive, the GPS receiver needs to know the time very accurately. The GPS satellites have atomic clocks that keep very precise time, but it's not feasible to equip a GPS receiver with an atomic clock. However, if the GPS receiver uses the signal from a fourth satellite it can solve an equation that lets it determine the exact time, without needing an atomic clock.

If the GPS receiver is only able to get signals from 3 satellites, you can still get your position, but it will be less accurate. As we noted above, the GPS receiver needs 4 satellites to work out your position in 3-dimensions. If only 3 satellites are available, the GPS receiver can get an approximate position by making the assumption that you are at mean sea level. If you really are at mean sea level, the position will be reasonably accurate. However if you are in the mountains, the 2-D fix could be hundreds of metres off.(GPS衛星的座標是世界大地座標系(world geodetic system s4,WGSs4),座標系,轉換演算法 2D-fix  無法獲得高度)

A modern GPS receiver will typically track all of the available satellites simultaneously, but only a selection of them will be used to calculate your position.

Almanac and Ephemeris

To determine the location of the GPS satellites two types of data are required by the GPS receiver: the almanac('ɔːlmənæk;年曆) and the ephemeris(ɪ'fem(ə)rɪs;星曆錶). This data is continuously transmitted by the GPS satellites and your GPS receiver collects and stores this data.

The almanac contains information about the status of the satellites and approximate orbital information. The GPS receiver uses the almanac to calculate which satellites are currently visible. The almanac is not accurate enough to let the GPS receiver get a fix. If the GPS receiver is new, or has not been used for some time, it may need 15 minutes or so to receive a current almanac. In older GPS receivers, an almanac is required to acquire the satellites, but many newer models are able to acquire the satellites without waiting for the almanac.

To get a fix, your GPS receiver requires additional data for each satellite, called the ephemeris. This data gives very precise information about the orbit of each satellite. Your GPS receiver can use the ephemeris data to calculate the location of a satellite to with a metre or two. The ephemeris is updated every 2 hours and is usually valid for 4 hours. If your GPS receiver has been off for a while, it may take up to several minutes to receive the ephemeris data from each satellite, before it can get a fix.

Your GPS will have a screen, like the one on the right, which shows which satellites are in use. The bar graphs show the strength of the satellites that the GPS has acquired. If the bar is hollow, the GPS is still downloading the ephemeris. The circular plot shows the location of the satellites in the sky - the centre of the circle is overhead.

Startup

When you switch the GPS on, the time-to-first-fix varies depending on how long it is since you last used the GPS. To get a fix, the GPS receiver needs a valid almanac, initial location, time, and ephemeris data.

The terms "cold/warm/hot start" indicate how many of these pieces of data the GPS receiver already has. The terms mean different things to different GPS manufacturers.

Cold start - if the GPS not been used for a long time and/or has moved several hundred kilometres it will take some time to get the first fix. In this state, the GPS receiver does not have a current almanac, ephemeris, initial position or time. Older GPS units may take up to an hour to search for satellites, download the almanac and ephemeris data and obtain an initial position, though newer GPS units may require much less than this.

If the GPS receiver has moved several hundred kilometres, its assumptions about which satellites to use will be incorrect and it will have to search for them. Most units will let you enter an approximate location to speed the process.

Warm start - current almanac, initial position, and time are all valid. Ephemeris data is either invalid or only partially valid. Time-to-first-fix is likely to be 30 seconds to 2 minutes depending on satellite availability and the type of GPS receiver.

Hot start - if the receiver has been off for, say, less than an hour time-to-first-fix will likely be 5-20 seconds.

What does this all mean in practice? 
If the GPS has been recently used you should get a fix almost immediately. If it hasn't, put the GPS outside with a clear view of the sky and have a cup of tea.

If you have a GPS in a vehicle, it's better to wait for the unit to get a fix before driving off. Receiving ephemeris data for a satellite takes 30 seconds. If you momentarily interrupt the signal during that time the GPS it could take up to a minute more to get the ephemeris for that satellite as it has to start over. If you drive in an area with tall buildings or other obstructions it may take a long time to get the ephemeris data, for four satellites, that is needed for the first fix.

Accuracy

The accuracy of the position your GPS reports is influenced by a number of factors, such as the positions of the satellites in the sky, atmospheric effects, satellite clock errors and ephemeris errors etc.

GPS units often show on the screen an accuracy figure, e.g. EPE on Garmin units. Under ideal conditions, this may be 5, or even 3 metres. Manufacturers are vague on exactly how this figure is determined and it would be unwise to take this figure literally.

You'll get a more realistic figure by looking in the specification section of your GPS receiver's user-manual. Typically, with a handheld GPS, 95% of horizontal GPS positions will be within 10 metres of their true location. The error in altitude will probably be at least twice the horizontal error.

The accuracy of a GPS can be improved by using secondary data from external reference stations.  (資料補償)

Many consumer GPS units have a WAAS option. WAAS uses a network of ground-based reference stations. Readings from the reference stations are used to correct for some of the sources of error mentioned above. The correction data is sent to geostationary WAAS satellites which transmit them back to WAAS-enabled GPS receivers to improve position accuracy. WAAS is not available in New Zealand.

Differential Global Positioning System (DGPS) is a similar system. The data from ground reference stations is transmitted to the GPS using longwave radio, FM radio, or even cellphones.

How many satellites are needed for a fix?

You need 3 GPS satellites for a 2D fix (i.e. no height) or 4 satellites for a 3D fix. Typically a GPS will track many more satellites than 

A-GPS

Have you noticed how cellphone GPS units get a fix almost immediately. They use Assisted(輔助的) GPS (A-GPS) as a way of improving the time to first fix, or even allowing a fix in conditions where the GPS might not otherwise be able to function.

The A-GPS device will use a data connection (e.g. 3G on a cellphone) to contact an assistance server. The server can supply almanac and ephemeris data so the GPS doesn't have to wait to receive them from the satellites. The server can also send an approximate location derived from cellphone towers(由訊號塔的GPS位置推斷出手機的大致相對位置), allowing an immediate fix. In some cases the A-GPS device may send incomplete(不完備的) GPS data to the server for processing into a fix.

Once you are out cellphone and WiFi coverage, a cellphone GPS unit has to rely on the satellites to provide the ephemeris & almanac date so, like a standard recreational GPS, it takes 1-2mins to get a fix from a cold start. 


相關文章