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:
@@ -29,6 +29,7 @@
|
||||
// ham thuan tren (luoi, diem). Viec gom scan khi xoay va dat pose ban dau la
|
||||
// cua ben goi.
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -146,14 +147,24 @@ RelocMatch GlobalMatch(const LikelihoodField& field,
|
||||
const std::vector<Point>& pts_odom,
|
||||
const GlobalLocalizerConfig& cfg);
|
||||
|
||||
// Khop CUC BO: robot phai nam trong `radius` quanh `center` (frame map), MOI
|
||||
// huong. De XAC MINH ung vien tu nguon khac (VPR). `odom_now`: pose robot
|
||||
// trong frame odom luc gom -- rang buoc dat tren vi tri ROBOT, khong phai tam
|
||||
// dam diem (o hanh lang tam lech robot nhieu met). score = -1 neu khong khop.
|
||||
// Khop CUC BO: robot phai nam trong `radius` quanh `center` (frame map). De
|
||||
// XAC MINH ung vien tu nguon khac (VPR). `odom_now`: pose robot trong frame
|
||||
// odom luc gom -- rang buoc dat tren vi tri ROBOT, khong phai tam dam diem (o
|
||||
// hanh lang tam lech robot nhieu met). score = -1 neu khong khop.
|
||||
//
|
||||
// `yaw_center` (rad, huong ROBOT trong map) + `yaw_window`: chi xet huong
|
||||
// trong cua so do. Mac dinh (NAN) = moi huong.
|
||||
//
|
||||
// ⚠️ VI SAO CAN GIOI HAN HUONG: robot that 2026-09-29, 113/249 lan hoi LiDAR
|
||||
// NHAP NHANG HUONG (mot scan LakiBeam ~270 do). Khop cuc bo MOI huong quanh
|
||||
// ung vien VPR dung cho van truot sang huong LON cung voi LiDAR toan cuc (4
|
||||
// lan chot sai, lech 105-177 do) -- vi no van dung LiDAR de chon huong. Anh
|
||||
// VPR biet camera nhin ve dau: de NO chon huong, LiDAR chi chinh chinh xac.
|
||||
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 = NAN, double yaw_window = M_PI);
|
||||
|
||||
// Tich luy gia thuyet qua nhieu vong, truyen bang ODOM (pose toan cuc chua
|
||||
// biet). "Streak" = so vong LIEN TIEP mot gia thuyet dung dau.
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user