From b85ca1922d12967a8c500cdacbfaf14913c2c02f Mon Sep 17 00:00:00 2001 From: Butterscotch! Date: Fri, 2 Oct 2026 01:37:56 -0400 Subject: [PATCH] Don't use pos trackers in step mount --- .../skeleton/targetprocessors/skating-correction.kt | 1 + .../src/main/java/dev/slimevr/stepmounting/behaviours.kt | 7 ++++--- .../core/src/main/java/dev/slimevr/stepmounting/module.kt | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/core/src/main/java/dev/slimevr/skeleton/targetprocessors/skating-correction.kt b/server/core/src/main/java/dev/slimevr/skeleton/targetprocessors/skating-correction.kt index 11e03a800..872ebae4e 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/targetprocessors/skating-correction.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/targetprocessors/skating-correction.kt @@ -288,6 +288,7 @@ class SkatingCorrectionTargetProcessor(val settings: Settings, val skeleton: Ske // Otherwise pull the last state } ?: lastState ?: continue + // TODO Smooth tracker to new position on unlock if (activeState.locked) { mutableIkTargets[bodyPart] = activeState.position } diff --git a/server/core/src/main/java/dev/slimevr/stepmounting/behaviours.kt b/server/core/src/main/java/dev/slimevr/stepmounting/behaviours.kt index 67db8a0b1..4abf1ebc7 100644 --- a/server/core/src/main/java/dev/slimevr/stepmounting/behaviours.kt +++ b/server/core/src/main/java/dev/slimevr/stepmounting/behaviours.kt @@ -23,7 +23,7 @@ import kotlinx.coroutines.withTimeoutOrNull import solarxr_protocol.datatypes.BodyPart import kotlin.time.TimeSource -internal const val TIMEOUT_MS = 30_000L +internal const val TIMEOUT_MS = 10_000L class StepMountingBasicBehaviour : StepMountingBehaviour { fun canCalibrate(trackers: List): Boolean { @@ -59,7 +59,7 @@ val coefficients = ButterworthCoefficients( 0.02f, ) const val startThreshold = 0.4f // in m/s^2 -const val endThreshold = 0.2f // in m/s^2 +const val endThreshold = 0.3f // in m/s^2 const val minMovementDurationMs = 3000L fun movementDetector(updates: Flow) = flow { @@ -143,13 +143,14 @@ internal suspend fun runCalibrationSession( } val headOffset = headRecording.last().position - headRecording.first().position + AppLogger.stepMounting.info("${BodyPart.HEAD}: $headOffset") trackerRecordings.filter { it.second.isNotEmpty() }.map { (tracker, recording) -> tracker to estimateHeadingAlign(recording, headOffset) }.forEach { (tracker, result) -> // TODO: Fail on high error - AppLogger.stepMounting.info(result) + AppLogger.stepMounting.info("${tracker.context.state.value.bodyPart}: $result") tracker.context.dispatch( TrackerActions.SetStepMounting( diff --git a/server/core/src/main/java/dev/slimevr/stepmounting/module.kt b/server/core/src/main/java/dev/slimevr/stepmounting/module.kt index 8a245f17b..ffb275bae 100644 --- a/server/core/src/main/java/dev/slimevr/stepmounting/module.kt +++ b/server/core/src/main/java/dev/slimevr/stepmounting/module.kt @@ -104,7 +104,10 @@ class StepMountingManager( fun getTrackers(): List>> { val activeTrackers = server.context.state.value.trackers.values.filter { val state = it.context.state.value - state.status == TrackerStatus.OK && state.acceleration != null + state.status == TrackerStatus.OK && + state.bodyPart != null && + state.acceleration != null && + state.position == null } if (activeTrackers.isEmpty()) return emptyList() return activeTrackers.map { controller ->