koide3/hdl_global_localization

calc_score of candidate in bbs

narutojxl opened this issue · 2 comments

Hi author,
In code we use DiscreteTransformation::calc_score() to score each candidate,

const auto& gridmap = gridmap_pyramid[level];
auto transformed = transform(points, gridmap->grid_resolution(), theta_resolution);
score = gridmap->calc_score(transformed);

if we use the transformed points creates a grid_map with OccupancyGridMap::insert_points(), and then comapre the difference pixel by pixel, and then sum the whole difference value. We also modify bbs_localization.cpp#L27, to return score > rhs.score;. The smaller difference, the better the candidate.
Have you tried this scoring method? Thanks for your help and time !

This algorithm finds the transformation that maximizes the log likelihood (e.g., num of hit count), thus the larger score, the better. We can reform it as a minimization problem by modifying DiscreteTransformation::operator< as well as OccupancyGridMap::pyramid_up, but I suppose it doesn't make a significant difference on the branch pruning efficiency because it's just an inverse of the current formulation.

Thanks author :), my problem is solved.