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

@@ -453,7 +453,8 @@ RelocMatch GlobalMatch(const LikelihoodField& field,
RelocHypothesis LocalMatch(const LikelihoodField& field,
const std::vector<Point>& pts_odom, const Pose2D& odom_now,
const Point& center, double radius,
const GlobalLocalizerConfig& cfg) {
const GlobalLocalizerConfig& cfg,
double yaw_center, double yaw_window) {
RelocHypothesis out;
out.score = -1.0;
if (field.empty() || pts_odom.empty()) return out;
@@ -473,6 +474,12 @@ RelocHypothesis LocalMatch(const LikelihoodField& field,
std::vector<float> sc;
for (int ia = 0; ia < cz.n_ang; ++ia) {
const double th = ia * cz.step;
// Huong ROBOT trong map ung voi goc th: th + odom_now.theta. Cong mot buoc
// goc de khong cat hut goc tho sat bien cua so (tinh chinh +-1 buoc).
if (std::isfinite(yaw_center) &&
std::fabs(AngleDiff(th + odom_now.theta, yaw_center)) > yaw_window + cz.step) {
continue;
}
const double ct = std::cos(th), st = std::sin(th);
const double px = cx - (ct * bx - st * by), py = cy - (st * bx + ct * by);
const AnglePeak pk = ScoreAngle(