fix(calibration): gesture wording matches derivation (todo 9); restore build.sh exec bit
This commit is contained in:
1 parent
ee6781ef31
commit
48eb19dd43
5 files changed
+53
-7
No files matched your search
+3
-2
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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<nui::calibration::RaiseRightArmObservation> 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<nui::calibration::RaiseRightArmObservation> 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;
|
||||
|
||||
Regular → Executable
File mode changed.
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user