No more T-pose (down)

To be superseded by https://github.com/SlimeVR/SlimeVR-Server/issues/1944
math was wrong anyways
This commit is contained in:
Erimel committed 2026-10-02 12:36:01 -04:00
1 parent 5e8cbb2a0b
commit 52fb3f8fc4
14 files changed
+47 -128

No files matched your search

+8 -10
View File
@@ -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
@@ -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, string> = {
[ArmsResetMode.BACK]: 'back',
[ArmsResetMode.FORWARD]: 'forward',
[ArmsResetMode.T_POSE_UP]: 'tpose-up',
[ArmsResetMode.T_POSE_DOWN]: 'tpose-down',
const ARMS_MODE_NAMES: Record<ArmsMountingResetMode, string> = {
[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 };
}
@@ -1,6 +1,5 @@
import { useState } from 'react';
import { Button } from '@/components/commons/Button';
import { Typography } from '@/components/commons/Typography';
import {
PoseMountingInstructions,
PoseMountingVideo,
@@ -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() {
<>
<div className="flex flex-col pt-5 pb-2 gap-1">
<Typography variant="section-title">
{l10n.getString('settings-general-fk_settings-arm_fk-reset_mode')}
{l10n.getString(
'settings-general-fk_settings-arms_mounting_reset_mode'
)}
</Typography>
<Typography>
{l10n.getString(
'settings-general-fk_settings-arm_fk-reset_mode-description'
'settings-general-fk_settings-arms_mounting_reset_mode-description'
)}
</Typography>
<div className="grid md:grid-cols-2 flex-col gap-3">
<div className="grid flex-col gap-2">
<Radio
control={control}
name="armsResetMode"
name="armsMountingResetMode"
label={l10n.getString(
'settings-general-fk_settings-arm_fk-back'
'settings-general-fk_settings-arms_mounting_reset_mode-back'
)}
description={l10n.getString(
'settings-general-fk_settings-arm_fk-back-description'
'settings-general-fk_settings-arms_mounting_reset_mode-back-description'
)}
value={'0'}
/>
<Radio
control={control}
name="armsResetMode"
name="armsMountingResetMode"
label={l10n.getString(
'settings-general-fk_settings-arm_fk-forward'
'settings-general-fk_settings-arms_mounting_reset_mode-forward'
)}
description={l10n.getString(
'settings-general-fk_settings-arm_fk-forward-description'
'settings-general-fk_settings-arms_mounting_reset_mode-forward-description'
)}
value={'1'}
/>
<Radio
control={control}
name="armsResetMode"
name="armsMountingResetMode"
label={l10n.getString(
'settings-general-fk_settings-arm_fk-tpose_up'
'settings-general-fk_settings-arms_mounting_reset_mode-t_pose'
)}
description={l10n.getString(
'settings-general-fk_settings-arm_fk-tpose_up-description'
'settings-general-fk_settings-arms_mounting_reset_mode-t_pose-description'
)}
value={'2'}
/>
<Radio
control={control}
name="armsResetMode"
label={l10n.getString(
'settings-general-fk_settings-arm_fk-tpose_down'
)}
description={l10n.getString(
'settings-general-fk_settings-arm_fk-tpose_down-description'
)}
value={'3'}
/>
</div>
</div>
@@ -5,7 +5,6 @@ import {
trackingchecklistIdtoLabel,
} from '@/hooks/tracking-checklist';
import classNames from 'classnames';
import { Clickable } from '@/components/commons/Clickable';
import {
EnableSteamVRDriverRequestT,
ResetType,
+1 -1
View File
@@ -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);
@@ -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 */
@@ -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.
@@ -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,
@@ -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
}
}
@@ -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,
@@ -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
@@ -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,
)
}