Drop the separate calibration terms, keep one set of offsets
The split existed to stop a footprint change from silently discarding a field correction tuned into the same number. Two knobs per axis is a cost paid on every read of the config, and the person tuning these is the one who knows which part is which, so the simpler shape wins. The derivation stays where it matters: the formula for offset_x - half the robot, the padding, the wing projection, the clearance - is written out in the runtime config next to the value, so recomputing it after a footprint change does not start from a guess.
This commit is contained in:
@@ -217,50 +217,6 @@ TEST(VPatternMatcher, TheOffsetMovesTheGoalOutTowardTheRobot)
|
||||
EXPECT_NEAR(d.y, 0.00, 0.03);
|
||||
}
|
||||
|
||||
TEST(VPatternMatcher, CalibrationShiftsTheGoalOnTopOfTheOffset)
|
||||
{
|
||||
DockProfile p = vProfile();
|
||||
p.offset_x = 0.60; // [m] phần HÌNH HỌC, suy ra bằng công thức
|
||||
p.calib_x = -0.03; // [m] phần ĐO ĐƯỢC: lần dock thật dừng xa 3 cm
|
||||
p.calib_y = 0.02; // [m]
|
||||
|
||||
Rig rig(p);
|
||||
ASSERT_TRUE(rig.ok_) << rig.error_;
|
||||
|
||||
const Detection d = rig.run(vPlate(1.20, M_PI / 4.0, 0.30));
|
||||
ASSERT_TRUE(d.valid) << d.reason;
|
||||
|
||||
// Đỉnh ở x=1.20; hiệu chỉnh cộng thẳng vào offset, cùng hệ quy chiếu của hình.
|
||||
// Hình quay 180 độ so với trục x của cảm biến nên +x của hình là -x của cảm biến.
|
||||
EXPECT_NEAR(d.apex_x, 1.20, 0.02);
|
||||
EXPECT_NEAR(d.x, 1.20 - (0.60 - 0.03), 0.03);
|
||||
EXPECT_NEAR(d.y, -0.02, 0.03);
|
||||
}
|
||||
|
||||
TEST(VPatternMatcher, RefusesACalibrationBigEnoughToBeHidingAGeometryError)
|
||||
{
|
||||
VPatternMatcher matcher;
|
||||
std::string error;
|
||||
|
||||
DockProfile huge = vProfile();
|
||||
huge.calib_x = 0.5; // [m]
|
||||
// Hiệu chỉnh hiện trường là centimet. Nửa mét nghĩa là `offset_x` sai, và dán băng dính lên nó
|
||||
// bằng calib là giấu mất nguyên nhân — lần đổi footprint sau sẽ không ai hiểu con số này từ đâu.
|
||||
EXPECT_FALSE(matcher.configure(huge, error));
|
||||
EXPECT_NE(error.find("calib_x"), std::string::npos) << error;
|
||||
|
||||
DockProfile spin = vProfile();
|
||||
spin.calib_yaw = 0.6; // [rad] ~34 do
|
||||
EXPECT_FALSE(matcher.configure(spin, error));
|
||||
EXPECT_NE(error.find("calib_yaw"), std::string::npos) << error;
|
||||
|
||||
// Hiệu chỉnh thật thì phải nhận.
|
||||
DockProfile ok = vProfile();
|
||||
ok.calib_x = -0.03;
|
||||
ok.calib_yaw = 0.02;
|
||||
EXPECT_TRUE(matcher.configure(ok, error)) << error;
|
||||
}
|
||||
|
||||
TEST(VPatternMatcher, ATiltedPlateIsStillFoundAndItsYawFollows)
|
||||
{
|
||||
Rig rig;
|
||||
|
||||
Reference in New Issue
Block a user