diff --git a/docs/calibration.md b/docs/calibration.md index 13247b0..e8e6a43 100644 --- a/docs/calibration.md +++ b/docs/calibration.md @@ -14,8 +14,9 @@ result, so you calibrate once in the tracker and the game picks it up. 1. Start capture in the tracker (pick your camera and a 4:3 resolution, click **Start**). 2. Stand at your normal playing distance with your whole body in frame. -3. Click **Calibrate cursor** and **hold your right arm fully extended** out to the side for about - two seconds, as the status line prompts. +3. Click **Calibrate cursor** and **raise your right arm up and out toward the top corner of the + screen** - hand clearly above your shoulder and out to the side - for about two seconds, as the + status line prompts. The tracker averages the raised-arm hold, derives the arm-reach gains (`derive_arm_gains`), and saves them. The status line reports the gains it wrote, or a clear error if it didn't see a diff --git a/docs/setup-windows.md b/docs/setup-windows.md index a689e87..1bf2b24 100644 --- a/docs/setup-windows.md +++ b/docs/setup-windows.md @@ -54,8 +54,9 @@ Then: The menu hand-cursor is the one thing tuned to a specific camera and body. The built-in calibration measures your own arm reach so the cursor covers the whole screen on your setup. -With capture running, click **Calibrate cursor** and hold your right arm fully extended for about -two seconds as prompted. The tracker derives your arm-reach gains and writes them to the shared +With capture running, click **Calibrate cursor** and raise your right arm up and out toward the +top corner of the screen - hand clearly above your shoulder and out to the side - for about two +seconds as prompted. The tracker derives your arm-reach gains and writes them to the shared config file the shim reads. See [docs/calibration.md](calibration.md) for the details and for re-running it if the cursor feels off. diff --git a/tests/test_calibration.cpp b/tests/test_calibration.cpp index 462ca9c..21d9985 100644 --- a/tests/test_calibration.cpp +++ b/tests/test_calibration.cpp @@ -110,6 +110,50 @@ TEST(calibration, DeriveArmGainsAveragesHoldAndScalesToTargetReach) { EXPECT_NEAR(gains.y, nui::calibration::kTargetArmReachY / 0.3f, 1e-5f); } +// Plan todo 9 (Final Verification F2): the calibration prompt tells the +// player to raise the arm UP and OUT toward a top screen corner - diagonal, +// giving both lateral (X) and above-shoulder (Y) reach - not a purely +// horizontal "out to the side" hold. A diagonal observation like this must +// derive succeed with both gains inside the open (1.0, 6.0) range (neither +// rejected for a too-small reach nor pinned to the kArmGainMax clamp), while +// the horizontal-only gesture the old wording asked for (no vertical reach) +// must still be rejected so a regression back to that wording is caught. +TEST(calibration, DeriveArmGainsSucceedsOnDiagonalUpAndOutGesture) { + std::vector diagonal_hold; + for (int i = 0; i < 16; ++i) { + nui::calibration::RaiseRightArmObservation o{}; + o.person_detected = true; + o.measured_reach_x = 0.5f; // lateral reach + o.measured_reach_y = 0.3f; // reach above the shoulder + diagonal_hold.push_back(o); + } + nui::calibration::ArmGains gains{}; + std::string error; + ASSERT_TRUE( + nui::calibration::derive_arm_gains(diagonal_hold, gains, error)); + EXPECT_TRUE(error.empty()); + EXPECT_GT(gains.x, nui::calibration::kArmGainMin); + EXPECT_LT(gains.x, nui::calibration::kArmGainMax); + EXPECT_GT(gains.y, nui::calibration::kArmGainMin); + EXPECT_LT(gains.y, nui::calibration::kArmGainMax); + + // The horizontal-only gesture the old wording produced (no vertical reach) + // must still fail with the "reach too small" error, not silently succeed. + std::vector horizontal_hold; + for (int i = 0; i < 16; ++i) { + nui::calibration::RaiseRightArmObservation o{}; + o.person_detected = true; + o.measured_reach_x = 0.5f; + o.measured_reach_y = 0.0f; + horizontal_hold.push_back(o); + } + nui::calibration::ArmGains unused_gains{}; + std::string horizontal_error; + EXPECT_FALSE(nui::calibration::derive_arm_gains(horizontal_hold, unused_gains, + horizontal_error)); + EXPECT_NE(horizontal_error.find("too small"), std::string::npos); +} + TEST(calibration, DeriveArmGainsClampsToRangeAndRejectsBadHolds) { nui::calibration::ArmGains gains{}; std::string error; diff --git a/tracker-native/build.sh b/tracker-native/build.sh old mode 100644 new mode 100755 diff --git a/tracker-native/src/win_main.cpp b/tracker-native/src/win_main.cpp index db07101..4b28b5e 100644 --- a/tracker-native/src/win_main.cpp +++ b/tracker-native/src/win_main.cpp @@ -2,7 +2,7 @@ // -O2 -finline-functions codegen bug that silently truncates/corrupts string // literals in this translation unit (reproduced on pre-existing code too, not // just new additions - e.g. CalibrateCursor's "Start capture first, then -// raise your right arm to calibrate" truncates to "Start caH" without this). +// raise your right arm up and out to calibrate" truncates to "Start caH" without this). // Disabling just this one pass for the file keeps -O2 everywhere else in the // build while avoiding the bug; no build-script change needed. #pragma GCC optimize ("no-inline-functions") @@ -632,7 +632,7 @@ void StopCapture() { // the hold does not block the UI message loop. void CalibrateCursor() { if (!g_app.running) { - SetStatus("Start capture first, then raise your right arm to calibrate"); + SetStatus("Start capture first, then raise your right arm up and out to calibrate"); return; } { @@ -640,7 +640,7 @@ void CalibrateCursor() { g_app.cal_samples.clear(); } g_app.cal_active = true; - SetStatus("Calibrating cursor: hold your right arm fully extended..."); + SetStatus("Calibrating cursor: raise your right arm up and out toward the top corner of the screen - hand clearly above your shoulder and out to the side..."); std::thread([] { std::this_thread::sleep_for(std::chrono::milliseconds(1800)); g_app.cal_active = false;