mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-24 11:01:20 -08:00
EXTERMINATE CENTAUR 🗡️🦊
This commit is contained in:
1 parent
dfb895345d
commit
bc8fe31e51
3 files changed
+6
-5
No files matched your search
@@ -23,6 +23,6 @@ class TrackerRotationRefreshBehaviour : TrackerBehaviour {
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getRotationRefreshAction(trackerState: TrackerState) = TrackerActions.SetRotation(trackerState.rawRotation, trackerState.rawAcceleration, trackerState.rawMagnetometer, trackerState.position, refresh = true)
|
||||
fun getRotationRefreshAction(trackerState: TrackerState) = TrackerActions.SetRotation(trackerState.rawRotation, trackerState.rawAcceleration, trackerState.rawMagnetometer, trackerState.position, false)
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ sealed interface TrackerActions {
|
||||
data class SetMagStatus(val status: MagnetometerStatus) : TrackerActions
|
||||
data class SetStatus(val status: TrackerStatus) : 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 refresh: Boolean = false) : 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
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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
|
||||
@@ -18,7 +19,7 @@ fun reduce(
|
||||
is TrackerActions.SetDriverName -> state.copy(driverName = action.driverName)
|
||||
|
||||
is TrackerActions.SetRotation -> {
|
||||
val accumulatedTicks = if (!action.refresh && action.rotation != null) (state.accumulatedTicks + 1u).toUShort() else state.accumulatedTicks
|
||||
val accumulatedTicks = if (action.increaseTps && action.rotation != null) (state.accumulatedTicks + 1u).toUShort() else state.accumulatedTicks
|
||||
|
||||
// Rotation
|
||||
val rawRotation: RawRotation = action.rotation ?: state.rawRotation
|
||||
@@ -28,7 +29,7 @@ fun reduce(
|
||||
} else {
|
||||
rawRotation
|
||||
}
|
||||
val polarityAlign = if (action.refresh) {
|
||||
val polarityAlign = if (state.rotationDirty) {
|
||||
// Reset polarity according to last reference rotation.
|
||||
state.lastReference
|
||||
} else {
|
||||
@@ -88,7 +89,7 @@ fun reduce(
|
||||
rotationDirty = true,
|
||||
)
|
||||
|
||||
// TODO centaur when using a positional and an IMU tracker on spine with unreliable reference and perhaps other cases.
|
||||
// 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
|
||||
|
||||
Reference in new issue
Block a user