Ignore steps inside the fix accuracy, rename the compose service
A still phone indoors reports fixes 10 to 40 m apart. The 10 m step filter kept them, so the trail zigzagged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mandroid/app/src/main/java/org/opentracker/SamplingPolicy.kt
@@ -133,8 +133,8 @@ class SamplingPolicy {
(fix.accuracy ?: 0f) > MAX_ACCURACY -> age >= STALE_MS
age >= HEARTBEAT_MS -> true
mode == Mode.STATIONARY -> distance(last, fix) > DEPARTURE_M
mode == Mode.VEHICLE -> distance(last, fix) >= 20
else -> distance(last, fix) >= 10
// A step inside the fix's own accuracy is noise.
else -> distance(last, fix) >= max(if (mode == Mode.VEHICLE) 20.0 else 10.0, (fix.accuracy ?: 0f).toDouble())
}
if (ok) {
kept.add(i + 1, fix)
Mandroid/app/src/test/java/org/opentracker/SamplingPolicyTest.kt
@@ -84,6 +84,8 @@ class SamplingPolicyTest {
assertTrue(p.onFix(fix(0, speed = 1.5f)))
assertFalse(p.onFix(fix(30_000, 4.0, speed = 1.5f)))
assertTrue(p.onFix(fix(60_000, 40.0, speed = 1.5f)))
assertFalse(p.onFix(fix(90_000, 65.0, speed = 1.5f, acc = 30f)))
assertTrue(p.onFix(fix(120_000, 75.0, speed = 1.5f, acc = 30f)))
}
@Test