From b2ad724ccec71d01d8cb27e2ff3d63650bb9eb91 Mon Sep 17 00:00:00 2001 From: Collin Kees Date: Tue, 23 Apr 2024 17:29:53 -0700 Subject: [PATCH] Add toggle for using position information --- gui/public/i18n/en/translation.ftl | 3 ++ .../settings/pages/GeneralSettings.tsx | 28 +++++++++++++++++++ .../rpc/settings/RPCSettingsBuilder.java | 3 +- .../rpc/settings/RPCSettingsHandler.kt | 1 + .../config/SkeletonConfigToggles.java | 3 +- .../processor/skeleton/HumanSkeleton.kt | 2 ++ .../tracking/processor/skeleton/IKSolver.kt | 3 +- solarxr-protocol | 2 +- 8 files changed, 41 insertions(+), 4 deletions(-) diff --git a/gui/public/i18n/en/translation.ftl b/gui/public/i18n/en/translation.ftl index a1dfe65f28..f32af078cb 100644 --- a/gui/public/i18n/en/translation.ftl +++ b/gui/public/i18n/en/translation.ftl @@ -342,6 +342,9 @@ settings-general-fk_settings-leg_tweak-foot_plant-description = Foot-plant rotat settings-general-fk_settings-leg_fk = Leg tracking settings-general-fk_settings-leg_fk-reset_mounting_feet-description = Enable feet Mounting Reset by tiptoeing. settings-general-fk_settings-leg_fk-reset_mounting_feet = Feet Mounting Reset +settings-general-fk_settings-ik = Position data +settings-general-fk_settings-ik-use_position = Use Position data +settings-general-fk_settings-ik-use_position-description = Enables the use of position data from trackers that provide it. When enabling this make sure to full reset and recalibrate in game. settings-general-fk_settings-arm_fk = Arm tracking settings-general-fk_settings-arm_fk-description = Force arms to be tracked from the headset (HMD) even if positional hand data is available. settings-general-fk_settings-arm_fk-force_arms = Force arms from HMD diff --git a/gui/src/components/settings/pages/GeneralSettings.tsx b/gui/src/components/settings/pages/GeneralSettings.tsx index 7cb97ed933..0558165d10 100644 --- a/gui/src/components/settings/pages/GeneralSettings.tsx +++ b/gui/src/components/settings/pages/GeneralSettings.tsx @@ -62,6 +62,7 @@ interface SettingsForm { toeSnap: boolean; footPlant: boolean; selfLocalization: boolean; + usePosition: boolean; }; ratios: { imputeWaistFromChestHip: number; @@ -113,6 +114,7 @@ const defaultValues = { toeSnap: false, footPlant: true, selfLocalization: false, + usePosition: true, }, ratios: { imputeWaistFromChestHip: 0.3, @@ -198,6 +200,7 @@ export function GeneralSettings() { toggles.toeSnap = values.toggles.toeSnap; toggles.footPlant = values.toggles.footPlant; toggles.selfLocalization = values.toggles.selfLocalization; + toggles.usePosition = values.toggles.usePosition; modelSettings.toggles = toggles; } @@ -781,6 +784,31 @@ export function GeneralSettings() { /> + +
+ + {l10n.getString('settings-general-fk_settings-ik')} + + + {l10n.getString( + 'settings-general-fk_settings-ik-use_position-description' + )} + +
+
+ +
+ + + {l10n.getString( 'settings-general-fk_settings-arm_fk-reset_mode-description' diff --git a/server/core/src/main/java/dev/slimevr/protocol/rpc/settings/RPCSettingsBuilder.java b/server/core/src/main/java/dev/slimevr/protocol/rpc/settings/RPCSettingsBuilder.java index e5666ef659..957b5e370b 100644 --- a/server/core/src/main/java/dev/slimevr/protocol/rpc/settings/RPCSettingsBuilder.java +++ b/server/core/src/main/java/dev/slimevr/protocol/rpc/settings/RPCSettingsBuilder.java @@ -187,7 +187,8 @@ public static int createModelSettings( humanPoseManager.getToggle(SkeletonConfigToggles.VIVE_EMULATION), humanPoseManager.getToggle(SkeletonConfigToggles.TOE_SNAP), humanPoseManager.getToggle(SkeletonConfigToggles.FOOT_PLANT), - humanPoseManager.getToggle(SkeletonConfigToggles.SELF_LOCALIZATION) + humanPoseManager.getToggle(SkeletonConfigToggles.SELF_LOCALIZATION), + humanPoseManager.getToggle(SkeletonConfigToggles.USE_POSITION) ); int ratiosOffset = ModelRatios .createModelRatios( diff --git a/server/core/src/main/java/dev/slimevr/protocol/rpc/settings/RPCSettingsHandler.kt b/server/core/src/main/java/dev/slimevr/protocol/rpc/settings/RPCSettingsHandler.kt index 38a44bbb25..a7f1b69117 100644 --- a/server/core/src/main/java/dev/slimevr/protocol/rpc/settings/RPCSettingsHandler.kt +++ b/server/core/src/main/java/dev/slimevr/protocol/rpc/settings/RPCSettingsHandler.kt @@ -251,6 +251,7 @@ class RPCSettingsHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) { hpm.setToggle(SkeletonConfigToggles.TOE_SNAP, toggles.toeSnap()) hpm.setToggle(SkeletonConfigToggles.FOOT_PLANT, toggles.footPlant()) hpm.setToggle(SkeletonConfigToggles.SELF_LOCALIZATION, toggles.selfLocalization()) + hpm.setToggle(SkeletonConfigToggles.USE_POSITION, toggles.usePosition()) } if (ratios != null) { diff --git a/server/core/src/main/java/dev/slimevr/tracking/processor/config/SkeletonConfigToggles.java b/server/core/src/main/java/dev/slimevr/tracking/processor/config/SkeletonConfigToggles.java index cffec046b0..ac008acf59 100644 --- a/server/core/src/main/java/dev/slimevr/tracking/processor/config/SkeletonConfigToggles.java +++ b/server/core/src/main/java/dev/slimevr/tracking/processor/config/SkeletonConfigToggles.java @@ -15,7 +15,8 @@ public enum SkeletonConfigToggles { VIVE_EMULATION(7, "Vive emulation", "viveEmulation", false), TOE_SNAP(8, "Toe Snap", "toeSnap", false), FOOT_PLANT(9, "Foot Plant", "footPlant", true), - SELF_LOCALIZATION(10, "Self Localization", "selfLocalization", false),; + SELF_LOCALIZATION(10, "Self Localization", "selfLocalization", false), + USE_POSITION(11, "Use Position", "usePosition", true),; public static final SkeletonConfigToggles[] values = values(); private static final Map byStringVal = new HashMap<>(); diff --git a/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/HumanSkeleton.kt b/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/HumanSkeleton.kt index 863598dd99..2a58dc74fc 100644 --- a/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/HumanSkeleton.kt +++ b/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/HumanSkeleton.kt @@ -869,6 +869,8 @@ class HumanSkeleton( SkeletonConfigToggles.FOOT_PLANT -> legTweaks.footPlantEnabled = newValue SkeletonConfigToggles.SELF_LOCALIZATION -> localizer.setEnabled(newValue) + + SkeletonConfigToggles.USE_POSITION -> ikSolver.enabled = newValue } } diff --git a/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/IKSolver.kt b/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/IKSolver.kt index b93b78d419..f9c98969e6 100644 --- a/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/IKSolver.kt +++ b/server/core/src/main/java/dev/slimevr/tracking/processor/skeleton/IKSolver.kt @@ -19,6 +19,7 @@ class IKSolver(private val root: Bone) { const val TOLERANCE_STEP = 2f } + var enabled = true private var chainList = mutableListOf() private var rootChain: IKChain? = null private var needsReset = false @@ -216,7 +217,7 @@ class IKSolver(private val root: Bone) { } fun solve() { - if (rootChain == null) return + if (rootChain == null || !enabled) return var solved: Boolean if (needsReset) { diff --git a/solarxr-protocol b/solarxr-protocol index fd74efca74..550259c90e 160000 --- a/solarxr-protocol +++ b/solarxr-protocol @@ -1 +1 @@ -Subproject commit fd74efca74126ec13fc11151fec8b5511e63a0b5 +Subproject commit 550259c90eb510fb6f47a087546d63ef596822dd