Add mounting reset

This commit is contained in:
Butterscotch! committed 2026-06-02 03:05:52 -04:00
1 parent 5f3b1fd0a5
commit c43b44ccc8
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() }