mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-22 01:51:20 -08:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df9148332f |
No files matched your search
@@ -116,9 +116,3 @@ licensed under `GPL-v3`.
|
||||
## Discord
|
||||
We use discord *a lot* to coordinate and discuss development. Come join us at
|
||||
https://discord.gg/SlimeVR!
|
||||
|
||||
## Use of AI
|
||||
We DO NOT accept contributions that are generated with AI (for example, "vibe-coding").
|
||||
|
||||
If you do use AI, and you believe your usage of AI is reasonable, you must clearly disclose
|
||||
how you used AI in your submission.
|
||||
+2
-1
@@ -13,4 +13,5 @@ rust-version = "1.82" # Tauri's MSRV
|
||||
repository = "https://github.com/SlimeVR/SlimeVR-Server"
|
||||
|
||||
[profile.release]
|
||||
lto = "thin"
|
||||
lto = true
|
||||
strip = true
|
||||
@@ -662,8 +662,6 @@ settings-general-fk_settings-skeleton_settings-impute_hip_from_waist_legs = Impu
|
||||
settings-general-fk_settings-skeleton_settings-interp_hip_legs = Average the hip's yaw and roll with the legs'
|
||||
settings-general-fk_settings-skeleton_settings-interp_knee_tracker_ankle = Average the knee trackers' yaw and roll with the ankles'
|
||||
settings-general-fk_settings-skeleton_settings-interp_knee_ankle = Average the knees' yaw and roll with the ankles'
|
||||
settings-general-fk_settings-skeleton_settings-fingers_mitten = Fingers Mitten Mode
|
||||
|
||||
|
||||
settings-general-fk_settings-self_localization-title = Mocap mode
|
||||
settings-general-fk_settings-self_localization-description = Mocap Mode allows the skeleton to roughly track its own position without a headset or other trackers. Note that this requires feet and head trackers to work and is still experimental.
|
||||
|
||||
@@ -75,7 +75,6 @@ export type SettingsForm = {
|
||||
usePosition: boolean;
|
||||
enforceConstraints: boolean;
|
||||
correctConstraints: boolean;
|
||||
fingersMitten: boolean;
|
||||
};
|
||||
ratios: {
|
||||
imputeWaistFromChestHip: number;
|
||||
@@ -135,7 +134,6 @@ const defaultValues: SettingsForm = {
|
||||
usePosition: true,
|
||||
enforceConstraints: true,
|
||||
correctConstraints: true,
|
||||
fingersMitten: false,
|
||||
},
|
||||
ratios: {
|
||||
imputeWaistFromChestHip: 0.3,
|
||||
@@ -233,7 +231,6 @@ export function GeneralSettings() {
|
||||
toggles.usePosition = values.toggles.usePosition;
|
||||
toggles.enforceConstraints = values.toggles.enforceConstraints;
|
||||
toggles.correctConstraints = values.toggles.correctConstraints;
|
||||
toggles.fingersMitten = values.toggles.fingersMitten;
|
||||
modelSettings.toggles = toggles;
|
||||
}
|
||||
|
||||
@@ -1039,15 +1036,6 @@ export function GeneralSettings() {
|
||||
'settings-general-fk_settings-skeleton_settings-extended_knees_model'
|
||||
)}
|
||||
/>
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
outlined
|
||||
control={control}
|
||||
name="toggles.fingersMitten"
|
||||
label={l10n.getString(
|
||||
'settings-general-fk_settings-skeleton_settings-fingers_mitten'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col">
|
||||
<div className="flex flex-col pt-2 pb-3 gap-2">
|
||||
|
||||
@@ -129,6 +129,9 @@ export function checkForUpdate(
|
||||
|
||||
if (
|
||||
!device.hardwareInfo?.officialBoardType ||
|
||||
![BoardType.SLIMEVR, BoardType.SLIMEVR_V1_2].includes(
|
||||
device.hardwareInfo.officialBoardType
|
||||
) ||
|
||||
!semver.valid(currentFirmwareRelease.version) ||
|
||||
!semver.valid(device.hardwareInfo.firmwareVersion?.toString() ?? 'none')
|
||||
) {
|
||||
@@ -140,14 +143,6 @@ export function checkForUpdate(
|
||||
currentFirmwareRelease.version
|
||||
);
|
||||
|
||||
if (
|
||||
![BoardType.SLIMEVR, BoardType.SLIMEVR_V1_2].includes(
|
||||
device.hardwareInfo.officialBoardType
|
||||
)
|
||||
) {
|
||||
return canUpdate ? 'unavailable' : 'updated';
|
||||
}
|
||||
|
||||
if (
|
||||
canUpdate &&
|
||||
device.hardwareStatus?.batteryPctEstimate != null &&
|
||||
|
||||
@@ -209,7 +209,6 @@ fun createModelSettings(
|
||||
humanPoseManager.getToggle(SkeletonConfigToggles.USE_POSITION),
|
||||
humanPoseManager.getToggle(SkeletonConfigToggles.ENFORCE_CONSTRAINTS),
|
||||
humanPoseManager.getToggle(SkeletonConfigToggles.CORRECT_CONSTRAINTS),
|
||||
humanPoseManager.getToggle(SkeletonConfigToggles.FINGERS_MITTEN),
|
||||
)
|
||||
val ratiosOffset = ModelRatios
|
||||
.createModelRatios(
|
||||
|
||||
@@ -241,7 +241,6 @@ class RPCSettingsHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) {
|
||||
hpm.setToggle(SkeletonConfigToggles.USE_POSITION, toggles.usePosition())
|
||||
hpm.setToggle(SkeletonConfigToggles.ENFORCE_CONSTRAINTS, toggles.enforceConstraints())
|
||||
hpm.setToggle(SkeletonConfigToggles.CORRECT_CONSTRAINTS, toggles.correctConstraints())
|
||||
hpm.setToggle(SkeletonConfigToggles.FINGERS_MITTEN, toggles.fingersMitten())
|
||||
}
|
||||
|
||||
if (ratios != null) {
|
||||
|
||||
+1
-2
@@ -17,8 +17,7 @@ public enum SkeletonConfigToggles {
|
||||
SELF_LOCALIZATION(10, "Self Localization", "selfLocalization", false),
|
||||
USE_POSITION(11, "Use Position", "usePosition", true),
|
||||
ENFORCE_CONSTRAINTS(12, "Enforce Constraints", "enforceConstraints", true),
|
||||
CORRECT_CONSTRAINTS(13, "Correct Constraints", "correctConstraints", true),
|
||||
FINGERS_MITTEN(14, "Fingers Mitten", "fingersMitten", true),;
|
||||
CORRECT_CONSTRAINTS(13, "Correct Constraints", "correctConstraints", true),;
|
||||
|
||||
public static final SkeletonConfigToggles[] values = values();
|
||||
private static final Map<String, SkeletonConfigToggles> byStringVal = new HashMap<>();
|
||||
|
||||
@@ -197,7 +197,6 @@ class HumanSkeleton(
|
||||
private var forceArmsFromHMD = true
|
||||
private var enforceConstraints = true
|
||||
private var correctConstraints = true
|
||||
private var fingersMitten = true
|
||||
|
||||
// Ratios
|
||||
private var waistFromChestHipAveraging = 0f
|
||||
@@ -1205,8 +1204,6 @@ class HumanSkeleton(
|
||||
SkeletonConfigToggles.ENFORCE_CONSTRAINTS -> enforceConstraints = newValue
|
||||
|
||||
SkeletonConfigToggles.CORRECT_CONSTRAINTS -> correctConstraints = newValue
|
||||
|
||||
SkeletonConfigToggles.FINGERS_MITTEN -> fingersMitten = newValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
Math.PI.toFloat(),
|
||||
0f,
|
||||
).toQuaternion()
|
||||
private val QuarterPitch = Quaternion.rotationAroundXAxis(FastMath.HALF_PI)
|
||||
|
||||
private var driftAmount = 0f
|
||||
private var averagedDriftQuat = Quaternion.IDENTITY
|
||||
private var rotationSinceReset = Quaternion.IDENTITY
|
||||
@@ -52,16 +54,6 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
|
||||
// Reference adjustment quats
|
||||
|
||||
/**
|
||||
* Gyro fix is set by full reset. This sets the current y rotation to 0, correcting
|
||||
* for initial yaw rotation and the rotation incurred by mounting orientation. This
|
||||
* is a local offset in rotation and does not affect the axes of rotation.
|
||||
*
|
||||
* This rotation is only used to compute [attachmentFix], otherwise [yawFix] would
|
||||
* correct for the same rotation.
|
||||
*/
|
||||
private var gyroFix = Quaternion.IDENTITY
|
||||
|
||||
/**
|
||||
* Attachment fix is set by full reset. This sets the current x and z rotations to
|
||||
* 0, correcting for initial pitch and roll rotation. This is a global offset in
|
||||
@@ -188,12 +180,9 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
/**
|
||||
* Get the reference adjusted accel.
|
||||
*/
|
||||
// TODO: Make this actually adjusted to the corrected IMU heading. The current
|
||||
// implementation for heading correction doesn't appear to be correct and may simply
|
||||
// make acceleration worse, so I'm just leaving this until we work that out. The
|
||||
// output of this will be world space, but with an unknown offset to heading (yaw).
|
||||
// - Butterscotch
|
||||
fun getReferenceAdjustedAccel(rawRot: Quaternion, accel: Vector3): Vector3 = rawRot.sandwich(accel)
|
||||
// All IMU axis corrections are inverse to undo `adjustToReference` after local yaw offsets are added
|
||||
// Order is VERY important here! Please be extremely careful! >~>
|
||||
fun getReferenceAdjustedAccel(rawRot: Quaternion, accel: Vector3): Vector3 = (adjustToReference(rawRot) * (attachmentFix * mountingOrientation * mountRotFix * tposeDownFix).inv()).sandwich(accel)
|
||||
|
||||
/**
|
||||
* Converts raw or filtered rotation into reference- and
|
||||
@@ -202,22 +191,17 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
*/
|
||||
private fun adjustToReference(rotation: Quaternion): Quaternion {
|
||||
var rot = rotation
|
||||
// Align heading axis with bone space
|
||||
if (!tracker.isHmd || tracker.trackerPosition != TrackerPosition.HEAD) {
|
||||
rot *= mountingOrientation
|
||||
}
|
||||
// Heading correction assuming manual orientation is correct
|
||||
rot = gyroFix * rot
|
||||
// Align attitude axes with bone space
|
||||
// Correct for global pitch/roll offset
|
||||
rot *= attachmentFix
|
||||
// Secondary heading axis alignment with bone space for automatic mounting
|
||||
// Note: Applying an inverse amount of heading correction corresponding to the
|
||||
// axis alignment quaternion will leave the correction to another variable
|
||||
rot = mountRotFix.inv() * (rot * mountRotFix)
|
||||
// More attitude axes alignment specifically for the t-pose configuration, this
|
||||
// probably shouldn't be a separate variable from attachmentFix?
|
||||
// Correct for global yaw offset without affecting local yaw so we can change this
|
||||
// later without invalidating local yaw offset corrections
|
||||
if (!tracker.isHmd || tracker.trackerPosition != TrackerPosition.HEAD) {
|
||||
rot = mountingOrientation.inv() * rot * mountingOrientation
|
||||
}
|
||||
rot = mountRotFix.inv() * rot * mountRotFix
|
||||
// T-pose global correction
|
||||
rot *= tposeDownFix
|
||||
// More heading correction
|
||||
// Align local yaw with reference
|
||||
rot = yawFix * rot
|
||||
rot = constraintFix * rot
|
||||
return rot
|
||||
@@ -227,8 +211,6 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
* Converts raw or filtered rotation into zero-reference-adjusted by
|
||||
* applying quaternions produced after full reset and yaw reset only
|
||||
*/
|
||||
// This is essentially just adjustToReference but aligning to quaternion identity
|
||||
// rather than to the bone.
|
||||
private fun adjustToIdentity(rotation: Quaternion): Quaternion {
|
||||
var rot = rotation
|
||||
rot = gyroFixNoMounting * rot
|
||||
@@ -283,15 +265,23 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
lastResetQuaternion = oldRot
|
||||
|
||||
// Adjust raw rotation to mountingOrientation
|
||||
val mountingAdjustedRotation = tracker.getRawRotation() * mountingOrientation
|
||||
val rotation = tracker.getRawRotation()
|
||||
|
||||
// Gyrofix
|
||||
if (tracker.allowMounting || (tracker.trackerPosition == TrackerPosition.HEAD && !tracker.isHmd)) {
|
||||
gyroFix = if (tracker.isComputed) {
|
||||
fixGyroscope(tracker.getRawRotation())
|
||||
val gyroFix = if (tracker.allowMounting || (tracker.trackerPosition == TrackerPosition.HEAD && !tracker.isHmd)) {
|
||||
if (tracker.isComputed) {
|
||||
fixGyroscope(rotation)
|
||||
} else {
|
||||
fixGyroscope(mountingAdjustedRotation * tposeDownFix)
|
||||
if (tracker.trackerPosition.isFoot()) {
|
||||
// Feet are rotated by 90 deg pitch, this means we're relying on IMU rotation
|
||||
// to be set correctly here.
|
||||
fixGyroscope(rotation * tposeDownFix * QuarterPitch)
|
||||
} else {
|
||||
fixGyroscope(rotation * tposeDownFix)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Quaternion.IDENTITY
|
||||
}
|
||||
|
||||
// Mounting for computed trackers
|
||||
@@ -306,7 +296,7 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
if (resetHmdPitch) {
|
||||
// Reset the HMD's pitch if it's assigned to head and resetHmdPitch is true
|
||||
// Get rotation without yaw (make sure to use the raw rotation directly!)
|
||||
val rotBuf = getYawQuaternion(tracker.getRawRotation()).inv() * tracker.getRawRotation()
|
||||
val rotBuf = getYawQuaternion(rotation).inv() * rotation
|
||||
// Isolate pitch
|
||||
Quaternion(rotBuf.w, -rotBuf.x, 0f, 0f).unit()
|
||||
} else {
|
||||
@@ -314,7 +304,7 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
Quaternion.IDENTITY
|
||||
}
|
||||
} else {
|
||||
fixAttachment(mountingAdjustedRotation)
|
||||
(gyroFix * rotation).inv()
|
||||
}
|
||||
|
||||
// Rotate attachmentFix by 180 degrees as a workaround for t-pose (down)
|
||||
@@ -326,7 +316,7 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
|
||||
// Don't adjust yaw if head and computed
|
||||
if (tracker.trackerPosition != TrackerPosition.HEAD || !tracker.isComputed) {
|
||||
yawFix = fixYaw(mountingAdjustedRotation, reference)
|
||||
yawFix = gyroFix * reference.project(Vector3.POS_Y).unit()
|
||||
tracker.yawResetSmoothing.reset()
|
||||
}
|
||||
|
||||
@@ -370,7 +360,7 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
lastResetQuaternion = oldRot
|
||||
|
||||
val yawFixOld = yawFix
|
||||
yawFix = fixYaw(tracker.getRawRotation() * mountingOrientation, reference)
|
||||
yawFix = fixYaw(tracker.getRawRotation(), reference)
|
||||
tracker.yawResetSmoothing.reset()
|
||||
|
||||
makeIdentityAdjustmentQuatsYaw()
|
||||
@@ -409,9 +399,9 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
constraintFix = Quaternion.IDENTITY
|
||||
|
||||
// Get the current calibrated rotation
|
||||
var rotBuf = adjustToDrift(tracker.getRawRotation() * mountingOrientation)
|
||||
rotBuf = gyroFix * rotBuf
|
||||
var rotBuf = adjustToDrift(tracker.getRawRotation())
|
||||
rotBuf *= attachmentFix
|
||||
rotBuf = mountingOrientation.inv() * rotBuf * mountingOrientation
|
||||
rotBuf = yawFix * rotBuf
|
||||
|
||||
// Adjust buffer to reference
|
||||
@@ -467,14 +457,22 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
mountRotFix = Quaternion.IDENTITY
|
||||
}
|
||||
|
||||
private fun fixGyroscope(sensorRotation: Quaternion): Quaternion = getYawQuaternion(sensorRotation).inv()
|
||||
|
||||
private fun fixAttachment(sensorRotation: Quaternion): Quaternion = (gyroFix * sensorRotation).inv()
|
||||
// EulerOrder.YXZ is actually better for gyroscope fix, as it can get yaw at any roll.
|
||||
// Consequentially, instead of the roll being limited, the pitch is limited to
|
||||
// 90 degrees from the yaw plane. This means trackers may be mounted upside down
|
||||
// or with incorrectly configured IMU rotation, but we will need to compensate for
|
||||
// the pitch.
|
||||
private fun fixGyroscope(sensorRotation: Quaternion): Quaternion = getYawQuaternion(sensorRotation, EulerOrder.YXZ).inv()
|
||||
|
||||
private fun fixYaw(sensorRotation: Quaternion, reference: Quaternion): Quaternion {
|
||||
var rot = gyroFix * sensorRotation
|
||||
rot *= attachmentFix
|
||||
rot = mountRotFix.inv() * (rot * mountRotFix)
|
||||
var rot = sensorRotation * attachmentFix
|
||||
// We need to fix the global yaw offset for the euler yaw calculation
|
||||
if (!tracker.isHmd || tracker.trackerPosition != TrackerPosition.HEAD) {
|
||||
rot = mountingOrientation.inv() * rot * mountingOrientation
|
||||
}
|
||||
rot = mountRotFix.inv() * rot * mountRotFix
|
||||
// TODO: Get diff from ref to rot, use euler angle (YZX) yaw as output.
|
||||
// This prevents pitch and roll from affecting the alignment.
|
||||
rot = getYawQuaternion(rot)
|
||||
return rot.inv() * reference.project(Vector3.POS_Y).unit()
|
||||
}
|
||||
@@ -485,7 +483,7 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
// In both cases, the isolated yaw value changes
|
||||
// with the tracker's roll when pointing forward.
|
||||
// calling twinNearest() makes sure this rotation has the wanted polarity (+-).
|
||||
private fun getYawQuaternion(rot: Quaternion): Quaternion = EulerAngles(EulerOrder.YZX, 0f, rot.toEulerAngles(EulerOrder.YZX).y, 0f).toQuaternion().twinNearest(rot)
|
||||
private fun getYawQuaternion(rot: Quaternion, order: EulerOrder = EulerOrder.YZX): Quaternion = EulerAngles(order, 0f, rot.toEulerAngles(order).y, 0f).toQuaternion().twinNearest(rot)
|
||||
|
||||
private fun makeIdentityAdjustmentQuatsFull() {
|
||||
val sensorRotation = tracker.getRawRotation()
|
||||
|
||||
@@ -93,13 +93,13 @@ class SkeletonResetTests {
|
||||
TrackerPosition.HIP,
|
||||
TrackerPosition.LEFT_LOWER_LEG,
|
||||
TrackerPosition.RIGHT_LOWER_LEG,
|
||||
-> mountRot * Quaternion.SLIMEVR.FRONT
|
||||
-> mountRot
|
||||
|
||||
TrackerPosition.LEFT_UPPER_LEG,
|
||||
TrackerPosition.RIGHT_UPPER_LEG,
|
||||
-> mountRot
|
||||
-> mountRot * Quaternion.SLIMEVR.FRONT
|
||||
|
||||
else -> mountRot
|
||||
else -> mountRot * Quaternion.SLIMEVR.FRONT
|
||||
}
|
||||
val actualMounting = tracker.resetsHandler.mountRotFix
|
||||
|
||||
|
||||
+1
-1
Submodule solarxr-protocol updated: c76469b50a...fa2895b19a.
Reference in new issue
Block a user