reloc: LocalMatch + bench --split-id/--vpr-csv + phan tich ghep VPR/LiDAR; robot that: 85 -> 108 chot dung, 0 sai

This commit is contained in:
trung09122002
2026-09-29 10:26:00 +07:00
parent ca3b7854ea
commit 399a46139e
8 changed files with 549 additions and 92 deletions

View File

@@ -165,6 +165,39 @@ TEST(GlobalLocalizer, PhongKhongDoiXungTimDungPose) {
<< "ty le " << m.ratio() << ", ty le huong " << m.ratio_yaw();
}
TEST(GlobalLocalizer, KhopCucBoQuanhUngVien) {
// Ung vien tu nguon khac (VPR) lech 0.8 m khoi cho that: khop cuc bo phai
// tim ra cho that. Ung vien o goc kia cua phong: diem phai thap han.
OccupancyGrid g = MakeGrid(12.0, 10.0);
AsymRoom(&g, 0.0, 0.0);
const LikelihoodField f = LikelihoodField::FromGrid(g, 0.15);
const GlobalLocalizerConfig cfg;
const Pose2D truth = kAsymTruth;
const Pose2D odom{-1.0, 0.5, -0.3};
const std::vector<Point> pts = ToOdom(Raycast(g, truth), odom);
Point near_c;
near_c.x = truth.x + 0.8;
near_c.y = truth.y - 0.5;
const RelocHypothesis h = LocalMatch(f, pts, odom, near_c, 2.5, cfg);
ASSERT_GT(h.score, 0.0);
const Pose2D est = Pose2DCompose(h.map_from_odom, odom);
EXPECT_LT(std::hypot(est.x - truth.x, est.y - truth.y), 0.1);
EXPECT_LT(std::fabs(AngleDiff(est.theta, truth.theta)) * 180.0 / M_PI, 1.0);
Point far_c;
far_c.x = 9.5;
far_c.y = 8.5;
const RelocHypothesis hf = LocalMatch(f, pts, odom, far_c, 1.0, cfg);
const Pose2D ef = Pose2DCompose(hf.map_from_odom, odom);
EXPECT_LT(hf.score, 0.7 * h.score) << "cho sai ma diem " << hf.score << " / " << h.score;
// Rang buoc tren ROBOT: pose tim duoc phai nam quanh tam da cho (ban kinh
// 1 m + nua o tho 0.4 m + tinh chinh toi 0.5 m), khong phai o cho that
// cach do ~6 m.
EXPECT_LT(std::hypot(ef.x - far_c.x, ef.y - far_c.y), 2.0);
}
TEST(GlobalLocalizer, HaiPhongGiongHetLaNhapNhang) {
// Hai phong KHONG doi xung nhung GIONG HET nhau, cach 12 m, khong thong
// nhau. Scan chi thay phong minh dang dung -> khong co cach nao biet la