Don't use pos trackers in step mount

This commit is contained in:
Butterscotch! committed 2026-10-02 01:37:56 -04:00
1 parent 22dddb54f0
commit b85ca1922d
3 files changed
+9 -4

No files matched your search

@@ -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
}
@@ -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<TrackerState>): 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<TrackerSnapshot>) = 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(
@@ -104,7 +104,10 @@ class StepMountingManager(
fun getTrackers(): List<Pair<Tracker, Flow<TrackerSnapshot>>> {
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 ->