Note that there are some explanatory texts on larger screens.

plurals
  1. POGPS Track, computing height difference
    text
    copied!<p>I have implemented a GPS Tracker for Android. So far it is working quite nice but I have problems computing the <strong>right</strong> height difference for the track. I want to sum up all meters the device "climbed" and "descended". I do this in a background service comparing the current location object with the previous one and store the difference directly as a column in the database. If I sum this up after the track is finished I get a value that is approximately 2.5 times as high (1500m vs 650m) as measured with a bicycle speedometer that uses a barometer. </p> <p>I know the measured altitude of the GPS device is inaccurate. Is there any way to "normalize" the measured altitude? Should I, for example, ignore all altitude changes below 2 meters? Another possibility would be to use additional sensors as some devices also have a barometer. But that would only help on some devices. </p> <p>Thanks for any advice or hints on this issue!</p> <p>EDIT 28.05.2013: The answer of Bryce got me on the right track. I started searching the web and found a very simple low pass filter that is easy to implement. I did this in c++</p> <p>A node class representing one waypoint:</p> <pre><code>class Node { private: double distance; double altitude; double altitudeup; double altitudedown; double latitude; double longitude; long timestamp; public: Node(double dist, double alti, double altiup, double altidown, double lat, double lon, long ts); double getAltitude(); double getAltitudeup(); double getAltitudedown(); }; </code></pre> <p>Here is the function that does the actual work and computes the values for total ascend and descend:</p> <pre><code>void SimpleLowPass::applySLP() { double altiUp = 0; double altiDown = 0; double prevAlti = this-&gt;nodeList[0]-&gt;getAltitude(); double newAlti = prevAlti; for (auto n : this-&gt;nodeList) { double cur = n-&gt;getAltitude(); // All the power of the filter is in the line // newAlti += (cur - newAlti) / smoothing. // This finds the difference between the new value and the current (smoothed) // value, shrinks it based on the strength of the filter, and then adds it // to the smoothed value. You can see that if smoothing is set to 1 then the // smoothed value always becomes the next value. If the smoothing is set to // 2 then the smoothed value moves halfway to each new point on each new // frame. The larger the smoothing value, the less the smoothed line is // perturbed by new changes. newAlti += (cur - newAlti) / 20.0; std::cout &lt;&lt; "newAlti: " &lt;&lt; newAlti &lt;&lt; std::endl; if (prevAlti &gt; newAlti) { altiDown += prevAlti - newAlti; } if (newAlti &gt; prevAlti) { altiUp += newAlti - prevAlti; } prevAlti = newAlti; } std::cout &lt;&lt; "Alti UP total: " &lt;&lt; altiUp &lt;&lt; std::endl; std::cout &lt;&lt; "Alti DOWN total: " &lt;&lt; altiDown &lt;&lt; std::endl; } </code></pre> <p>This is a quick and dirty implementation. But with a value of 20 for smoothing I get pretty good results. Still I will need to record more tracks and compare the results. Also there is Frame-Rate independent implementation on the website where I found this low-pass filter and I want to play with a moving average implementation. </p> <p><a href="http://phrogz.net/js/framerate-independent-low-pass-filter.html" rel="nofollow">simple low-pass filter</a></p> <p>Thanks for all your answers!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload