mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-30 13:52:47 -08:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3673e65c3 |
No files matched your search
@@ -586,6 +586,8 @@ settings-driver-bones-description = Which bones this output sends is configured
|
||||
settings-driver-bones-link = Open Bone Routing
|
||||
settings-driver-velocity = Send velocity
|
||||
settings-driver-velocity-description = Send linear and angular velocity data to the driver. Allows SteamVR/Monado tracker pose prediction and compatibility with applications that expect this data.
|
||||
settings-driver-controller_tracking_fallback = Controller tracking fallback
|
||||
settings-driver-controller_tracking_fallback-description = Override your controllers' tracking, with trackers mounted on your arms and hands, when your controllers lose tracking
|
||||
|
||||
## Tracker mechanics
|
||||
settings-general-mounting_method = Mounting calibration method
|
||||
|
||||
@@ -33,12 +33,14 @@ import { defineSettingsPage } from '@/components/settings/settings-definitions';
|
||||
type DriverForm = {
|
||||
enabled: boolean;
|
||||
sendVelocity: boolean;
|
||||
controllerTrackingFallback: boolean;
|
||||
};
|
||||
|
||||
function toForm(settings: DriverSettingsResponseT): DriverForm {
|
||||
return {
|
||||
enabled: settings.enabled,
|
||||
sendVelocity: settings.sendVelocity,
|
||||
controllerTrackingFallback: settings.controllerTrackingFallback,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -108,6 +110,11 @@ export const driverSettingsPage = defineSettingsPage({
|
||||
title: 'settings-driver-velocity',
|
||||
description: 'settings-driver-velocity-description',
|
||||
},
|
||||
controllerTrackingFallback: {
|
||||
title: 'settings-driver-controller_tracking_fallback',
|
||||
description:
|
||||
'settings-driver-controller_tracking_fallback-description',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -137,6 +144,7 @@ export function DriverSettings() {
|
||||
const settingsReq = new ChangeDriverSettingsRequestT();
|
||||
settingsReq.enabled = values.enabled;
|
||||
settingsReq.sendVelocity = values.sendVelocity;
|
||||
settingsReq.controllerTrackingFallback = values.controllerTrackingFallback;
|
||||
sendRPCPacket(RpcMessage.ChangeDriverSettingsRequest, settingsReq);
|
||||
};
|
||||
|
||||
@@ -243,6 +251,19 @@ export function DriverSettings() {
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<SettingRow
|
||||
setting={groups.data.rows.controllerTrackingFallback}
|
||||
controlId="driver-controller-tracking-fallback"
|
||||
{...resetTo('controllerTrackingFallback')}
|
||||
control={
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
control={control}
|
||||
name="controllerTrackingFallback"
|
||||
id="driver-controller-tracking-fallback"
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</SettingsGroup>
|
||||
</SettingsAdvanced>
|
||||
</div>
|
||||
|
||||
@@ -46,6 +46,7 @@ data class BoneRoutingConfig(
|
||||
data class DriverConfig(
|
||||
val enabled: Boolean = true,
|
||||
val sendVelocity: Boolean = false,
|
||||
val controllerTrackingFallback: Boolean = false,
|
||||
)
|
||||
|
||||
// Used in TrackerActionConfig
|
||||
@@ -117,7 +118,7 @@ data class SkeletonTogglesConfig(
|
||||
@Serializable
|
||||
data class SkeletonRatiosConfig(
|
||||
val smoothingStrength: Float = 0.15f,
|
||||
val predictionStrength: Float = 0.25f,
|
||||
val predictionStrength: Float = 0.30f,
|
||||
val spineCurvature: Float = 0.75f,
|
||||
val imputeSpineFromUpperToLower: Float = DEFAULT_SPINE_UPPER_LOWER,
|
||||
val interpolateUpperLegsTwistWithLowerLegs: Float = 0.85f,
|
||||
|
||||
@@ -75,8 +75,6 @@ class LocalizerResetBehaviour(val settings: Settings) : SkeletonBehaviour {
|
||||
*/
|
||||
class YouSpinMeRightRoundBehaviour(val inputHz: Int = 100, val speed: Float = 1f, val randomPacketLoss: Float = 0f, val constantPacketLoss: Float = 0f, val sendPosition: Boolean = false) : SkeletonBehaviour {
|
||||
override fun observe(receiver: Skeleton) {
|
||||
println("YouSpinMeRightRoundBehaviour sending fake bone data for simulation.")
|
||||
|
||||
receiver.context.scope.launch {
|
||||
val interval = (millisecondsInSecond / inputHz.toFloat()).toLong().milliseconds
|
||||
val startTime = timeSource.markNow()
|
||||
|
||||
@@ -36,7 +36,7 @@ private const val SMOOTHING_MS_MAX = 50.0
|
||||
|
||||
// Prediction
|
||||
private const val PREDICTION_MS_MAX = 30.0
|
||||
private val PREDICTION_CARRYOVER_TIME = 25.milliseconds
|
||||
private val PREDICTION_CARRYOVER_TIME = 20.milliseconds // TODO might need to be tuned
|
||||
private const val MAX_PREDICTION_CARRYOVER_RATIO = 0.5
|
||||
|
||||
// Used to minimize latency even more for arm tracking where it is more noticeable
|
||||
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
package dev.slimevr.skeleton.inputprocessors
|
||||
|
||||
import dev.slimevr.skeleton.BodyPartMap
|
||||
import dev.slimevr.skeleton.BoneInput
|
||||
import dev.slimevr.skeleton.InputSkeleton
|
||||
import dev.slimevr.skeleton.SkeletonInputProcessor
|
||||
import dev.slimevr.skeleton.bodyPartMap
|
||||
import kotlin.random.Random
|
||||
import kotlin.time.ComparableTimeMark
|
||||
|
||||
/**
|
||||
* Used for simulating packet drop, leave commented for production.
|
||||
*/
|
||||
class PacketDropSimulatorInputProcessor(val randomPacketDrop: Float) : SkeletonInputProcessor {
|
||||
init {
|
||||
println("PacketDropSimulatorInputProcessor simulating ${randomPacketDrop * 100}% packet drop.")
|
||||
}
|
||||
|
||||
val lastBone: BodyPartMap<BoneInput> = bodyPartMap()
|
||||
val lastPoseTime: BodyPartMap<ComparableTimeMark> = bodyPartMap()
|
||||
override fun process(mutableInputSkeleton: InputSkeleton, skeletonHeight: Float) {
|
||||
mutableInputSkeleton.forEach { (part, input) ->
|
||||
val isNewData = lastPoseTime[part] != mutableInputSkeleton[part]?.poseTime
|
||||
lastPoseTime[part] = mutableInputSkeleton[part]?.poseTime
|
||||
if (isNewData) {
|
||||
val dropPacket = Random.nextFloat() < randomPacketDrop
|
||||
if (!dropPacket) {
|
||||
lastBone[part] = input
|
||||
} else if (lastBone[part] != null) {
|
||||
mutableInputSkeleton[part] = lastBone[part]
|
||||
}
|
||||
} else if (lastBone[part] != null) {
|
||||
mutableInputSkeleton[part] = lastBone[part]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import dev.slimevr.skeleton.inputprocessors.FilteringInputProcessor
|
||||
import dev.slimevr.skeleton.inputprocessors.FingersInputProcessor
|
||||
import dev.slimevr.skeleton.inputprocessors.HeadPositionFallbackInputProcessor
|
||||
import dev.slimevr.skeleton.inputprocessors.NeckInputProcessor
|
||||
import dev.slimevr.skeleton.inputprocessors.PacketDropSimulatorInputProcessor
|
||||
import dev.slimevr.skeleton.inputprocessors.SpineInputProcessor
|
||||
import dev.slimevr.skeleton.inputprocessors.ToesInputProcessor
|
||||
import dev.slimevr.skeleton.targetprocessors.FloorClipTargetProcessor
|
||||
@@ -263,13 +262,12 @@ class Skeleton(
|
||||
ProportionsBehaviour(ctx.config.userConfig),
|
||||
HeightLogBehaviour(),
|
||||
LocalizerResetBehaviour(settings),
|
||||
// YouSpinMeRightRoundBehaviour(inputHz = 100, speed = 1f, randomPacketLoss = 0.9f, constantPacketLoss = 0f, sendPosition = false),
|
||||
// YouSpinMeRightRoundBehaviour(inputHz = 100, speed = 1f, randomPacketLoss = 0f, constantPacketLoss = 0f, sendPosition = true),
|
||||
ComputedSkeletonBehaviour(
|
||||
hz = hz,
|
||||
waiter = waiter,
|
||||
// Run before FK on the inputs
|
||||
inputProcessors = listOf(
|
||||
// PacketDropSimulatorInputProcessor(0.85f),
|
||||
FilteringInputProcessor(settings),
|
||||
HeadPositionFallbackInputProcessor(),
|
||||
FallbackInputProcessor(),
|
||||
|
||||
+1
-5
@@ -27,7 +27,6 @@ const val OFFSET_LIMIT_MAX = 0.20f
|
||||
const val COM_DISTANCE_MULTIPLIER = 1.5f
|
||||
const val LIFT_MIN = -0.85f
|
||||
const val LIFT_MAX = 0.4f
|
||||
const val ANKLE_MULTIPLIER = 1.25f
|
||||
|
||||
// Parameters to decide if a foot should be locked
|
||||
// Higher makes it harder to unlock after being locked
|
||||
@@ -227,7 +226,6 @@ class SkatingCorrectionTargetProcessor(val settings: Settings, val skeleton: Ske
|
||||
|
||||
for ((bodyPart, ikTargetBodyPart, liftBodyPart) in skatingBodyParts) {
|
||||
val bone = fk[bodyPart] ?: continue
|
||||
val inputBone = inputSkeleton[bodyPart] ?: continue
|
||||
val ikBone = fk[ikTargetBodyPart] ?: continue
|
||||
val liftBone = fk[liftBodyPart] ?: continue
|
||||
val curPosition = mutableIkTargets[ikTargetBodyPart] ?: ikBone.tailPosition
|
||||
@@ -237,10 +235,8 @@ class SkatingCorrectionTargetProcessor(val settings: Settings, val skeleton: Ske
|
||||
val comMultiplier = computeComMultiplier(comDistances[bodyPart] ?: continue, comDistancesAverage)
|
||||
// liftMultiplier decreases the threshold when the upper leg is lifted. Useful when sitting/lying down
|
||||
val liftMultiplier = computeLiftMultiplier(liftBone.localTailPosition)
|
||||
// ankleMultiplier increases the threshold if the foot doesn't have its own accel data
|
||||
val ankleMultiplier = if (inputBone.isAccelerationActive) 1f else ANKLE_MULTIPLIER
|
||||
// Apply multipliers to the acceleration threshold
|
||||
val scaledAccelerationThreshold = accelerationThreshold * comMultiplier * liftMultiplier * ankleMultiplier
|
||||
val scaledAccelerationThreshold = accelerationThreshold * comMultiplier * liftMultiplier
|
||||
|
||||
// Compute if the body part should be locked
|
||||
val floorLocked = floorLocked(lastState.locked, curPosition, floorLevel)
|
||||
|
||||
@@ -24,6 +24,7 @@ import solarxr_protocol.rpc.RoutingOutputState
|
||||
internal fun buildDriverSettingsResponse(config: DriverConfig) = DriverSettingsResponse(
|
||||
enabled = config.enabled,
|
||||
sendVelocity = config.sendVelocity,
|
||||
controllerTrackingFallback = config.controllerTrackingFallback,
|
||||
)
|
||||
|
||||
class DriverSettingsBehaviour(
|
||||
@@ -50,6 +51,7 @@ class DriverSettingsBehaviour(
|
||||
driverConfig = driverConfig.copy(
|
||||
enabled = req.enabled,
|
||||
sendVelocity = req.sendVelocity,
|
||||
controllerTrackingFallback = req.controllerTrackingFallback,
|
||||
),
|
||||
)
|
||||
},
|
||||
|
||||
+1
-1
Submodule solarxr-protocol updated: 77cabf5dd8...4c19ae41d3.
Reference in new issue
Block a user