From 52fb3f8fc45c4e759c172239ac57a037026d41ea Mon Sep 17 00:00:00 2001 From: Erimel Date: Fri, 2 Oct 2026 12:36:01 -0400 Subject: [PATCH] No more T-pose (down) To be superseded by https://github.com/SlimeVR/SlimeVR-Server/issues/1944 math was wrong anyways --- gui/app/public/i18n/en/translation.ftl | 18 +++---- .../components/mounting/PoseMountingVideo.tsx | 15 +++--- .../stay-aligned-steps/VerifyMounting.tsx | 1 - .../pages/components/ResetsSettings.tsx | 43 ++++++--------- .../tracking-checklist/TrackingChecklist.tsx | 1 - gui/app/src/utils/skeletonMeshHelper.ts | 2 +- .../main/java/dev/slimevr/config/settings.kt | 4 +- .../main/java/dev/slimevr/resets/module.kt | 18 +++---- .../java/dev/slimevr/solarxr/rpc/resets.kt | 4 +- .../tracker/behaviours/rest-orientation.kt | 52 ------------------- .../main/java/dev/slimevr/tracker/module.kt | 5 -- .../main/java/dev/slimevr/tracker/reducer.kt | 5 -- .../slimevr/tracker/session-calibration.kt | 5 +- solarxr-protocol | 2 +- 14 files changed, 47 insertions(+), 128 deletions(-) delete mode 100644 server/core/src/main/java/dev/slimevr/tracker/behaviours/rest-orientation.kt diff --git a/gui/app/public/i18n/en/translation.ftl b/gui/app/public/i18n/en/translation.ftl index 6466c5976..c39af2b8e 100644 --- a/gui/app/public/i18n/en/translation.ftl +++ b/gui/app/public/i18n/en/translation.ftl @@ -647,16 +647,14 @@ settings-general-fk_settings-ik-use_position-description = Enables the use of po settings-general-fk_settings-resets_settings = Resets Settings settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude = Reset HMD attitude settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude-description = Reset a VR headset's vertical rotation upon doing a full reset. Useful when wearing one on the forehead for VTubing or mocap. Do not enable for VR. -settings-general-fk_settings-arm_fk-reset_mode = Arms reset mode -settings-general-fk_settings-arm_fk-reset_mode-description = Change which arm pose is expected for resets. -settings-general-fk_settings-arm_fk-back = Back -settings-general-fk_settings-arm_fk-back-description = The default mode, with the upper arms going back and lower arms going forward. -settings-general-fk_settings-arm_fk-tpose_up = T-pose (up) -settings-general-fk_settings-arm_fk-tpose_up-description = Expects your arms to be down at your sides during Full Reset, and 90 degrees up to the sides during Mounting Calibration. -settings-general-fk_settings-arm_fk-tpose_down = T-pose (down) -settings-general-fk_settings-arm_fk-tpose_down-description = Expects your arms to be 90 degrees up to the sides during Full Reset, and down at your sides during Mounting Calibration. -settings-general-fk_settings-arm_fk-forward = Forward -settings-general-fk_settings-arm_fk-forward-description = Expects your arms to be raised forward at 90 degrees. Useful for VTubing. +settings-general-fk_settings-arms_mounting_reset_mode = Arms mounting reset mode +settings-general-fk_settings-arms_mounting_reset_mode-description = Change which arm pose is expected for mounting reset. +settings-general-fk_settings-arms_mounting_reset_mode-back = Back +settings-general-fk_settings-arms_mounting_reset_mode-back-description = Expects your upper arms going back and your lower arms going forward. Recommended for VR. +settings-general-fk_settings-arms_mounting_reset_mode-t_pose = T-pose +settings-general-fk_settings-arms_mounting_reset_mode-t_pose-description = Expects your arms to be raised to the sides. +settings-general-fk_settings-arms_mounting_reset_mode-forward = Forward +settings-general-fk_settings-arms_mounting_reset_mode-forward-description = Expects your arms to be raised forward. Recommended for VTubing. settings-general-fk_settings-skeleton_settings-ratios = Skeleton ratios settings-general-fk_settings-skeleton_settings-ratios-description = Change the values of skeleton settings. You may need to adjust your proportions after changing these. settings-general-fk_settings-skeleton_settings-impute_spine_from_upper_to_lower = Estimate missing spine trackers from upper to lower diff --git a/gui/app/src/components/mounting/PoseMountingVideo.tsx b/gui/app/src/components/mounting/PoseMountingVideo.tsx index f3e6b6af8..c0254b0ba 100644 --- a/gui/app/src/components/mounting/PoseMountingVideo.tsx +++ b/gui/app/src/components/mounting/PoseMountingVideo.tsx @@ -1,19 +1,20 @@ import classNames from 'classnames'; -import { ArmsResetMode } from 'solarxr-protocol'; +import { ArmsMountingResetMode } from 'solarxr-protocol'; import { Typography } from '@/components/commons/Typography'; import { useResetsSettings } from '@/hooks/resets-settings'; -const ARMS_MODE_NAMES: Record = { - [ArmsResetMode.BACK]: 'back', - [ArmsResetMode.FORWARD]: 'forward', - [ArmsResetMode.T_POSE_UP]: 'tpose-up', - [ArmsResetMode.T_POSE_DOWN]: 'tpose-down', +const ARMS_MODE_NAMES: Record = { + [ArmsMountingResetMode.BACK]: 'back', + [ArmsMountingResetMode.FORWARD]: 'forward', + [ArmsMountingResetMode.SIDE]: 'tpose-up', }; function usePoseMounting() { const { resetsSettings } = useResetsSettings(); const arms = - ARMS_MODE_NAMES[resetsSettings?.armsResetMode ?? ArmsResetMode.BACK]; + ARMS_MODE_NAMES[ + resetsSettings?.armsMountingResetMode ?? ArmsMountingResetMode.BACK + ]; const tiptoe = !!resetsSettings?.resetMountingFeet; return { arms, tiptoe }; } diff --git a/gui/app/src/components/onboarding/pages/stay-aligned/stay-aligned-steps/VerifyMounting.tsx b/gui/app/src/components/onboarding/pages/stay-aligned/stay-aligned-steps/VerifyMounting.tsx index f47b9f2ca..c2b881263 100644 --- a/gui/app/src/components/onboarding/pages/stay-aligned/stay-aligned-steps/VerifyMounting.tsx +++ b/gui/app/src/components/onboarding/pages/stay-aligned/stay-aligned-steps/VerifyMounting.tsx @@ -1,6 +1,5 @@ import { useState } from 'react'; import { Button } from '@/components/commons/Button'; -import { Typography } from '@/components/commons/Typography'; import { PoseMountingInstructions, PoseMountingVideo, diff --git a/gui/app/src/components/settings/pages/components/ResetsSettings.tsx b/gui/app/src/components/settings/pages/components/ResetsSettings.tsx index a919ad4a8..4a98bea2c 100644 --- a/gui/app/src/components/settings/pages/components/ResetsSettings.tsx +++ b/gui/app/src/components/settings/pages/components/ResetsSettings.tsx @@ -12,7 +12,7 @@ import { MountingMethod } from 'solarxr-protocol'; type ResetsSettingsForm = { resetMountingFeet: boolean; - armsResetMode: number; + armsMountingResetMode: number; yawResetSmoothTime: number; saveMountingReset: boolean; resetReliableReferenceAttitude: boolean; @@ -20,7 +20,7 @@ type ResetsSettingsForm = { const defaultValues: ResetsSettingsForm = { resetMountingFeet: false, - armsResetMode: 0, + armsMountingResetMode: 0, yawResetSmoothTime: 0.0, saveMountingReset: false, resetReliableReferenceAttitude: false, @@ -49,7 +49,7 @@ export function ResetsSettings() { const onSubmit = (values: ResetsSettingsForm) => { setResetsSettings({ resetMountingFeet: values.resetMountingFeet, - armsResetMode: values.armsResetMode, + armsMountingResetMode: values.armsMountingResetMode, yawResetSmoothTime: values.yawResetSmoothTime, saveMountingReset: values.saveMountingReset, resetReliableReferenceAttitude: values.resetReliableReferenceAttitude, @@ -83,60 +83,51 @@ export function ResetsSettings() { <>
- {l10n.getString('settings-general-fk_settings-arm_fk-reset_mode')} + {l10n.getString( + 'settings-general-fk_settings-arms_mounting_reset_mode' + )} {l10n.getString( - 'settings-general-fk_settings-arm_fk-reset_mode-description' + 'settings-general-fk_settings-arms_mounting_reset_mode-description' )} -
+
-
diff --git a/gui/app/src/components/tracking-checklist/TrackingChecklist.tsx b/gui/app/src/components/tracking-checklist/TrackingChecklist.tsx index 58ee9e7ce..7196196e8 100644 --- a/gui/app/src/components/tracking-checklist/TrackingChecklist.tsx +++ b/gui/app/src/components/tracking-checklist/TrackingChecklist.tsx @@ -5,7 +5,6 @@ import { trackingchecklistIdtoLabel, } from '@/hooks/tracking-checklist'; import classNames from 'classnames'; -import { Clickable } from '@/components/commons/Clickable'; import { EnableSteamVRDriverRequestT, ResetType, diff --git a/gui/app/src/utils/skeletonMeshHelper.ts b/gui/app/src/utils/skeletonMeshHelper.ts index 136048209..fcce0da6d 100644 --- a/gui/app/src/utils/skeletonMeshHelper.ts +++ b/gui/app/src/utils/skeletonMeshHelper.ts @@ -121,7 +121,7 @@ export class BasedSkeletonMeshHelper extends Object3D { if (og === scene) return; const addr = addrObject(url, og.name); - for (const [part, attached] of partsByAddr[addr] ?? []) { + for (const [_, attached] of partsByAddr[addr] ?? []) { const o = og.clone(true); o.position.set(0, 0, 0); diff --git a/server/core/src/main/java/dev/slimevr/config/settings.kt b/server/core/src/main/java/dev/slimevr/config/settings.kt index a5cfcc320..404d99187 100644 --- a/server/core/src/main/java/dev/slimevr/config/settings.kt +++ b/server/core/src/main/java/dev/slimevr/config/settings.kt @@ -16,7 +16,7 @@ import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive import solarxr_protocol.datatypes.BodyPart import solarxr_protocol.datatypes.MountingMethod -import solarxr_protocol.rpc.ArmsResetMode +import solarxr_protocol.rpc.ArmsMountingResetMode import solarxr_protocol.rpc.FilteringType import solarxr_protocol.rpc.KeybindId import solarxr_protocol.rpc.RoutingOutput @@ -95,7 +95,7 @@ data class ResetsConfig( /** Always reset mounting for feet */ val resetMountingFeet: Boolean = false, /** Reset mode used for the arms */ - val armsResetMode: ArmsResetMode = ArmsResetMode.BACK, + val armsMountingResetMode: ArmsMountingResetMode = ArmsMountingResetMode.BACK, /** Yaw reset smoothing time in seconds */ val yawResetSmoothTime: Float = 0.0f, /** Save automatic mounting reset calibration */ diff --git a/server/core/src/main/java/dev/slimevr/resets/module.kt b/server/core/src/main/java/dev/slimevr/resets/module.kt index e6425ae56..96b7d8847 100644 --- a/server/core/src/main/java/dev/slimevr/resets/module.kt +++ b/server/core/src/main/java/dev/slimevr/resets/module.kt @@ -33,7 +33,7 @@ import kotlinx.coroutines.withContext import solarxr_protocol.data_feed.server.ResetAvailability import solarxr_protocol.datatypes.BodyPart import solarxr_protocol.datatypes.MountingMethod -import solarxr_protocol.rpc.ArmsResetMode +import solarxr_protocol.rpc.ArmsMountingResetMode import solarxr_protocol.rpc.CountdownDetail import solarxr_protocol.rpc.ResetDetail import solarxr_protocol.rpc.ResetLifecycle @@ -225,23 +225,19 @@ class ResetsManager( AppLogger.resets.info("Clear Mounting Reset from $resetSourceName") } - private fun getYawOffset(bodyPart: BodyPart?, armsResetMode: ArmsResetMode) = when (bodyPart) { + private fun getYawOffset(bodyPart: BodyPart?, armsResetMode: ArmsMountingResetMode) = when (bodyPart) { // Going forward in ResetBodyParts.UPPER_LEGS -> 0f - in ResetBodyParts.LOWER_ARMS if armsResetMode == ArmsResetMode.BACK -> 0f + in ResetBodyParts.LOWER_ARMS if armsResetMode == ArmsMountingResetMode.BACK -> 0f - in ResetBodyParts.ARMS if armsResetMode == ArmsResetMode.FORWARD -> 0f + in ResetBodyParts.ARMS if armsResetMode == ArmsMountingResetMode.FORWARD -> 0f // Going left/ - in ResetBodyParts.LEFT_ARM if armsResetMode == ArmsResetMode.T_POSE_UP -> -FastMath.HALF_PI - - in ResetBodyParts.RIGHT_ARM if armsResetMode == ArmsResetMode.T_POSE_DOWN -> -FastMath.HALF_PI + in ResetBodyParts.LEFT_ARM if armsResetMode == ArmsMountingResetMode.SIDE -> -FastMath.HALF_PI // Going right - in ResetBodyParts.LEFT_ARM if armsResetMode == ArmsResetMode.T_POSE_DOWN -> FastMath.HALF_PI - - in ResetBodyParts.RIGHT_ARM if armsResetMode == ArmsResetMode.T_POSE_UP -> FastMath.HALF_PI + in ResetBodyParts.RIGHT_ARM if armsResetMode == ArmsMountingResetMode.SIDE -> FastMath.HALF_PI // Going back else -> FastMath.PI @@ -250,7 +246,7 @@ class ResetsManager( private fun getResetAction(referenceRotation: Quaternion?, resetType: ResetType, bodyPart: BodyPart?, resetsConfig: ResetsConfig) = when (resetType) { ResetType.YAW -> TrackerActions.YawReset(referenceRotation, resetsConfig.yawResetSmoothTime.toDouble().seconds) ResetType.FULL -> TrackerActions.FullReset(referenceRotation, resetsConfig.resetReliableReferenceAttitude) - ResetType.MOUNTING -> TrackerActions.PoseMountingReset(referenceRotation, getYawOffset(bodyPart, resetsConfig.armsResetMode)) + ResetType.MOUNTING -> TrackerActions.PoseMountingReset(referenceRotation, getYawOffset(bodyPart, resetsConfig.armsMountingResetMode)) } // By priority, higher value = higher priority. 0 for others. diff --git a/server/core/src/main/java/dev/slimevr/solarxr/rpc/resets.kt b/server/core/src/main/java/dev/slimevr/solarxr/rpc/resets.kt index 10a6fbadd..2bed0f25a 100644 --- a/server/core/src/main/java/dev/slimevr/solarxr/rpc/resets.kt +++ b/server/core/src/main/java/dev/slimevr/solarxr/rpc/resets.kt @@ -19,7 +19,7 @@ class ResetsBehaviour( receiver.sendRpc( ResetsSettingsResponse( resetMountingFeet = config.resetMountingFeet, - armsResetMode = config.armsResetMode, + armsMountingResetMode = config.armsMountingResetMode, yawResetSmoothTime = config.yawResetSmoothTime, saveMountingReset = config.saveMountingReset, resetReliableReferenceAttitude = config.resetReliableReferenceAttitude, @@ -35,7 +35,7 @@ class ResetsBehaviour( copy( resetsConfig = ResetsConfig( resetMountingFeet = req.resetMountingFeet, - armsResetMode = req.armsResetMode, + armsMountingResetMode = req.armsMountingResetMode, yawResetSmoothTime = req.yawResetSmoothTime, saveMountingReset = req.saveMountingReset, resetReliableReferenceAttitude = req.resetReliableReferenceAttitude, diff --git a/server/core/src/main/java/dev/slimevr/tracker/behaviours/rest-orientation.kt b/server/core/src/main/java/dev/slimevr/tracker/behaviours/rest-orientation.kt deleted file mode 100644 index 627490922..000000000 --- a/server/core/src/main/java/dev/slimevr/tracker/behaviours/rest-orientation.kt +++ /dev/null @@ -1,52 +0,0 @@ -package dev.slimevr.tracker.behaviours - -import com.jme3.math.FastMath -import dev.slimevr.config.Settings -import dev.slimevr.resets.ResetBodyParts -import dev.slimevr.tracker.Tracker -import dev.slimevr.tracker.TrackerActions -import dev.slimevr.tracker.TrackerBehaviour -import io.github.axisangles.ktmath.EulerAngles -import io.github.axisangles.ktmath.EulerOrder -import io.github.axisangles.ktmath.Quaternion -import kotlinx.coroutines.flow.combine -import kotlinx.coroutines.flow.distinctUntilChanged -import kotlinx.coroutines.flow.launchIn -import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.onEach -import solarxr_protocol.datatypes.BodyPart -import solarxr_protocol.rpc.ArmsResetMode - -/** - * Sets the orientation the tracker should match after a Full Reset. - * Used for T-Pose down. - */ -class TrackerRestOrientationBehaviour( - private val settings: Settings, -) : TrackerBehaviour { - override fun observe(receiver: Tracker) { - val armsResetModeFlow = settings.context.state.map { it.data.resetsConfig.armsResetMode } - val bodyPartFlow = receiver.context.state.map { it.bodyPart }.distinctUntilChanged() - - combine(armsResetModeFlow, bodyPartFlow) { armsResetMode, bodyPart -> - getRestOrientation(bodyPart, armsResetMode) - } - .distinctUntilChanged() - .onEach { restOrientation -> - receiver.context.dispatch(TrackerActions.SetRestOrientation(restOrientation)) - } - .launchIn(receiver.context.scope) - } - - private val quarterRollLeft = EulerAngles(EulerOrder.YZX, 0f, 0f, -FastMath.HALF_PI).toQuaternion() - private val quarterRollRight = EulerAngles(EulerOrder.YZX, 0f, 0f, FastMath.HALF_PI).toQuaternion() - private fun getRestOrientation(bodyPart: BodyPart?, armsResetMode: ArmsResetMode) = if (armsResetMode == ArmsResetMode.T_POSE_DOWN) { - when (bodyPart) { - in ResetBodyParts.LEFT_ARM -> quarterRollLeft - in ResetBodyParts.RIGHT_ARM -> quarterRollRight - else -> Quaternion.IDENTITY - } - } else { - Quaternion.IDENTITY - } -} diff --git a/server/core/src/main/java/dev/slimevr/tracker/module.kt b/server/core/src/main/java/dev/slimevr/tracker/module.kt index 4f0a8dfd0..5e42f992a 100644 --- a/server/core/src/main/java/dev/slimevr/tracker/module.kt +++ b/server/core/src/main/java/dev/slimevr/tracker/module.kt @@ -11,7 +11,6 @@ import dev.slimevr.tracker.behaviours.TrackerAssignmentConflictBehaviour import dev.slimevr.tracker.behaviours.TrackerConfigBehaviour import dev.slimevr.tracker.behaviours.TrackerDefaultMountingOrientationBehaviour import dev.slimevr.tracker.behaviours.TrackerMotionDetectionBehaviour -import dev.slimevr.tracker.behaviours.TrackerRestOrientationBehaviour import dev.slimevr.tracker.behaviours.TrackerRotationRefreshBehaviour import dev.slimevr.tracker.behaviours.TrackerStaleCalibrationBehaviour import dev.slimevr.tracker.behaviours.TrackerStayAlignedBehaviour @@ -70,7 +69,6 @@ data class TrackerState( val trackerDataType: TrackerDataType, // TODO val lastMountingMethod: MountingMethod, val mountingOrientation: HeadingAlignment, - val restOrientation: RestOrientation, val lastReference: Quaternion?, val sessionCalibration: SessionCalibration, val rawRotation: RawRotation, @@ -113,7 +111,6 @@ sealed interface TrackerActions { data class SetDriverName(val driverName: String?) : TrackerActions data class SetRotation(val rotation: Quaternion? = null, val acceleration: Vector3? = null, val magnetometer: Vector3? = null, val position: Vector3? = null, val increaseTps: Boolean = true) : TrackerActions data class SetMountingOrientation(val mountingOrientation: HeadingAlignment) : TrackerActions - data class SetRestOrientation(val restOrientation: Quaternion) : TrackerActions data class FullReset(val referenceRotation: Quaternion?, val resetReliableReferenceAttitude: Boolean = false) : TrackerActions data class YawReset(val referenceRotation: Quaternion?, val smoothTime: Duration = Duration.ZERO) : TrackerActions data class TickYawResetSmoothing(val heading: HeadingCorrection, val done: Boolean) : TrackerActions @@ -186,7 +183,6 @@ class Tracker( TrackerConfigBehaviour(settings, hardwareId), TrackerMotionDetectionBehaviour(), TrackerToSkeletonBehaviour(), - TrackerRestOrientationBehaviour(settings), TrackerStayAlignedBehaviour(settings), ) val context = Context.create( @@ -217,7 +213,6 @@ class Tracker( trackerDataType = TrackerDataType.ROTATION, lastMountingMethod = MountingMethod.MANUAL, mountingOrientation = Quaternion.IDENTITY, - restOrientation = Quaternion.IDENTITY, lastReference = Quaternion.IDENTITY, sessionCalibration = SessionCalibration(), rawRotation = Quaternion.IDENTITY, diff --git a/server/core/src/main/java/dev/slimevr/tracker/reducer.kt b/server/core/src/main/java/dev/slimevr/tracker/reducer.kt index 446640706..289b2b846 100644 --- a/server/core/src/main/java/dev/slimevr/tracker/reducer.kt +++ b/server/core/src/main/java/dev/slimevr/tracker/reducer.kt @@ -93,11 +93,6 @@ fun reduce( ) } - is TrackerActions.SetRestOrientation -> state.copy( - restOrientation = action.restOrientation, - rotationDirty = true, - ) - is TrackerActions.FullReset -> { val alignAttitude = !state.isAssignedReliableReference || (action.resetReliableReferenceAttitude && action.referenceRotation == null) val correctHeading = action.referenceRotation != null && !state.isAssignedReliableReference diff --git a/server/core/src/main/java/dev/slimevr/tracker/session-calibration.kt b/server/core/src/main/java/dev/slimevr/tracker/session-calibration.kt index 6513bcd7a..b231b8bea 100644 --- a/server/core/src/main/java/dev/slimevr/tracker/session-calibration.kt +++ b/server/core/src/main/java/dev/slimevr/tracker/session-calibration.kt @@ -10,7 +10,6 @@ typealias RawAcceleration = Vector3 typealias HeadingCorrection = Quaternion typealias AttitudeAlignment = Quaternion typealias HeadingAlignment = Quaternion -typealias RestOrientation = Quaternion typealias AccelerationRotation = Quaternion @@ -28,8 +27,7 @@ fun applyCalibration( headingCorrect: HeadingCorrection = Quaternion.IDENTITY, attitudeAlign: AttitudeAlignment = Quaternion.IDENTITY, headingAlign: HeadingAlignment = Quaternion.IDENTITY, - restOrientation: RestOrientation = Quaternion.IDENTITY, -): CalibratedRotation = headingAlign.inv() * headingCorrect * rawRotation * attitudeAlign * headingAlign * restOrientation +): CalibratedRotation = headingAlign.inv() * headingCorrect * rawRotation * attitudeAlign * headingAlign fun applyFullCalibration( rawRotation: CalibratedRotation, @@ -43,7 +41,6 @@ fun applyFullCalibration( headingCorrection, trackerState.sessionCalibration.attitudeAlignment, headingAlignment, - trackerState.restOrientation, ) } diff --git a/solarxr-protocol b/solarxr-protocol index 8774c9df1..14712dea4 160000 --- a/solarxr-protocol +++ b/solarxr-protocol @@ -1 +1 @@ -Subproject commit 8774c9df1c35c324e19ba1e987cd491c7bb731de +Subproject commit 14712dea4743e3986fad57330744b91730bcca0b