mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 08:42:32 -08:00
TapDetection -> TrackerAction
This commit is contained in:
1 parent
78deb81e21
commit
c71f06cf71
27 files changed
+412
-384
No files matched your search
@@ -39,7 +39,7 @@ import dev.slimevr.skeleton.buildBones
|
||||
import dev.slimevr.solarxr.rpc.ServerInfos
|
||||
import dev.slimevr.stepmounting.StepMountingManager
|
||||
import dev.slimevr.stepmounting.StepMountingState
|
||||
import dev.slimevr.tapdetection.TapDetectionManager
|
||||
import dev.slimevr.trackeraction.TrackerActionManager
|
||||
import dev.slimevr.tracker.Motion
|
||||
import dev.slimevr.tracker.SessionCalibration
|
||||
import dev.slimevr.tracker.StayAlignedData
|
||||
@@ -315,7 +315,7 @@ abstract class TestAppContext : AppContextProvider {
|
||||
override val vmcManager: VMCManager get() = error("not used in test")
|
||||
override val vrcOscManager: VRCOSCManager get() = error("not used in test")
|
||||
override val resetsManager: ResetsManager get() = error("not used in test")
|
||||
override val tapDetectionManager: TapDetectionManager get() = error("not used in test")
|
||||
override val trackerActionManager: TrackerActionManager get() = error("not used in test")
|
||||
override val boneRouting: BoneRoutingManager get() = error("not used in test")
|
||||
override val stepMountingManager: StepMountingManager get() = error("not used in test")
|
||||
override val logSources: List<LogSourceProvider> = emptyList()
|
||||
|
||||
@@ -166,17 +166,17 @@ class LegacyConfigTest {
|
||||
assertTrue(resets.saveMountingReset)
|
||||
assertTrue(resets.resetHmdAttitude)
|
||||
|
||||
val tap = settings.tapDetectionConfig
|
||||
assertEquals(0.4f, tap.yawResetDelay)
|
||||
assertEquals(2.0f, tap.fullResetDelay)
|
||||
assertEquals(1.0f, tap.mountingResetDelay)
|
||||
assertFalse(tap.yawResetEnabled)
|
||||
assertEquals(BodyPart.UPPER_CHEST, tap.yawResetBodyPart)
|
||||
assertEquals(BodyPart.LOWER_WAIST, tap.mountingResetBodyPart)
|
||||
assertEquals(BodyPart.LEFT_UPPER_LEG, tap.fullResetBodyPart)
|
||||
assertEquals(4, tap.yawResetTaps)
|
||||
assertEquals(5, tap.mountingResetTaps)
|
||||
assertEquals(2, tap.numberTrackersOverThreshold)
|
||||
val tap = settings.trackerActionConfig
|
||||
assertEquals(0.4f, tap.yawResetAction.delay)
|
||||
assertEquals(2.0f, tap.fullResetAction.delay)
|
||||
assertEquals(1.0f, tap.mountingResetAction.delay)
|
||||
assertFalse(tap.yawResetAction.enabled)
|
||||
assertEquals(BodyPart.UPPER_CHEST, tap.yawResetAction.bodyPart)
|
||||
assertEquals(BodyPart.LOWER_WAIST, tap.mountingResetAction.bodyPart)
|
||||
assertEquals(BodyPart.LEFT_UPPER_LEG, tap.fullResetAction.bodyPart)
|
||||
assertEquals(4, tap.yawResetAction.taps)
|
||||
assertEquals(5, tap.mountingResetAction.taps)
|
||||
assertEquals(2, tap.tapsTrackersOverThreshold)
|
||||
|
||||
val vmc = settings.vmcConfig
|
||||
assertTrue(vmc.enabled)
|
||||
|
||||
@@ -29,7 +29,7 @@ class SettingsDefaultsTest {
|
||||
assertNotNull(defaults.skeleton)
|
||||
assertNotNull(defaults.resets)
|
||||
assertNotNull(defaults.stayAligned)
|
||||
assertNotNull(defaults.tapDetection)
|
||||
assertNotNull(defaults.trackerAction)
|
||||
assertNotNull(defaults.timeout)
|
||||
assertNotNull(defaults.hid)
|
||||
assertNotNull(defaults.driver)
|
||||
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
package dev.slimevr.tapdetection
|
||||
package dev.slimevr.trackeraction
|
||||
|
||||
import io.github.axisangles.ktmath.Vector3
|
||||
import kotlin.test.Test
|
||||
@@ -14,19 +14,19 @@ class TapDetectionTest {
|
||||
)
|
||||
|
||||
// Accel high enough to trigger a tap
|
||||
val highAccel = Vector3(0f, 0f, TapDetectionBasicBehaviour.NEEDED_ACCEL_DELTA * 3f)
|
||||
val highAccel = Vector3(0f, 0f, TapDetectionBehaviour.NEEDED_ACCEL_DELTA * 3f)
|
||||
|
||||
// Low accel needed as rest between taps
|
||||
val lowAccel = Vector3.ZERO
|
||||
|
||||
// Accelerations needed for a tap happen with this delay
|
||||
val accelDelay = TapDetectionBasicBehaviour.ACCEL_WINDOW * 0.9
|
||||
val accelDelay = TapDetectionBehaviour.ACCEL_WINDOW * 0.9
|
||||
|
||||
// Delay between several taps
|
||||
val tapDelay = TapDetectionBasicBehaviour.TAP_WINDOW_PER_TAP * 0.9
|
||||
val tapDelay = TapDetectionBehaviour.TAP_WINDOW_PER_TAP * 0.9
|
||||
|
||||
// Too long of a delay between several taps
|
||||
val tapTimeoutDelay = TapDetectionBasicBehaviour.TAP_WINDOW_PER_TAP * 1.1
|
||||
val tapTimeoutDelay = TapDetectionBehaviour.TAP_WINDOW_PER_TAP * 1.1
|
||||
|
||||
/**
|
||||
* Runs a sequence of tap events through TapDetection, asserting the results.
|
||||
@@ -37,11 +37,11 @@ class TapDetectionTest {
|
||||
bodyAccelerating: Boolean = false,
|
||||
thresholdMultiplier: Float = 1f,
|
||||
) {
|
||||
val state = TapDetectionBasicBehaviour.TrackerTapDetectionState(
|
||||
val state = TapDetectionBehaviour.TrackerTapDetectionState(
|
||||
trackerId = 1,
|
||||
tapsNeeded = tapsNeeded,
|
||||
)
|
||||
val behaviour = TapDetectionBasicBehaviour()
|
||||
val behaviour = TapDetectionBehaviour()
|
||||
|
||||
val timeSource = TestTimeSource()
|
||||
events.forEach { event ->
|
||||
Reference in new issue
Block a user