(null);
const { config, setConfig } = useConfig();
@@ -410,9 +410,9 @@ export function ScaledProportionsPage() {
);
const applyHeight = (newHeight: number) => {
- setHmdHeight(newHeight);
+ setHeadHeight(newHeight);
const skeletonSettingsRequest = new ChangeUserHeightRequestT();
- skeletonSettingsRequest.hmdHeight = newHeight;
+ skeletonSettingsRequest.headHeight = newHeight;
skeletonSettingsRequest.floorHeight = 0;
sendRPCPacket(RpcMessage.ChangeUserHeightRequest, skeletonSettingsRequest);
sendRPCPacket(
@@ -431,7 +431,7 @@ export function ScaledProportionsPage() {
}
setState(res);
- setHmdHeight(res.hmdHeight);
+ setHeadHeight(res.headHeight);
if (res.status === UserHeightCalibrationStatus.DONE) {
setConfig({ lastUsedProportions: 'scaled' });
@@ -443,7 +443,7 @@ export function ScaledProportionsPage() {
useRPCPacket(
RpcMessage.SkeletonProportionsResponse,
(res: SkeletonProportionsResponseT) => {
- setHmdHeight(res.skeletonHeight);
+ setHeadHeight(res.skeletonHeight);
}
);
@@ -529,7 +529,7 @@ export function ScaledProportionsPage() {
const controls = (
- {hmdHeight > 0 && (
+ {headHeight > 0 && (
- {formatFullHeight(hmdHeight, heightUnit, currentLocales)}
+ {formatFullHeight(headHeight, heightUnit, currentLocales)}
)}
diff --git a/gui/app/src/components/onboarding/pages/body-proportions/autobone-steps/TooSmolModal.tsx b/gui/app/src/components/onboarding/pages/body-proportions/autobone-steps/TooSmolModal.tsx
index 98495db82..059fa3d41 100644
--- a/gui/app/src/components/onboarding/pages/body-proportions/autobone-steps/TooSmolModal.tsx
+++ b/gui/app/src/components/onboarding/pages/body-proportions/autobone-steps/TooSmolModal.tsx
@@ -22,7 +22,7 @@ export function TooSmolModal({
onClose: () => void;
} & ReactModal.Props) {
const { l10n } = useLocalization();
- const { hmdHeight, floorHeight } = useHeightContext();
+ const { headHeight, floorHeight } = useHeightContext();
const { currentLocales } = useLocaleConfig();
const mFormat = useMemo(
@@ -50,7 +50,7 @@ export function TooSmolModal({
id="onboarding-automatic_proportions-smol_warning"
elems={{ b: }}
vars={{
- height: mFormat.format((hmdHeight ?? 0) - (floorHeight ?? 0)),
+ height: mFormat.format((headHeight ?? 0) - (floorHeight ?? 0)),
minHeight: mFormat.format(MIN_HEIGHT),
}}
>
diff --git a/gui/app/src/components/settings/pages/components/ResetsSettings.tsx b/gui/app/src/components/settings/pages/components/ResetsSettings.tsx
index c10e0cde5..a4dd19863 100644
--- a/gui/app/src/components/settings/pages/components/ResetsSettings.tsx
+++ b/gui/app/src/components/settings/pages/components/ResetsSettings.tsx
@@ -21,7 +21,7 @@ type ResetsSettingsForm = {
armsResetMode: number;
yawResetSmoothTime: number;
saveMountingReset: boolean;
- resetHmdAttitude: boolean;
+ resetReliableReferenceAttitude: boolean;
};
const defaultValues: ResetsSettingsForm = {
@@ -29,7 +29,7 @@ const defaultValues: ResetsSettingsForm = {
armsResetMode: 0,
yawResetSmoothTime: 0.0,
saveMountingReset: false,
- resetHmdAttitude: false,
+ resetReliableReferenceAttitude: false,
};
const resetsSettingsAtom = atom(new ResetsSettingsResponseT());
@@ -66,7 +66,8 @@ export function ResetsSettings() {
resetsSettings.armsResetMode = values.armsResetMode;
resetsSettings.yawResetSmoothTime = values.yawResetSmoothTime;
resetsSettings.saveMountingReset = values.saveMountingReset;
- resetsSettings.resetHmdAttitude = values.resetHmdAttitude;
+ resetsSettings.resetReliableReferenceAttitude =
+ values.resetReliableReferenceAttitude;
sendRPCPacket(RpcMessage.ChangeResetsSettingsRequest, resetsSettings);
};
@@ -205,13 +206,13 @@ export function ResetsSettings() {
{l10n.getString(
- 'settings-general-fk_settings-reset_settings-reset_hmd_attitude'
+ 'settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude'
)}
{l10n.getString(
- 'settings-general-fk_settings-reset_settings-reset_hmd_attitude-description'
+ 'settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude-description'
)}
@@ -219,9 +220,9 @@ export function ResetsSettings() {
variant="toggle"
outlined
control={control}
- name="resetHmdAttitude"
+ name="resetReliableReferenceAttitude"
label={l10n.getString(
- 'settings-general-fk_settings-reset_settings-reset_hmd_attitude'
+ 'settings-general-fk_settings-reset_settings-reset_reliable_reference_attitude'
)}
/>
diff --git a/gui/app/src/components/tracking-checklist/TrackingChecklist.tsx b/gui/app/src/components/tracking-checklist/TrackingChecklist.tsx
index bfb343216..b6f5a32f2 100644
--- a/gui/app/src/components/tracking-checklist/TrackingChecklist.tsx
+++ b/gui/app/src/components/tracking-checklist/TrackingChecklist.tsx
@@ -320,8 +320,10 @@ const stepContentLookup: Record<
[TrackingChecklistStepId.TRACKER_ERROR]: () => {
return ;
},
- [TrackingChecklistStepId.UNASSIGNED_HMD]: () => {
- return ;
+ [TrackingChecklistStepId.UNASSIGNED_RELIABLE_REFERENCE]: () => {
+ return (
+
+ );
},
[TrackingChecklistStepId.NETWORK_PROFILE_PUBLIC]: (
step,
diff --git a/gui/app/src/hooks/height.ts b/gui/app/src/hooks/height.ts
index 23c44ac88..b4f73f8cc 100644
--- a/gui/app/src/hooks/height.ts
+++ b/gui/app/src/hooks/height.ts
@@ -8,15 +8,15 @@ import {
import { MIN_HEIGHT } from './manual-proportions';
export interface HeightContext {
- hmdHeight: number | null;
- setHmdHeight: React.Dispatch>;
+ headHeight: number | null;
+ setHeadHeight: React.Dispatch>;
floorHeight: number | null;
setFloorHeight: React.Dispatch>;
currentHeight: number | null;
}
export function useProvideHeightContext(): HeightContext {
- const [hmdHeight, setHmdHeight] = useState(null);
+ const [headHeight, setHeadHeight] = useState(null);
const [floorHeight, setFloorHeight] = useState(null);
const { sendRPCPacket, useRPCPacket } = useWebsocketAPI();
@@ -26,21 +26,27 @@ export function useProvideHeightContext(): HeightContext {
[]
);
useRPCPacket(RpcMessage.UserHeightResponse, (res: UserHeightResponseT) => {
- const hmd = res.hmdHeight;
+ const head = res.headHeight;
const floor = res.floorHeight;
- if (validateHeight(hmd, floor)) {
- setHmdHeight(hmd ?? null);
+ if (validateHeight(head, floor)) {
+ setHeadHeight(head ?? null);
setFloorHeight(floor ?? null);
}
});
const currentHeight = useMemo(
- () => computeHeight(hmdHeight, floorHeight),
- [hmdHeight, floorHeight]
+ () => computeHeight(headHeight, floorHeight),
+ [headHeight, floorHeight]
);
- return { hmdHeight, setHmdHeight, floorHeight, setFloorHeight, currentHeight };
+ return {
+ headHeight,
+ setHeadHeight: setHeadHeight,
+ floorHeight,
+ setFloorHeight,
+ currentHeight,
+ };
}
export const HeightContextC = createContext(undefined as never);
@@ -54,19 +60,19 @@ export function useHeightContext() {
}
export function validateHeight(
- hmdHeight: number | null | undefined,
+ headHeight: number | null | undefined,
floorHeight: number | null | undefined
) {
- const height = computeHeight(hmdHeight, floorHeight);
+ const height = computeHeight(headHeight, floorHeight);
return height != null && height >= MIN_HEIGHT;
}
export function computeHeight(
- hmdHeight: number | null | undefined,
+ headHeight: number | null | undefined,
floorHeight: number | null | undefined
) {
- return hmdHeight !== undefined && hmdHeight !== null
- ? hmdHeight - (floorHeight ?? 0)
+ return headHeight !== undefined && headHeight !== null
+ ? headHeight - (floorHeight ?? 0)
: null;
}
diff --git a/gui/app/src/hooks/onboarding.ts b/gui/app/src/hooks/onboarding.ts
index 9ac05b579..0786fda67 100644
--- a/gui/app/src/hooks/onboarding.ts
+++ b/gui/app/src/hooks/onboarding.ts
@@ -130,7 +130,7 @@ export function useProvideOnboarding() {
sendRPCPacket(RpcMessage.ChangeSkeletonSettingsRequest, skeletonReq);
const resetsReq = Object.assign(new ChangeResetsSettingsRequestT(), resetsSettings);
- resetsReq.resetHmdAttitude = mocapPos === 'forehead';
+ resetsReq.resetReliableReferenceAttitude = mocapPos === 'forehead';
sendRPCPacket(RpcMessage.ChangeResetsSettingsRequest, resetsReq);
const osc = Object.assign(new VRCOSCSettingsResponseT(), vrcOscSettings);
diff --git a/gui/app/src/hooks/tracking-checklist.ts b/gui/app/src/hooks/tracking-checklist.ts
index ce40fe02e..408cea14d 100644
--- a/gui/app/src/hooks/tracking-checklist.ts
+++ b/gui/app/src/hooks/tracking-checklist.ts
@@ -26,7 +26,8 @@ export const trackingchecklistIdtoLabel: Record
[TrackingChecklistStepId.VRCHAT_SETTINGS]: 'tracking_checklist-VRCHAT_SETTINGS',
[TrackingChecklistStepId.STEAMVR_DISCONNECTED]:
'tracking_checklist-STEAMVR_DISCONNECTED',
- [TrackingChecklistStepId.UNASSIGNED_HMD]: 'tracking_checklist-UNASSIGNED_HMD',
+ [TrackingChecklistStepId.UNASSIGNED_RELIABLE_REFERENCE]:
+ 'tracking_checklist-UNASSIGNED_RELIABLE_REFERENCE',
[TrackingChecklistStepId.TRACKER_ERROR]: 'tracking_checklist-TRACKER_ERROR',
[TrackingChecklistStepId.NETWORK_PROFILE_PUBLIC]:
'tracking_checklist-NETWORK_PROFILE_PUBLIC',
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 b7c6d7b8c..52bce789a 100644
--- a/server/core/src/main/java/dev/slimevr/config/settings.kt
+++ b/server/core/src/main/java/dev/slimevr/config/settings.kt
@@ -98,8 +98,8 @@ data class ResetsConfig(
val yawResetSmoothTime: Float = 0.0f,
/** Save automatic mounting reset calibration */
val saveMountingReset: Boolean = false,
- /** Reset a VR headset's attitude on full reset */
- val resetHmdAttitude: Boolean = false,
+ /** Reset a reliable reference's (HMD) attitude on full reset */
+ val resetReliableReferenceAttitude: Boolean = false,
/** Used as preferred mounting method and tracking checklist */
val lastMountingMethod: MountingMethod = MountingMethod.POSE,
)
diff --git a/server/core/src/main/java/dev/slimevr/heightcalibration/behaviours.kt b/server/core/src/main/java/dev/slimevr/heightcalibration/behaviours.kt
index 372795dd8..50a5367fd 100644
--- a/server/core/src/main/java/dev/slimevr/heightcalibration/behaviours.kt
+++ b/server/core/src/main/java/dev/slimevr/heightcalibration/behaviours.kt
@@ -25,16 +25,16 @@ import kotlin.math.sqrt
internal const val SAMPLE_INTERVAL_MS = 16L
private const val FLOOR_ALPHA = 0.1f
-private const val HMD_ALPHA = 0.1f
+private const val HEAD_ALPHA = 0.1f
private const val CONTROLLER_STABILITY_THRESHOLD = 0.005f
internal const val CONTROLLER_STABILITY_DURATION = 300_000_000L
-private const val HMD_STABILITY_THRESHOLD = 0.003f
+private const val HEAD_STABILITY_THRESHOLD = 0.003f
internal const val HEAD_STABILITY_DURATION = 600_000_000L
internal const val MAX_FLOOR_Y = 0.10f
-internal const val HMD_RISE_THRESHOLD = 1.2f
+internal const val HEAD_RISE_THRESHOLD = 1.2f
internal const val HEIGHT_MIN = 1.4f
internal const val HEIGHT_MAX = 1.936f
@@ -57,18 +57,18 @@ private fun isControllerPointingDown(snapshot: TrackerSnapshot): Boolean {
return (forward dot Vector3.NEG_Y) >= CONTROLLER_ANGLE_THRESHOLD
}
-private fun isHmdLeveled(snapshot: TrackerSnapshot): Boolean {
+private fun isHeadLeveled(snapshot: TrackerSnapshot): Boolean {
val up = snapshot.rotation.sandwich(Vector3.POS_Y)
return (up dot Vector3.POS_Y) >= HEAD_ANGLE_THRESHOLD
}
class BaseCalibrationBehaviour : HeightCalibrationBehaviourType {
fun canCalibrate(trackers: List): Boolean {
- val hasHmd = trackers.any { it.bodyPart == BodyPart.HEAD && it.position != null }
- val hasHand = trackers.any {
+ val hasPositionalHead = trackers.any { it.bodyPart == BodyPart.HEAD && it.position != null }
+ val hasPositionalHand = trackers.any {
(it.bodyPart == BodyPart.LEFT_HAND || it.bodyPart == BodyPart.RIGHT_HAND) && it.position != null
}
- return hasHmd && hasHand
+ return hasPositionalHead && hasPositionalHand
}
override fun observe(receiver: HeightCalibrationManager) {
@@ -96,7 +96,7 @@ class BaseCalibrationBehaviour : HeightCalibrationBehaviourType {
internal suspend fun runCalibrationSession(
context: HeightCalibrationContext,
userConfig: UserConfig,
- hmdUpdates: kotlinx.coroutines.flow.Flow,
+ headUpdates: kotlinx.coroutines.flow.Flow,
controllerUpdates: kotlinx.coroutines.flow.Flow,
clock: () -> Long = System::nanoTime,
) {
@@ -107,8 +107,8 @@ internal suspend fun runCalibrationSession(
var floorFiltered: Vector3? = null
var floorEnergyEma = 0f
- var hmdFiltered: Vector3? = null
- var hmdEnergyEma = 0f
+ var headFiltered: Vector3? = null
+ var headEnergyEma = 0f
fun dispatch(status: UserHeightCalibrationStatus, height: Float = currentHeight) {
currentHeight = height
@@ -163,43 +163,43 @@ internal suspend fun runCalibrationSession(
}
// Height phase: collect HMD updates until a terminal status is reached
- hmdUpdates
+ headUpdates
.sample(SAMPLE_INTERVAL_MS)
.takeWhile { !context.state.value.status.isTerminal() }
.collect { snapshot ->
val now = clock()
val relativeY = snapshot.position.y - currentFloorLevel
- if (relativeY <= HMD_RISE_THRESHOLD) {
+ if (relativeY <= HEAD_RISE_THRESHOLD) {
dispatch(UserHeightCalibrationStatus.WAITING_FOR_RISE, relativeY)
heightStableStart = null
- hmdFiltered = null
- hmdEnergyEma = 0f
+ headFiltered = null
+ headEnergyEma = 0f
return@collect
}
- if (!isHmdLeveled(snapshot)) {
+ if (!isHeadLeveled(snapshot)) {
dispatch(UserHeightCalibrationStatus.WAITING_FOR_FW_LOOK, relativeY)
heightStableStart = null
- hmdFiltered = null
- hmdEnergyEma = 0f
+ headFiltered = null
+ headEnergyEma = 0f
return@collect
}
dispatch(UserHeightCalibrationStatus.RECORDING_HEIGHT, relativeY)
val pos = snapshot.position
- val prev = hmdFiltered ?: pos
- val newFiltered = prev * (1f - HMD_ALPHA) + pos * HMD_ALPHA
- hmdFiltered = newFiltered
+ val prev = headFiltered ?: pos
+ val newFiltered = prev * (1f - HEAD_ALPHA) + pos * HEAD_ALPHA
+ headFiltered = newFiltered
val dev = pos - newFiltered
- hmdEnergyEma = hmdEnergyEma * (1f - HMD_ALPHA) + (dev dot dev) * HMD_ALPHA
+ headEnergyEma = headEnergyEma * (1f - HEAD_ALPHA) + (dev dot dev) * HEAD_ALPHA
- if (sqrt(hmdEnergyEma) > HMD_STABILITY_THRESHOLD) {
+ if (sqrt(headEnergyEma) > HEAD_STABILITY_THRESHOLD) {
heightStableStart = null
- hmdFiltered = null
- hmdEnergyEma = 0f
+ headFiltered = null
+ headEnergyEma = 0f
return@collect
}
diff --git a/server/core/src/main/java/dev/slimevr/heightcalibration/module.kt b/server/core/src/main/java/dev/slimevr/heightcalibration/module.kt
index 1f3a27734..cdeda88a4 100644
--- a/server/core/src/main/java/dev/slimevr/heightcalibration/module.kt
+++ b/server/core/src/main/java/dev/slimevr/heightcalibration/module.kt
@@ -53,17 +53,17 @@ class HeightCalibrationManager(
private var sessionJob: Job? = null
// These Flows do nothing until the calibration use collect on it
- val hmdUpdates: Flow = serverContext.context.state
+ val headUpdates: Flow = serverContext.context.state
.flatMapLatest { state ->
- val hmd = state.trackers.values
+ val positionalHead = state.trackers.values
.find {
val state = it.context.state.value
state.bodyPart == BodyPart.HEAD && state.status == TrackerStatus.OK && state.position != null
}
?: return@flatMapLatest emptyFlow()
- hmd.context.state.map { s ->
+ positionalHead.context.state.map { s ->
TrackerSnapshot(
- position = s.position ?: error("head (or HMD) will always have a position in this case"),
+ position = s.position ?: error("Head will always have a position here."),
rotation = s.rawRotation,
)
}
@@ -89,7 +89,7 @@ class HeightCalibrationManager(
fun start() {
sessionJob?.cancel()
- sessionJob = context.scope.launch { runCalibrationSession(context, userConfig, hmdUpdates, controllerUpdates) }
+ sessionJob = context.scope.launch { runCalibrationSession(context, userConfig, headUpdates, controllerUpdates) }
}
fun cancel() {
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 8570ec52e..afcb0606f 100644
--- a/server/core/src/main/java/dev/slimevr/resets/module.kt
+++ b/server/core/src/main/java/dev/slimevr/resets/module.kt
@@ -152,21 +152,19 @@ class ResetsManager(val context: ResetsContext, val server: VRServer, val settin
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.resetHmdAttitude)
+ ResetType.FULL -> TrackerActions.FullReset(referenceRotation, resetsConfig.resetReliableReferenceAttitude)
ResetType.POSE_MOUNTING -> TrackerActions.PoseMountingReset(referenceRotation, getYawOffset(bodyPart, resetsConfig.armsResetMode))
}
- // TODO: currently HMD is a special case for calibration, but we should have something
- // more generic like "isReliable" in state or in the reset actions parameters.
- // Also need to make it more generic in the tracker reducer.
private fun getReliableReferenceTracker(allTrackers: Collection) = allTrackers.firstOrNull {
val state = it.context.state.value
- state.isHmd && state.bodyPart == BodyPart.HEAD && state.status.isActive()
+ state.isAssignedReliableReference && state.status.isActive()
}
// By priority, higher value = higher priority. 0 for others.
private val referenceBodyParts = mapOf(
- BodyPart.HEAD to 6,
+ BodyPart.HEAD to 7,
+ BodyPart.NECK to 6,
BodyPart.UPPER_CHEST to 5,
BodyPart.LOWER_CHEST to 4,
BodyPart.HIP to 3,
diff --git a/server/core/src/main/java/dev/slimevr/solarxr/rpc/height-calibration.kt b/server/core/src/main/java/dev/slimevr/solarxr/rpc/height-calibration.kt
index 1ea701fca..1f99087ec 100644
--- a/server/core/src/main/java/dev/slimevr/solarxr/rpc/height-calibration.kt
+++ b/server/core/src/main/java/dev/slimevr/solarxr/rpc/height-calibration.kt
@@ -26,7 +26,7 @@ class HeightCalibrationBehaviour(
receiver.sendRpc(
UserHeightRecordingStatusResponse(
status = state.status,
- hmdHeight = state.currentHeight,
+ headHeight = state.currentHeight,
),
)
}.launchIn(receiver.context.scope)
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 eade41984..87621d383 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
@@ -22,7 +22,7 @@ class ResetsBehaviour(
armsResetMode = config.armsResetMode,
yawResetSmoothTime = config.yawResetSmoothTime,
saveMountingReset = config.saveMountingReset,
- resetHmdAttitude = config.resetHmdAttitude,
+ resetReliableReferenceAttitude = config.resetReliableReferenceAttitude,
),
)
}.launchIn(receiver.context.scope)
@@ -37,7 +37,7 @@ class ResetsBehaviour(
armsResetMode = req.armsResetMode,
yawResetSmoothTime = req.yawResetSmoothTime,
saveMountingReset = req.saveMountingReset,
- resetHmdAttitude = req.resetHmdAttitude,
+ resetReliableReferenceAttitude = req.resetReliableReferenceAttitude,
),
)
},
diff --git a/server/core/src/main/java/dev/slimevr/solarxr/rpc/skeleton-proportions.kt b/server/core/src/main/java/dev/slimevr/solarxr/rpc/skeleton-proportions.kt
index ece5203fd..4f5fbb25d 100644
--- a/server/core/src/main/java/dev/slimevr/solarxr/rpc/skeleton-proportions.kt
+++ b/server/core/src/main/java/dev/slimevr/solarxr/rpc/skeleton-proportions.kt
@@ -62,9 +62,9 @@ class SkeletonProportionsBehaviour(
}.launchIn(receiver.context.scope)
receiver.rpcDispatcher.on { req ->
- val hmdHeight = req.hmdHeight ?: return@on
+ val headHeight = req.headHeight ?: return@on
val floorHeight = req.floorHeight ?: 0f
- val height = hmdHeight - floorHeight
+ val height = headHeight - floorHeight
if (height >= MIN_HEIGHT) {
userConfig.context.dispatch(
UserConfigActions.Update {
diff --git a/server/core/src/main/java/dev/slimevr/solarxr/rpc/tracking-checklist.kt b/server/core/src/main/java/dev/slimevr/solarxr/rpc/tracking-checklist.kt
index 68df7a346..1e299e9ea 100644
--- a/server/core/src/main/java/dev/slimevr/solarxr/rpc/tracking-checklist.kt
+++ b/server/core/src/main/java/dev/slimevr/solarxr/rpc/tracking-checklist.kt
@@ -24,7 +24,7 @@ private val CHECKLIST_STEP_ORDER: List = listOf(
TrackingChecklistStepId.FULL_RESET,
TrackingChecklistStepId.MOUNTING_CALIBRATION,
TrackingChecklistStepId.FEET_MOUNTING_CALIBRATION,
- TrackingChecklistStepId.UNASSIGNED_HMD,
+ TrackingChecklistStepId.UNASSIGNED_RELIABLE_REFERENCE,
TrackingChecklistStepId.STAY_ALIGNED_CONFIGURED,
TrackingChecklistStepId.VRCHAT_OSC_TRACKING_DISABLED,
TrackingChecklistStepId.VRCHAT_SETTINGS,
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 f6939cfc6..2de0e927f 100644
--- a/server/core/src/main/java/dev/slimevr/tracker/module.kt
+++ b/server/core/src/main/java/dev/slimevr/tracker/module.kt
@@ -90,8 +90,11 @@ data class TrackerState(
val stayAlignedData: StayAlignedData,
val pendingSkeletonResets: List = emptyList(),
) {
- /** Considered an HMD if it comes from driver and driver told us it's the head. */
- val isHmd = origin == DeviceOrigin.DRIVER && intendedBodyPart == BodyPart.HEAD
+ private val isHmd = origin == DeviceOrigin.DRIVER && intendedBodyPart == BodyPart.HEAD
+
+ /** Indicates if the tracker is a reliable reference for aligning other trackers. */
+ val isReliableReference = isHmd
+ val isAssignedReliableReference = isReliableReference && bodyPart == intendedBodyPart
}
fun List.getFirstActiveFor(bodyPart: BodyPart): TrackerState? = this.firstOrNull { it.bodyPart == bodyPart && it.status.isActive() }
@@ -106,7 +109,7 @@ sealed interface 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 resetHmdAttitude: Boolean = false) : 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
data class PoseMountingReset(val referenceRotation: Quaternion?, val yawOffset: Float) : TrackerActions
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 c1e7c2b68..78d55aac8 100644
--- a/server/core/src/main/java/dev/slimevr/tracker/reducer.kt
+++ b/server/core/src/main/java/dev/slimevr/tracker/reducer.kt
@@ -1,7 +1,6 @@
package dev.slimevr.tracker
import io.github.axisangles.ktmath.Quaternion
-import solarxr_protocol.datatypes.BodyPart
import solarxr_protocol.datatypes.MountingMethod
import solarxr_protocol.rpc.ResetType
import kotlin.time.Duration
@@ -71,8 +70,6 @@ fun reduce(
}
is TrackerActions.SetMountingOrientation -> {
- if (state.isHmd) return state
-
state.copy(
mountingOrientation = action.mountingOrientation,
sessionCalibration = state.sessionCalibration.copy(
@@ -89,11 +86,10 @@ fun reduce(
rotationDirty = true,
)
- // TODO centaur when using both a positional and an IMU tracker on spine.
is TrackerActions.FullReset -> {
- val alignAttitude = !state.isHmd || action.resetHmdAttitude
- val correctHeading = !state.isHmd && action.referenceRotation != null
- val alignHeading = !state.isHmd && state.position != null && action.referenceRotation != null
+ val alignAttitude = !state.isAssignedReliableReference || action.resetReliableReferenceAttitude
+ val correctHeading = action.referenceRotation != null
+ val alignHeading = state.position != null && action.referenceRotation != null
val referenceRotation = action.referenceRotation ?: state.rawRotation
@@ -110,7 +106,7 @@ fun reduce(
referenceRotation,
)
} else {
- state.sessionCalibration.attitudeAlignment
+ Quaternion.IDENTITY
}
val headingAlignment =
if (alignHeading) {
@@ -175,9 +171,9 @@ fun reduce(
val referenceRotation = action.referenceRotation ?: state.rotation
// Positional trackers' heading is aligned on full reset, not on mounting reset, except for a reference.
- val alignHeading = (state.position == null || action.referenceRotation == null) && !state.isHmd
+ val alignHeading = state.position == null || action.referenceRotation == null
// A positional reference tracker needs to correct its heading on mounting reset.
- val correctHeading = state.position != null && action.referenceRotation == null && !state.isHmd
+ val correctHeading = state.position != null && action.referenceRotation == null
val headingAlignment = if (alignHeading) {
estimateHeadingAlign(
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 09fc5c869..5b7f39545 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
@@ -36,12 +36,12 @@ fun applyFullCalibration(
rawRotation: CalibratedRotation,
trackerState: TrackerState,
): CalibratedRotation {
- // Don't use heading alignment for an assigned HMD
- val isAssignedHmd = trackerState.isHmd && trackerState.bodyPart == BodyPart.HEAD
- val headingAlignment = if (isAssignedHmd) Quaternion.IDENTITY else trackerState.sessionCalibration.headingAlignment
+ // Never use heading correction/alignment for an assigned reliable reference
+ val headingCorrection = if (trackerState.isAssignedReliableReference) Quaternion.IDENTITY else trackerState.sessionCalibration.headingCorrection
+ val headingAlignment = if (trackerState.isAssignedReliableReference) Quaternion.IDENTITY else trackerState.sessionCalibration.headingAlignment
return applyCalibration(
rawRotation,
- trackerState.sessionCalibration.headingCorrection,
+ headingCorrection,
trackerState.sessionCalibration.attitudeAlignment,
headingAlignment,
trackerState.restOrientation,
@@ -80,13 +80,13 @@ fun applyFullCalibration(
rawRotation: RawRotation,
trackerState: TrackerState,
): CalibratedAcceleration {
- // Don't use heading alignment for an assigned HMD
- val isAssignedHmd = trackerState.isHmd && trackerState.bodyPart == BodyPart.HEAD
- val headingAlignment = if (isAssignedHmd) Quaternion.IDENTITY else trackerState.sessionCalibration.headingAlignment
+ // Never use heading correction/alignment for an assigned reliable reference
+ val headingCorrection = if (trackerState.isAssignedReliableReference) Quaternion.IDENTITY else trackerState.sessionCalibration.headingCorrection
+ val headingAlignment = if (trackerState.isAssignedReliableReference) Quaternion.IDENTITY else trackerState.sessionCalibration.headingAlignment
return applyCalibration(
rawAcceleration,
rawRotation,
- trackerState.sessionCalibration.headingCorrection,
+ headingCorrection,
headingAlignment,
)
}
diff --git a/server/core/src/main/java/dev/slimevr/trackingchecklist/behaviours.kt b/server/core/src/main/java/dev/slimevr/trackingchecklist/behaviours.kt
index 8824ce137..8a8f0fe11 100644
--- a/server/core/src/main/java/dev/slimevr/trackingchecklist/behaviours.kt
+++ b/server/core/src/main/java/dev/slimevr/trackingchecklist/behaviours.kt
@@ -5,7 +5,6 @@ package dev.slimevr.trackingchecklist
import dev.slimevr.VRServer
import dev.slimevr.VRServerState
import dev.slimevr.config.Settings
-import dev.slimevr.device.DeviceState
import dev.slimevr.networkprofile.NetworkProfileManager
import dev.slimevr.resets.ResetBodyParts
import dev.slimevr.resets.ResetsManager
@@ -45,7 +44,7 @@ import solarxr_protocol.rpc.TrackingChecklistStepId
import solarxr_protocol.rpc.TrackingChecklistStepVisibility
import solarxr_protocol.rpc.TrackingChecklistTrackerError
import solarxr_protocol.rpc.TrackingChecklistTrackerReset
-import solarxr_protocol.rpc.TrackingChecklistUnassignedHMD
+import solarxr_protocol.rpc.TrackingChecklistUnassignedReliableReference
import solarxr_protocol.rpc.VRCOSCTrackingDataState
// Flat-maps a server state flow into a combined flow of all context states for a given collection.
@@ -77,7 +76,8 @@ data class ChecklistTracker(
val origin: DeviceOrigin,
val status: TrackerStatus,
val bodyPart: BodyPart?,
- val isHmd: Boolean,
+ val intendedBodyPart: BodyPart?,
+ val isReliableReference: Boolean,
val imuType: ImuType?,
val completedRestCalibration: Boolean?,
// Deliberately not the position itself: the checks only ask whether there is one, and carrying the
@@ -90,7 +90,8 @@ fun checklistTracker(tracker: TrackerState) = ChecklistTracker(
origin = tracker.origin,
status = tracker.status,
bodyPart = tracker.bodyPart,
- isHmd = tracker.isHmd,
+ intendedBodyPart = tracker.intendedBodyPart,
+ isReliableReference = tracker.isReliableReference,
imuType = tracker.imuType,
completedRestCalibration = tracker.completedRestCalibration,
hasPosition = tracker.position != null,
@@ -100,18 +101,19 @@ internal fun trackerStatesFlow(server: VRServer): Flow> =
tracker.context.state.map { state -> checklistTracker(state) }.distinctUntilChanged()
}
-class HMDCheckBehaviour(private val trackerStates: StateFlow>) : TrackingChecklistBehaviourType {
+class ReliableReferenceCheckBehaviour(private val trackerStates: StateFlow>) : TrackingChecklistBehaviourType {
private fun computeStep(trackers: List): TrackingChecklistStep {
- val hmdTracker = trackers.firstOrNull { tracker -> tracker.isHmd }
- val isAssigned = hmdTracker?.bodyPart == BodyPart.HEAD
+ val reliableReference = trackers.firstOrNull { tracker -> tracker.isReliableReference }
+ val isAssigned = reliableReference?.bodyPart == reliableReference?.intendedBodyPart
return TrackingChecklistStep(
valid = isAssigned,
- enabled = hmdTracker != null,
+ enabled = reliableReference != null,
ignorable = true,
visibility = TrackingChecklistStepVisibility.WHEN_INVALID,
- extraData = if (hmdTracker != null && !isAssigned) {
- TrackingChecklistUnassignedHMD(
- trackerId = hmdTracker.id.toUShort(),
+ extraData = if (reliableReference != null && !isAssigned) {
+ TrackingChecklistUnassignedReliableReference(
+ trackerId = reliableReference.id.toUShort(),
+ intendedBodyPart = reliableReference.intendedBodyPart ?: BodyPart.NONE,
)
} else {
null
@@ -123,7 +125,7 @@ class HMDCheckBehaviour(private val trackerStates: StateFlow computeStep(trackers) }
.distinctUntilChanged()
- .onEach { step -> receiver.context.dispatch(TrackingChecklistActions.UpdateStep(TrackingChecklistStepId.UNASSIGNED_HMD, step)) }
+ .onEach { step -> receiver.context.dispatch(TrackingChecklistActions.UpdateStep(TrackingChecklistStepId.UNASSIGNED_RELIABLE_REFERENCE, step)) }
.launchIn(receiver.context.scope)
}
}
diff --git a/server/core/src/main/java/dev/slimevr/trackingchecklist/module.kt b/server/core/src/main/java/dev/slimevr/trackingchecklist/module.kt
index af51c5cd6..d85c11530 100644
--- a/server/core/src/main/java/dev/slimevr/trackingchecklist/module.kt
+++ b/server/core/src/main/java/dev/slimevr/trackingchecklist/module.kt
@@ -29,7 +29,7 @@ class TrackingChecklist(
.stateIn(context.scope, SharingStarted.Eagerly, initialValue = emptyList())
val stepBehaviours: List = buildList {
- add(HMDCheckBehaviour(trackerStates))
+ add(ReliableReferenceCheckBehaviour(trackerStates))
add(TrackerRestCheckBehaviour(trackerStates))
add(FullResetCheckBehaviour(trackerStates, appContext.resetsManager))
add(MountingCalibrationCheckBehaviour(trackerStates, appContext.resetsManager, appContext.config.settings))
diff --git a/server/core/src/main/java/dev/slimevr/vrchat/module.kt b/server/core/src/main/java/dev/slimevr/vrchat/module.kt
index 52d730f9e..b023c22e2 100644
--- a/server/core/src/main/java/dev/slimevr/vrchat/module.kt
+++ b/server/core/src/main/java/dev/slimevr/vrchat/module.kt
@@ -16,7 +16,7 @@ import solarxr_protocol.rpc.VRCSpineMode
import solarxr_protocol.rpc.VRCTrackerModel
import kotlin.math.abs
-// The HMD height is taken from the HMD pose, which is between the eyes.
+// The head height is usually taken from the HMD pose, which is between the eyes.
// This compensates for the offset to the full height (top of the head).
// From Drillis and Contini (1966)
const val EYE_HEIGHT_TO_HEIGHT_RATIO = 0.936f
diff --git a/server/core/src/test/java/dev/slimevr/heightcalibration/HeightCalibrationTest.kt b/server/core/src/test/java/dev/slimevr/heightcalibration/HeightCalibrationTest.kt
index d33efcca8..734165118 100644
--- a/server/core/src/test/java/dev/slimevr/heightcalibration/HeightCalibrationTest.kt
+++ b/server/core/src/test/java/dev/slimevr/heightcalibration/HeightCalibrationTest.kt
@@ -26,11 +26,11 @@ private val POINTING_DOWN = Quaternion.fromTo(Vector3.NEG_Z, Vector3.NEG_Y)
// Identity: controller forward is -Z, not pointing down
private val POINTING_FORWARD = Quaternion.IDENTITY
-// Identity: HMD up is +Y, within 15° leveled threshold
-private val HMD_LEVEL = Quaternion.IDENTITY
+// Identity: head up is +Y, within 15° levelled threshold
+private val HEAD_LEVEL = Quaternion.IDENTITY
-// 90° around Z: HMD up maps to +X, failing the leveled check
-private val HMD_TILTED = Quaternion.fromTo(Vector3.POS_Y, Vector3.POS_X)
+// 90° around Z: head up maps to +X, failing the levelled check
+private val HEAD_TILTED = Quaternion.fromTo(Vector3.POS_Y, Vector3.POS_X)
// Position just below the floor threshold (0.10m)
private val FLOOR_POSITION = Vector3(0f, 0.05f, 0f)
@@ -50,13 +50,13 @@ fun testHeightCalibrationContext(scope: kotlinx.coroutines.CoroutineScope) = Hei
// drives both the sample() operator and the stability duration checks in one unified timeline.
private fun TestScope.launchSession(
context: HeightCalibrationContext,
- hmdFlow: MutableSharedFlow,
+ headFlow: MutableSharedFlow,
controllerFlow: MutableSharedFlow,
): Job {
val scope = this
val userConfig = buildTestUserConfig(backgroundScope)
return launch {
- runCalibrationSession(context, userConfig, hmdFlow, controllerFlow, clock = { scope.currentTime * 1_000_000L })
+ runCalibrationSession(context, userConfig, headFlow, controllerFlow, clock = { scope.currentTime * 1_000_000L })
}
}
@@ -83,12 +83,12 @@ private suspend fun TestScope.completeFloorPhase(
emitFor(controllerFlow, floorSnapshot, FLOOR_STABILITY_MS + SAMPLE_INTERVAL_MS * 5)
}
-// Holds the HMD steady at standing height long enough for the height phase to complete.
+// Holds the head steady at standing height long enough for the height phase to complete.
private suspend fun TestScope.completeHeightPhase(
- hmdFlow: MutableSharedFlow,
- hmdSnapshot: TrackerSnapshot,
+ headFlow: MutableSharedFlow,
+ headSnapshot: TrackerSnapshot,
) {
- emitFor(hmdFlow, hmdSnapshot, HEIGHT_STABILITY_MS + SAMPLE_INTERVAL_MS * 5)
+ emitFor(headFlow, headSnapshot, HEIGHT_STABILITY_MS + SAMPLE_INTERVAL_MS * 5)
}
class HeightCalibrationReducerTest {
@@ -108,8 +108,8 @@ class HeightCalibrationSessionTest {
fun `session starts in RECORDING_FLOOR`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
assertEquals(UserHeightCalibrationStatus.RECORDING_FLOOR, context.state.value.status)
@@ -120,8 +120,8 @@ class HeightCalibrationSessionTest {
fun `controller too high does not change status`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
emitFor(controllerFlow, TrackerSnapshot(Vector3(0f, 0.5f, 0f), POINTING_DOWN), SAMPLE_INTERVAL_MS)
@@ -134,8 +134,8 @@ class HeightCalibrationSessionTest {
fun `controller not pointing down transitions to WAITING_FOR_CONTROLLER_PITCH`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
emitFor(controllerFlow, TrackerSnapshot(FLOOR_POSITION, POINTING_FORWARD), SAMPLE_INTERVAL_MS)
@@ -148,8 +148,8 @@ class HeightCalibrationSessionTest {
fun `stable floor transitions to WAITING_FOR_RISE`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
completeFloorPhase(controllerFlow, TrackerSnapshot(FLOOR_POSITION, POINTING_DOWN))
@@ -159,47 +159,47 @@ class HeightCalibrationSessionTest {
}
@Test
- fun `HMD below rise threshold stays WAITING_FOR_RISE`() = runTest {
+ fun `Head below rise threshold stays WAITING_FOR_RISE`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
completeFloorPhase(controllerFlow, TrackerSnapshot(FLOOR_POSITION, POINTING_DOWN))
- emitFor(hmdFlow, TrackerSnapshot(Vector3(0f, 0.5f, 0f), HMD_LEVEL), SAMPLE_INTERVAL_MS)
+ emitFor(headFlow, TrackerSnapshot(Vector3(0f, 0.5f, 0f), HEAD_LEVEL), SAMPLE_INTERVAL_MS)
assertEquals(UserHeightCalibrationStatus.WAITING_FOR_RISE, context.state.value.status)
job.cancel()
}
@Test
- fun `HMD not leveled transitions to WAITING_FOR_FW_LOOK`() = runTest {
+ fun `Head not leveled transitions to WAITING_FOR_FW_LOOK`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
completeFloorPhase(controllerFlow, TrackerSnapshot(FLOOR_POSITION, POINTING_DOWN))
- emitFor(hmdFlow, TrackerSnapshot(STANDING_POSITION, HMD_TILTED), SAMPLE_INTERVAL_MS)
+ emitFor(headFlow, TrackerSnapshot(STANDING_POSITION, HEAD_TILTED), SAMPLE_INTERVAL_MS)
assertEquals(UserHeightCalibrationStatus.WAITING_FOR_FW_LOOK, context.state.value.status)
job.cancel()
}
@Test
- fun `stable HMD at valid height transitions to DONE`() = runTest {
+ fun `stable head at valid height transitions to DONE`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
completeFloorPhase(controllerFlow, TrackerSnapshot(FLOOR_POSITION, POINTING_DOWN))
- completeHeightPhase(hmdFlow, TrackerSnapshot(STANDING_POSITION, HMD_LEVEL))
+ completeHeightPhase(headFlow, TrackerSnapshot(STANDING_POSITION, HEAD_LEVEL))
assertEquals(UserHeightCalibrationStatus.DONE, context.state.value.status)
assertEquals(STANDING_POSITION.y - FLOOR_POSITION.y, context.state.value.currentHeight)
@@ -207,30 +207,30 @@ class HeightCalibrationSessionTest {
}
@Test
- fun `stable HMD below HEIGHT_MIN transitions to ERROR_TOO_SMALL`() = runTest {
+ fun `stable head below HEIGHT_MIN transitions to ERROR_TOO_SMALL`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
completeFloorPhase(controllerFlow, TrackerSnapshot(Vector3(0f, 0f, 0f), POINTING_DOWN))
- completeHeightPhase(hmdFlow, TrackerSnapshot(Vector3(0f, 1.3f, 0f), HMD_LEVEL))
+ completeHeightPhase(headFlow, TrackerSnapshot(Vector3(0f, 1.3f, 0f), HEAD_LEVEL))
assertEquals(UserHeightCalibrationStatus.ERROR_TOO_SMALL, context.state.value.status)
job.cancel()
}
@Test
- fun `stable HMD above HEIGHT_MAX transitions to ERROR_TOO_HIGH`() = runTest {
+ fun `stable head above HEIGHT_MAX transitions to ERROR_TOO_HIGH`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
completeFloorPhase(controllerFlow, TrackerSnapshot(Vector3(0f, 0f, 0f), POINTING_DOWN))
- completeHeightPhase(hmdFlow, TrackerSnapshot(Vector3(0f, 2.0f, 0f), HMD_LEVEL))
+ completeHeightPhase(headFlow, TrackerSnapshot(Vector3(0f, 2.0f, 0f), HEAD_LEVEL))
assertEquals(UserHeightCalibrationStatus.ERROR_TOO_HIGH, context.state.value.status)
job.cancel()
@@ -240,8 +240,8 @@ class HeightCalibrationSessionTest {
fun `unstable floor sample resets controller stability window`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
val stableSnapshot = TrackerSnapshot(FLOOR_POSITION, POINTING_DOWN)
@@ -263,28 +263,28 @@ class HeightCalibrationSessionTest {
}
@Test
- fun `out-of-threshold HMD sample resets height stability window`() = runTest {
+ fun `out-of-threshold head sample resets height stability window`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
completeFloorPhase(controllerFlow, TrackerSnapshot(FLOOR_POSITION, POINTING_DOWN))
- val stableSnapshot = TrackerSnapshot(STANDING_POSITION, HMD_LEVEL)
- val unstableSnapshot = TrackerSnapshot(Vector3(0f, 1.9f, 0f), HMD_LEVEL)
+ val stableSnapshot = TrackerSnapshot(STANDING_POSITION, HEAD_LEVEL)
+ val unstableSnapshot = TrackerSnapshot(Vector3(0f, 1.9f, 0f), HEAD_LEVEL)
// Build up stability but not long enough to complete
- emitFor(hmdFlow, stableSnapshot, HEIGHT_STABILITY_MS - SAMPLE_INTERVAL_MS * 5)
+ emitFor(headFlow, stableSnapshot, HEIGHT_STABILITY_MS - SAMPLE_INTERVAL_MS * 5)
assertEquals(UserHeightCalibrationStatus.RECORDING_HEIGHT, context.state.value.status)
// Unstable sample resets the stability window
- emitFor(hmdFlow, unstableSnapshot, SAMPLE_INTERVAL_MS)
+ emitFor(headFlow, unstableSnapshot, SAMPLE_INTERVAL_MS)
assertEquals(UserHeightCalibrationStatus.RECORDING_HEIGHT, context.state.value.status)
// Must hold stable for the full duration again from the reset point
- completeHeightPhase(hmdFlow, stableSnapshot)
+ completeHeightPhase(headFlow, stableSnapshot)
assertEquals(UserHeightCalibrationStatus.DONE, context.state.value.status)
job.cancel()
}
@@ -293,8 +293,8 @@ class HeightCalibrationSessionTest {
fun `timeout fires ERROR_TIMEOUT`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launch { runCalibrationSession(context, buildTestUserConfig(backgroundScope), hmdFlow, controllerFlow) }
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launch { runCalibrationSession(context, buildTestUserConfig(backgroundScope), headFlow, controllerFlow) }
advanceTimeBy(TIMEOUT_MS + 1)
@@ -306,8 +306,8 @@ class HeightCalibrationSessionTest {
fun `controller pitch recovery leads to WAITING_FOR_RISE`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
// Bad pitch triggers WAITING_FOR_CONTROLLER_PITCH
@@ -321,41 +321,41 @@ class HeightCalibrationSessionTest {
}
@Test
- fun `leveling HMD after WAITING_FOR_FW_LOOK transitions to RECORDING_HEIGHT`() = runTest {
+ fun `levelling head after WAITING_FOR_FW_LOOK transitions to RECORDING_HEIGHT`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
completeFloorPhase(controllerFlow, TrackerSnapshot(FLOOR_POSITION, POINTING_DOWN))
- // Tilted HMD
- emitFor(hmdFlow, TrackerSnapshot(STANDING_POSITION, HMD_TILTED), SAMPLE_INTERVAL_MS)
+ // Tilted head
+ emitFor(headFlow, TrackerSnapshot(STANDING_POSITION, HEAD_TILTED), SAMPLE_INTERVAL_MS)
assertEquals(UserHeightCalibrationStatus.WAITING_FOR_FW_LOOK, context.state.value.status)
- // Recovery: level the HMD
- emitFor(hmdFlow, TrackerSnapshot(STANDING_POSITION, HMD_LEVEL), SAMPLE_INTERVAL_MS)
+ // Recovery: level the head
+ emitFor(headFlow, TrackerSnapshot(STANDING_POSITION, HEAD_LEVEL), SAMPLE_INTERVAL_MS)
assertEquals(UserHeightCalibrationStatus.RECORDING_HEIGHT, context.state.value.status)
job.cancel()
}
@Test
- fun `HMD rising above threshold transitions to RECORDING_HEIGHT`() = runTest {
+ fun `Head rising above threshold transitions to RECORDING_HEIGHT`() = runTest {
val context = testHeightCalibrationContext(backgroundScope)
val controllerFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val hmdFlow = MutableSharedFlow(extraBufferCapacity = 1)
- val job = launchSession(context, hmdFlow, controllerFlow)
+ val headFlow = MutableSharedFlow(extraBufferCapacity = 1)
+ val job = launchSession(context, headFlow, controllerFlow)
advanceTimeBy(SAMPLE_INTERVAL_MS)
completeFloorPhase(controllerFlow, TrackerSnapshot(FLOOR_POSITION, POINTING_DOWN))
- // HMD below threshold
- emitFor(hmdFlow, TrackerSnapshot(Vector3(0f, 0.5f, 0f), HMD_LEVEL), SAMPLE_INTERVAL_MS)
+ // Head below threshold
+ emitFor(headFlow, TrackerSnapshot(Vector3(0f, 0.5f, 0f), HEAD_LEVEL), SAMPLE_INTERVAL_MS)
assertEquals(UserHeightCalibrationStatus.WAITING_FOR_RISE, context.state.value.status)
- // HMD rises above threshold
- emitFor(hmdFlow, TrackerSnapshot(STANDING_POSITION, HMD_LEVEL), SAMPLE_INTERVAL_MS)
+ // Head rises above threshold
+ emitFor(headFlow, TrackerSnapshot(STANDING_POSITION, HEAD_LEVEL), SAMPLE_INTERVAL_MS)
assertEquals(UserHeightCalibrationStatus.RECORDING_HEIGHT, context.state.value.status)
job.cancel()
}
diff --git a/server/core/src/test/java/dev/slimevr/trackingchecklist/TrackingChecklistTest.kt b/server/core/src/test/java/dev/slimevr/trackingchecklist/TrackingChecklistTest.kt
index 347ae1cc4..2f8d34de1 100644
--- a/server/core/src/test/java/dev/slimevr/trackingchecklist/TrackingChecklistTest.kt
+++ b/server/core/src/test/java/dev/slimevr/trackingchecklist/TrackingChecklistTest.kt
@@ -59,7 +59,7 @@ class TrackingChecklistTest {
init {
checklist.context.behaviours.addAll(
listOf(
- HMDCheckBehaviour(trackerStates),
+ ReliableReferenceCheckBehaviour(trackerStates),
TrackerRestCheckBehaviour(trackerStates),
TrackerErrorCheckBehaviour(trackerStates),
FullResetCheckBehaviour(trackerStates, resetsManager),
@@ -208,27 +208,26 @@ class TrackingChecklistTest {
}
@Test
- fun `UNASSIGNED_HMD is invalid until the HMD is assigned to the head`() = runTest {
+ fun `UNASSIGNED_RELIABLE_REFERENCE is invalid until the reliable reference is assigned its intended body part`() = runTest {
val h = Harness(this)
- // An HMD is a DRIVER-origin tracker with a computed position
- val hmd = h.addTracker(bodyPart = null, intendedBodyPart = BodyPart.HEAD, origin = DeviceOrigin.DRIVER, imuType = null, position = Vector3.ZERO)
+ val reliableReference = h.addTracker(bodyPart = null, intendedBodyPart = BodyPart.HEAD, origin = DeviceOrigin.DRIVER, imuType = null, position = Vector3.ZERO)
runCurrent()
- assertEquals(true, h.step(TrackingChecklistStepId.UNASSIGNED_HMD).enabled)
- assertEquals(false, h.step(TrackingChecklistStepId.UNASSIGNED_HMD).valid)
+ assertEquals(true, h.step(TrackingChecklistStepId.UNASSIGNED_RELIABLE_REFERENCE).enabled)
+ assertEquals(false, h.step(TrackingChecklistStepId.UNASSIGNED_RELIABLE_REFERENCE).valid)
- hmd.context.dispatch(TrackerActions.Update { copy(bodyPart = BodyPart.HEAD) })
+ reliableReference.context.dispatch(TrackerActions.Update { copy(bodyPart = BodyPart.HEAD) })
runCurrent()
- assertEquals(true, h.step(TrackingChecklistStepId.UNASSIGNED_HMD).valid)
+ assertEquals(true, h.step(TrackingChecklistStepId.UNASSIGNED_RELIABLE_REFERENCE).valid)
}
@Test
- fun `UNASSIGNED_HMD is disabled without a driver tracker`() = runTest {
+ fun `UNASSIGNED_RELIABLE_REFERENCE is disabled without a driver tracker`() = runTest {
val h = Harness(this)
h.addTracker(bodyPart = BodyPart.LOWER_CHEST)
runCurrent()
- assertEquals(false, h.step(TrackingChecklistStepId.UNASSIGNED_HMD).enabled)
+ assertEquals(false, h.step(TrackingChecklistStepId.UNASSIGNED_RELIABLE_REFERENCE).enabled)
}
@Test
diff --git a/solarxr-protocol b/solarxr-protocol
index fb1b2b335..6e02be735 160000
--- a/solarxr-protocol
+++ b/solarxr-protocol
@@ -1 +1 @@
-Subproject commit fb1b2b335e1d83590b0e148902a6ac05073bbce9
+Subproject commit 6e02be735a0ae83d114e0c524842d37aef0576c1