mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 08:42:32 -08:00
ComparableTimeMark
This commit is contained in:
1 parent
60caa0395e
commit
fe788ed3a7
5 files changed
+11
-17
No files matched your search
+2
-5
@@ -6,17 +6,14 @@ import dev.slimevr.skeleton.InputSkeleton
|
||||
import dev.slimevr.skeleton.ResettableSkeletonProcessor
|
||||
import dev.slimevr.skeleton.SkeletonInputProcessor
|
||||
import dev.slimevr.skeleton.bodyPartMap
|
||||
import dev.slimevr.util.MonotonicValueTimeMark
|
||||
import dev.slimevr.util.timeSource
|
||||
import io.github.axisangles.ktmath.Quaternion
|
||||
import solarxr_protocol.datatypes.BodyPart
|
||||
import solarxr_protocol.rpc.FilteringType
|
||||
import solarxr_protocol.rpc.ResetType
|
||||
import kotlin.time.ComparableTimeMark
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
/** How long the running average of rotation deltas used for predictions is */
|
||||
val RUNNING_AVERAGE_WINDOW = 10.milliseconds
|
||||
|
||||
/** How far ahead the prediction reaches at amount 1, scaled down by the configured amount */
|
||||
val PREDICTION_LEAD = 12.milliseconds
|
||||
|
||||
@@ -29,7 +26,7 @@ class RotationPredictionInputProcessor(val settings: Settings) :
|
||||
private data class BoneDelta(
|
||||
val lastRotation: Quaternion,
|
||||
val rotationDelta: Quaternion,
|
||||
val lastChange: MonotonicValueTimeMark,
|
||||
val lastChange: ComparableTimeMark,
|
||||
)
|
||||
|
||||
// Used to minimize latency even more for arm tracking where it is more noticeable in VR.
|
||||
|
||||
@@ -11,7 +11,6 @@ import dev.slimevr.solarxr.toQuaternion
|
||||
import dev.slimevr.solarxr.toVector3
|
||||
import dev.slimevr.tracker.Tracker
|
||||
import dev.slimevr.tracker.TrackerActions
|
||||
import dev.slimevr.util.MonotonicValueTimeMark
|
||||
import dev.slimevr.util.inFloatingSeconds
|
||||
import dev.slimevr.util.timeSource
|
||||
import io.github.axisangles.ktmath.Quaternion
|
||||
@@ -24,6 +23,7 @@ import solarxr_protocol.driver_protocol.AddTrackerStatus
|
||||
import solarxr_protocol.driver_protocol.UpdateTrackerBattery
|
||||
import solarxr_protocol.driver_protocol.UpdateTrackerPosition
|
||||
import solarxr_protocol.driver_protocol.UpdateTrackerStatus
|
||||
import kotlin.time.ComparableTimeMark
|
||||
import kotlin.to
|
||||
|
||||
// These are all only defaults and the user can edit any and they will save.
|
||||
@@ -89,7 +89,7 @@ class DriverIncomingTrackersBehaviour(
|
||||
private val appContext: AppContextProvider,
|
||||
) : SolarXRBridgeBehaviour {
|
||||
private val rotationOffsets: MutableMap<Int, Quaternion> = mutableMapOf()
|
||||
private val lastVelocities: MutableMap<Int, Pair<MonotonicValueTimeMark, Vector3>> = mutableMapOf()
|
||||
private val lastVelocities: MutableMap<Int, Pair<ComparableTimeMark, Vector3>> = mutableMapOf()
|
||||
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
val server = appContext.server
|
||||
|
||||
@@ -53,7 +53,6 @@ fun reduce(
|
||||
val acceleration: CalibratedAcceleration? =
|
||||
if (action.acceleration != null) {
|
||||
if (state.imuType != null) {
|
||||
// TODO: double check calibration; doesn't seem right - Erimel
|
||||
applyCalibration(
|
||||
action.acceleration,
|
||||
correctedRawRotation,
|
||||
|
||||
@@ -7,7 +7,6 @@ import dev.slimevr.osc.OscSender
|
||||
import dev.slimevr.routing.BoneRoutingManager
|
||||
import dev.slimevr.skeleton.ComputedSkeleton
|
||||
import dev.slimevr.skeleton.Skeleton
|
||||
import dev.slimevr.util.MonotonicValueTimeMark
|
||||
import dev.slimevr.util.formatExceptionMessage
|
||||
import dev.slimevr.util.timeSource
|
||||
import kotlinx.coroutines.flow.combine
|
||||
@@ -19,6 +18,7 @@ import kotlinx.coroutines.launch
|
||||
import solarxr_protocol.datatypes.BodyPart
|
||||
import solarxr_protocol.rpc.RoutingOutput
|
||||
import solarxr_protocol.rpc.VMCOSCOutputState
|
||||
import kotlin.time.ComparableTimeMark
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
private val FRAME_RETRY_DELAY = 2.seconds
|
||||
@@ -33,10 +33,10 @@ class VMCOutputBehaviour(
|
||||
private class OutputRuntime {
|
||||
var sender: OscSender? = null
|
||||
var sendFailing = false
|
||||
var nextFrameRetryAt: MonotonicValueTimeMark? = null
|
||||
var nextFrameRetryAt: ComparableTimeMark? = null
|
||||
|
||||
/** Start of the current unbroken run of successful sends, null while sends are failing. */
|
||||
var healthySince: MonotonicValueTimeMark? = null
|
||||
var healthySince: ComparableTimeMark? = null
|
||||
}
|
||||
|
||||
override fun observe(receiver: VMCManager) {
|
||||
@@ -149,7 +149,7 @@ class VMCOutputBehaviour(
|
||||
config: VMCConfig,
|
||||
skeletonHeight: Float,
|
||||
floorLevel: Float,
|
||||
startedAt: MonotonicValueTimeMark,
|
||||
startedAt: ComparableTimeMark,
|
||||
) {
|
||||
val sender = runtime.sender ?: return
|
||||
val status = receiver.context.state.value.status
|
||||
|
||||
@@ -5,10 +5,8 @@ import dev.slimevr.config.VRCOSCConfig
|
||||
import dev.slimevr.logging.AppLogger
|
||||
import dev.slimevr.osc.OscSender
|
||||
import dev.slimevr.routing.BoneRoutingManager
|
||||
import dev.slimevr.skeleton.BoneState
|
||||
import dev.slimevr.skeleton.ComputedSkeleton
|
||||
import dev.slimevr.skeleton.Skeleton
|
||||
import dev.slimevr.util.MonotonicValueTimeMark
|
||||
import dev.slimevr.util.formatExceptionMessage
|
||||
import dev.slimevr.util.timeSource
|
||||
import io.github.axisangles.ktmath.Quaternion
|
||||
@@ -21,8 +19,8 @@ import solarxr_protocol.datatypes.BodyPart
|
||||
import solarxr_protocol.rpc.RoutingOutput
|
||||
import solarxr_protocol.rpc.VRCOSCOutputState
|
||||
import solarxr_protocol.rpc.VRCOSCTargetSource
|
||||
import kotlin.time.ComparableTimeMark
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
import kotlin.time.TimeSource
|
||||
|
||||
private val FRAME_RETRY_DELAY = 2.seconds
|
||||
|
||||
@@ -39,8 +37,8 @@ class VRCOSCOutputBehaviour(
|
||||
private class OutputRuntime {
|
||||
var sender: OscSender? = null
|
||||
var sendFailing = false
|
||||
var nextFrameRetryAt: MonotonicValueTimeMark? = null
|
||||
var healthySince: MonotonicValueTimeMark? = null
|
||||
var nextFrameRetryAt: ComparableTimeMark? = null
|
||||
var healthySince: ComparableTimeMark? = null
|
||||
}
|
||||
|
||||
override fun observe(receiver: VRCOSCManager) {
|
||||
|
||||
Reference in new issue
Block a user