mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-28 04:46:31 -08:00
Add mounting reset
This commit is contained in:
3 files changed
+83
-2
No files matched your search
@@ -274,6 +274,7 @@ class SessionCalibrationTest {
|
||||
message = "Estimated heading correction is wrong",
|
||||
)
|
||||
|
||||
// TODO: See if we can avoid using twinNearest
|
||||
val estimatedAttitudeAlign =
|
||||
estimateAttitudeAlign(rawRotation, estimatedHeadingCorrect)
|
||||
quaternionAssertEquals(
|
||||
@@ -283,6 +284,47 @@ class SessionCalibrationTest {
|
||||
)
|
||||
}
|
||||
|
||||
@TestFactory
|
||||
fun estimateHeadingAlignTests(): List<DynamicTest> {
|
||||
val frontRot = Quaternion(0.707f, 0.707f, 0f, 0f)
|
||||
return heading.flatMap { hA ->
|
||||
heading.map { ref ->
|
||||
DynamicTest.dynamicTest(
|
||||
"( hA: $hA, ref: $ref )",
|
||||
) {
|
||||
testEstimateHeadingAlign(
|
||||
ref * frontRot,
|
||||
hA,
|
||||
ref
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun testEstimateHeadingAlign(
|
||||
calibratedRotation: CalibratedRotation,
|
||||
headingAlign: HeadingAlignment,
|
||||
reference: Quaternion,
|
||||
) {
|
||||
// Only undo heading
|
||||
val rawRotation = undoCalibration(
|
||||
calibratedRotation,
|
||||
headingAlign = headingAlign,
|
||||
)
|
||||
|
||||
// TODO: See if we can avoid using twinNearest
|
||||
val estimateHeadingAlign = estimateHeadingAlign(
|
||||
rawRotation,
|
||||
reference,
|
||||
)
|
||||
quaternionAssertEquals(
|
||||
headingAlign,
|
||||
estimateHeadingAlign.twinNearest(headingAlign),
|
||||
message = "Estimated heading alignment is wrong",
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
// 5 steps
|
||||
val step = (-180..180 step 72).map { it.toFloat() }
|
||||
|
||||
Reference in new issue
Block a user