From 38830460c24a214502698f0ba0c63d7e3c0b6082 Mon Sep 17 00:00:00 2001 From: sonora Date: Fri, 25 Sep 2015 18:09:09 +0200 Subject: [PATCH] test hdop-dependent turnaround detection threshold for GPX up/down analysis --- OsmAnd/src/net/osmand/plus/GPXUtilities.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/GPXUtilities.java b/OsmAnd/src/net/osmand/plus/GPXUtilities.java index 6bf748db93..dc3ebcf0ad 100644 --- a/OsmAnd/src/net/osmand/plus/GPXUtilities.java +++ b/OsmAnd/src/net/osmand/plus/GPXUtilities.java @@ -226,7 +226,8 @@ public class GPXUtilities { double totalSpeedSum = 0; points = 0; - double channelThres = 10; + double channelThresMin = 5; // Minimum oscillation amplitude considered as noise for Up/Down analysis + double channelThres = channelThresMin; // Actual oscillation amplitude considered as noise, try depedency on current hdop double channelBase; double channelTop; double channelBottom; @@ -277,12 +278,19 @@ public class GPXUtilities { channelBase = point.ele; channelTop = channelBase; channelBottom = channelBase; + channelThres = channelThresMin; } // Channel maintenance if (point.ele > channelTop) { channelTop = point.ele; + if (!Double.isNaN(point.hdop)) { + channelThres = Math.max(channelThres, point.hdop); + } } else if (point.ele < channelBottom) { channelBottom = point.ele; + if (!Double.isNaN(point.hdop)) { + channelThres = Math.max(channelThres, point.hdop); + } } // Turnaround (breakout) detection if ((point.ele <= (channelTop - channelThres)) && (climb == true)) { @@ -292,6 +300,7 @@ public class GPXUtilities { channelBase = channelTop; channelBottom = point.ele; climb = false; + channelThres = channelThresMin; } else if ((point.ele >= (channelBottom + channelThres)) && (climb == false)) { if ((channelBase - channelBottom) >= channelThres) { diffElevationDown += channelBase - channelBottom; @@ -299,6 +308,7 @@ public class GPXUtilities { channelBase = channelBottom; channelTop = point.ele; climb = true; + channelThres = channelThresMin; } // End detection without breakout if (j == (numberOfPoints -1)) {