reloc: --slam-reloc(-auto) tu dinh vi lai trong node (tu xoay/tu di, nguoi luon thang); web ve robot mo o vi tri doan; sieu am cho xoay; LocalMatch gioi han huong

This commit is contained in:
trung09122002
2026-09-29 11:16:04 +07:00
parent 399a46139e
commit 60853531aa
15 changed files with 883 additions and 27 deletions

View File

@@ -156,6 +156,8 @@ int main(int argc, char** argv) {
// Ung vien VPR (tools/vpr_eval.py --topk-csv): query_id,rank,node_id,sim.
std::string vpr_csv, fusion_csv;
double vpr_radius = 2.5;
// Cua so huong quanh huong node anh VPR cho lan khop cuc bo THU HAI (vloc).
double vpr_yaw_deg = 45.0;
for (int i = 1; i < argc; ++i) {
const std::string a = argv[i];
@@ -173,6 +175,7 @@ int main(int argc, char** argv) {
else if (a == "--vpr-csv") vpr_csv = next();
else if (a == "--fusion-csv") fusion_csv = next();
else if (a == "--vpr-radius") vpr_radius = std::atof(next().c_str());
else if (a == "--vpr-yaw-deg") vpr_yaw_deg = std::atof(next().c_str());
else if (a == "--help") {
std::printf(
"cach dung: %s --map-db A.db [--query-db B.db] [--n 200] [--seq K]\n"
@@ -284,7 +287,7 @@ int main(int argc, char** argv) {
std::fprintf(fus,
"query_id,glob_ok,glob_verdict,glob_ratio,glob_ratio_yaw,glob_s1,glob_x,glob_y,"
"glob_th,truth_x,truth_y,truth_th,rank,vpr_node,vpr_sim,vpr_node_dist_m,"
"loc_score,loc_x,loc_y,loc_th\n");
"loc_score,loc_x,loc_y,loc_th,vloc_score,vloc_x,vloc_y,vloc_th\n");
}
if (!split && query_db != map_db) {
@@ -363,7 +366,7 @@ int main(int argc, char** argv) {
ge.theta, tru.x, tru.y, tru.theta);
const auto it = vpr.find(nodes[idx].id);
if (it == vpr.end()) {
std::fprintf(fus, "%s,0,-1,0,0,-1,0,0,0\n", head);
std::fprintf(fus, "%s,0,-1,0,0,-1,0,0,0,-1,0,0,0\n", head);
} else {
int rank = 0;
for (const auto& cand : it->second) {
@@ -378,9 +381,18 @@ int main(int argc, char** argv) {
const vslam::Pose2D le = h.score > 0.0
? vslam::Pose2DCompose(h.map_from_odom, nodes[last].odom)
: vslam::Pose2D{};
std::fprintf(fus, "%s,%d,%d,%.4f,%.3f,%.2f,%.3f,%.3f,%.4f\n", head, rank, cand.first,
cand.second, std::hypot(center.x - tru.x, center.y - tru.y), h.score,
le.x, le.y, le.theta);
// Lan hai: HUONG do anh VPR chon (+-vpr_yaw_deg quanh huong node
// anh), LiDAR chi chinh vi tri/huong trong cua so do.
const vslam::RelocHypothesis hv = vslam::LocalMatch(
field, pts, nodes[last].odom, center, vpr_radius, cfg, mp->second.theta,
vpr_yaw_deg * M_PI / 180.0);
const vslam::Pose2D ve = hv.score > 0.0
? vslam::Pose2DCompose(hv.map_from_odom, nodes[last].odom)
: vslam::Pose2D{};
std::fprintf(fus, "%s,%d,%d,%.4f,%.3f,%.2f,%.3f,%.3f,%.4f,%.2f,%.3f,%.3f,%.4f\n", head,
rank, cand.first, cand.second,
std::hypot(center.x - tru.x, center.y - tru.y), h.score, le.x, le.y,
le.theta, hv.score, ve.x, ve.y, ve.theta);
}
}
}