Operácie

Meranie s GPS

Z SensorWiki

Verzia z 12:20, 26. apríl 2020, ktorú vytvoril Balogh (diskusia | príspevky)

Modifikované cvičenie na DOMA:


Úloha:

Spravte základné testovanie presnosti GPS snímačov.

Zistite:

a) aká je statická presnosť vašeho GPS. Meranie v jednom bode vykonávajte nepretržite minimálne 6 hodín (napr. v noci) a získané údaje zakreslite do X-Y grafu. Určite aká je maximálna odchýlka, max. priemerná odchýlka a max. odchýlka priemeru od správnej hodnoty (ak sa vám podarí ju získať). Minimálny počet bodov je 36 (6x6). Ak budete pracovať vo dvojici, počet bodov je dvojnásobný.


b) aká je dynamická presnosť vašeho GPS. Prejdete 3x peši (behom) štvorec o hrane 250 m alebo 3x autom štvorec o hrane min. 1km Výsledky zakreslíte do grafu. Aká je maximálna odchýlka medzi jednotlivými trasami? Aká je maximálna odchýlka v rohoch štvorca?


Meranie nemusíte robiť v reálnom čase, t.j. môžete si data zaznamenať, napr. do súboru a výpočty robiť potom neskôr.


Odovzdať treba:

  • video na ktorom vidno ako experiment prebiehal
  • grafické zobrazenie trajektórie v mape (mapy.cz, strava.com a pod.)
  • referát s výpočtami a vyhodnotením presnosti
  • ak ste použili vlastný softvér, tak zdrojáky (.pde alebo .m a pod.)


Vzorový program


Tipy:

Môže sa vám hodiť:

  • Konvertor GPX do CSV (lebo .csv viete otvoriť v Exceli)
  • Výpočet vzdialeností z Lat/Lon súradníc


Definície a označenie

Budeme počítať vzdialenosť d,\,\! medzi dvoma bodmi A\,\! a B\,\!. Zemepisné súradnice sú dané zemepisnou šírkou a zemepisnou dĺžkou (latitude, longitude) oboch bodov A [\phi_1,\lambda_1]\,\! a B [\phi_2,\lambda_2],\,\!. Na ich poradí pre účely výpočtu vzdialenosti nezáleží.

Orientácia zemepisných súradníc je daná tak, že Sever (N) a Východ (E) sa vyjadrujú kladným, Juh (S) a Západ (W) záporným číslom. Zemepisné súradnice sa obvykle vyjadrujú v stupňoch, pri výpočte ich treba previesť do takých jednotiek, v akých očakávajú argument goniometrické funkcie na kalkulačke alebo vo vašom algoritme (stupne, radiány). Okrem toho si treba uvedomiť, že minúty a sekundy sú zo 60, takže S31 30' je -31,5 stupňa. Prevod stupňov na radiány je jednoduchý: radians = degrees * PI / 180.

function degreesToRadians(degrees) {
  return degrees * PI / 180;
}

Označíme si pomocné rozdiely v súradniciach nasledovne:

\begin{align}
\Delta\phi&=\phi_2-\phi_1;\\
\Delta\lambda&=\lambda_2-\lambda_1.
\end{align}
\,\!

It is not important whether the result is positive or negative when used in the formulae below.

"Mean latitude" is labeled and calculated as follows:

\phi_m=\frac{\phi_1+\phi_2}{2}.\,\!

Colatitude is labeled and calculated as follows:

For latitudes expressed in radians:
\theta=\frac{\pi}{2}-\phi;\,\!
For latitudes expressed in degrees:
\theta=90^\circ-\phi.\,\!

Unless specified otherwise, the radius of the earth for the calculations below is:

R\,\! = 6,371.009 kilometers = 3,958.761 statute miles = 3,440.069 nautical miles.

D_\,\! = Distance between the two points, as measured along the surface of the earth and in the same units as the value used for radius unless specified otherwise.

Flat-surface formulae

A planar approximation for the surface of the earth may be useful over small distances. The accuracy of distance calculations using this approximation become increasingly inaccurate as:

  • The separation between the points becomes greater;
  • A point becomes closer to a geographic pole.

The shortest distance between two points in plane is a straight line. The Pythagorean theorem is used to calculate the distance between points in a plane.

Even over short distances, the accuracy of geographic distance calculations which assume a flat Earth depend on the method by which the latitude and longitude coordinates have been projected onto the plane. The projection of latitude and longitude coordinates onto a plane is the realm of cartography.

The formulae presented in this section provide varying degrees of accuracy.

Spherical Earth projected to a plane

This formula takes into account the variation in distance between meridians with latitude:

D=R\sqrt{(\Delta\phi)^2+(\cos(\phi_m)\Delta\lambda)^2},
where:
\Delta\phi\,\! and \Delta\lambda\,\! are in radians;
\phi_m\,\! must be in units compatible with the method used for determining \cos(\phi_m).\,\!
To convert latitude or longitude to radians use
 1^\circ = (\pi/180)\,\mathrm{radians}.

This approximation is very fast and produces fairly accurate result for small distances Šablóna:Citation needed. Also, when ordering locations by distance, such as in a database query, it is much faster to order by squared distance, eliminating the need for computing the square root.

function distanceInKmBetweenEarthCoordinates(lat1, lon1, lat2, lon2) {
  var earthRadiusKm = 6371;

  var dLat = degreesToRadians(lat2-lat1);
  var dLon = degreesToRadians(lon2-lon1);

  lat1 = degreesToRadians(lat1);
  lat2 = degreesToRadians(lat2);

  var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
          Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); 
  var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
  return earthRadiusKm * c;
}

Napríklad

istanceInKmBetweenEarthCoordinates(0,0,0,0)  // Distance between same 
                                              // points should be 0
0

distanceInKmBetweenEarthCoordinates(51.5, 0, 38.8, -77.1) // From London
                                                          // to Arlington
5918.185064088764


Návrat na zoznam cvičení...