From eee7d67591b897469a5ba0f76debf3e7ef77a505 Mon Sep 17 00:00:00 2001 From: ButterscotchVanilla Date: Thu, 12 Aug 2021 19:36:50 -0400 Subject: [PATCH] AutoBone: Allow manual target height value --- .../java/io/eiren/gui/autobone/AutoBone.java | 39 ++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/main/java/io/eiren/gui/autobone/AutoBone.java b/src/main/java/io/eiren/gui/autobone/AutoBone.java index 7664d2736..528be1619 100644 --- a/src/main/java/io/eiren/gui/autobone/AutoBone.java +++ b/src/main/java/io/eiren/gui/autobone/AutoBone.java @@ -173,18 +173,34 @@ public class AutoBone { } public void processFrames() { - processFrames(NUM_EPOCHS, true, INITIAL_ADJUSTMENT_RATE, ADJUSTMENT_RATE_DECAY, MIN_DATA_DISTANCE, MAX_DATA_DISTANCE); + processFrames(NUM_EPOCHS, true); + } + + public void processFrames(float targetHeight) { + processFrames(NUM_EPOCHS, true, targetHeight); } public void processFrames(int epochs, boolean calcInitError) { - processFrames(epochs, calcInitError, INITIAL_ADJUSTMENT_RATE, ADJUSTMENT_RATE_DECAY, MIN_DATA_DISTANCE, MAX_DATA_DISTANCE); + processFrames(epochs, calcInitError, INITIAL_ADJUSTMENT_RATE, ADJUSTMENT_RATE_DECAY); + } + + public void processFrames(int epochs, boolean calcInitError, float targetHeight) { + processFrames(epochs, calcInitError, INITIAL_ADJUSTMENT_RATE, ADJUSTMENT_RATE_DECAY, targetHeight); } public void processFrames(int epochs, boolean calcInitError, float adjustRate, float adjustRateDecay) { processFrames(epochs, calcInitError, adjustRate, adjustRateDecay, MIN_DATA_DISTANCE, MAX_DATA_DISTANCE); } + public void processFrames(int epochs, boolean calcInitError, float adjustRate, float adjustRateDecay, float targetHeight) { + processFrames(epochs, calcInitError, adjustRate, adjustRateDecay, MIN_DATA_DISTANCE, MAX_DATA_DISTANCE, targetHeight); + } + public void processFrames(int epochs, boolean calcInitError, float adjustRate, float adjustRateDecay, int minDataDist, int maxDataDist) { + processFrames(epochs, calcInitError, adjustRate, adjustRateDecay, minDataDist, maxDataDist, -1f); + } + + public void processFrames(int epochs, boolean calcInitError, float adjustRate, float adjustRateDecay, int minDataDist, int maxDataDist, float targetHeight) { Set> configSet = configs.entrySet(); SimpleSkeleton skeleton1 = new SimpleSkeleton(configSet); @@ -197,15 +213,18 @@ public class AutoBone { float sumError = 0f; int errorCount = 0; - float hmdHeight = getMaxHmdHeight(frames); - if (hmdHeight <= 0.50f) { - LogManager.log.warning("[AutoBone] Max headset height detected (Value seems too low, did you not stand up straight while measuring?): " + hmdHeight); - } else { - LogManager.log.info("[AutoBone] Max headset height detected: " + hmdHeight); - } + // If target height isn't specified, auto-detect + if (targetHeight < 0f) { + float hmdHeight = getMaxHmdHeight(frames); + if (hmdHeight <= 0.50f) { + LogManager.log.warning("[AutoBone] Max headset height detected (Value seems too low, did you not stand up straight while measuring?): " + hmdHeight); + } else { + LogManager.log.info("[AutoBone] Max headset height detected: " + hmdHeight); + } - // Estimate target height from HMD height - float targetHeight = hmdHeight * HEADSET_HEIGHT_RATIO; + // Estimate target height from HMD height + targetHeight = hmdHeight * HEADSET_HEIGHT_RATIO; + } for (;;) { // Detect end of iteration