mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-06 02:01:58 +02:00
Convert AutoBone config to Kotlin and fix config loading (#614)
This commit is contained in:
@@ -19,12 +19,11 @@ class RangeProportionLimiter : HardProportionLimiter {
|
||||
boneLengthFunction: Function<HumanPoseManager, Float>,
|
||||
range: Float,
|
||||
) : super(targetRatio, boneLengthFunction) {
|
||||
var range = range
|
||||
val absRange = FastMath.abs(range)
|
||||
|
||||
// Handle if someone puts in a negative value
|
||||
range = FastMath.abs(range)
|
||||
targetPositiveRange = range
|
||||
targetNegativeRange = -range
|
||||
targetPositiveRange = absRange
|
||||
targetNegativeRange = -absRange
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,8 +49,8 @@ class RangeProportionLimiter : HardProportionLimiter {
|
||||
targetNegativeRange = negativeRange
|
||||
}
|
||||
|
||||
override fun getProportionError(config: HumanPoseManager, height: Float): Float {
|
||||
val boneLength = boneLengthFunction.apply(config)
|
||||
override fun getProportionError(humanPoseManager: HumanPoseManager, height: Float): Float {
|
||||
val boneLength = boneLengthFunction.apply(humanPoseManager)
|
||||
val ratioOffset = targetRatio - boneLength / height
|
||||
|
||||
// If the range is exceeded, return the offset from the range limit
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package dev.slimevr.config;
|
||||
|
||||
public class AutoBoneConfig {
|
||||
|
||||
public int cursorIncrement = 2;
|
||||
public int minDataDistance = 1;
|
||||
public int maxDataDistance = 1;
|
||||
|
||||
public int numEpochs = 100;
|
||||
|
||||
public int printEveryNumEpochs = 25;
|
||||
|
||||
public float initialAdjustRate = 10f;
|
||||
public float adjustRateMultiplier = 0.995f;
|
||||
|
||||
public float slideErrorFactor = 0.0f;
|
||||
public float offsetSlideErrorFactor = 2.0f;
|
||||
public float footHeightOffsetErrorFactor = 0.0f;
|
||||
public float bodyProportionErrorFactor = 0.825f;
|
||||
public float heightErrorFactor = 0.0f;
|
||||
public float positionErrorFactor = 0.0f;
|
||||
public float positionOffsetErrorFactor = 0.0f;
|
||||
|
||||
public boolean calcInitError = false;
|
||||
public float targetHeight = -1;
|
||||
|
||||
public boolean randomizeFrameOrder = true;
|
||||
public boolean scaleEachStep = true;
|
||||
|
||||
public int sampleCount = 1000;
|
||||
public long sampleRateMs = 20;
|
||||
|
||||
public boolean saveRecordings = false;
|
||||
|
||||
public AutoBoneConfig() {
|
||||
}
|
||||
}
|
||||
25
server/src/main/java/dev/slimevr/config/AutoBoneConfig.kt
Normal file
25
server/src/main/java/dev/slimevr/config/AutoBoneConfig.kt
Normal file
@@ -0,0 +1,25 @@
|
||||
package dev.slimevr.config
|
||||
|
||||
class AutoBoneConfig {
|
||||
var cursorIncrement = 2
|
||||
var minDataDistance = 1
|
||||
var maxDataDistance = 1
|
||||
var numEpochs = 100
|
||||
var printEveryNumEpochs = 25
|
||||
var initialAdjustRate = 10f
|
||||
var adjustRateMultiplier = 0.995f
|
||||
var slideErrorFactor = 0.0f
|
||||
var offsetSlideErrorFactor = 2.0f
|
||||
var footHeightOffsetErrorFactor = 0.0f
|
||||
var bodyProportionErrorFactor = 0.825f
|
||||
var heightErrorFactor = 0.0f
|
||||
var positionErrorFactor = 0.0f
|
||||
var positionOffsetErrorFactor = 0.0f
|
||||
var calcInitError = false
|
||||
var targetHeight = -1f
|
||||
var randomizeFrameOrder = true
|
||||
var scaleEachStep = true
|
||||
var sampleCount = 1000
|
||||
var sampleRateMs: Long = 20
|
||||
var saveRecordings = false
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class VRConfig {
|
||||
|
||||
private final VMCConfig vmc = new VMCConfig();
|
||||
|
||||
private final AutoBoneConfig autobone = new AutoBoneConfig();
|
||||
private final AutoBoneConfig autoBone = new AutoBoneConfig();
|
||||
|
||||
private final KeybindingsConfig keybindings = new KeybindingsConfig();
|
||||
|
||||
@@ -105,7 +105,7 @@ public class VRConfig {
|
||||
}
|
||||
|
||||
public AutoBoneConfig getAutoBone() {
|
||||
return autobone;
|
||||
return autoBone;
|
||||
}
|
||||
|
||||
public KeybindingsConfig getKeybindings() {
|
||||
|
||||
Reference in New Issue
Block a user