Can I recognized if localization is failed?
zang09 opened this issue · comments
Thank you for sharing your work, koide.
I wonder that is there any way to get error value between align points and map??
I mean, I want to get some message if localization is fail or not.
This package doesn't output the alignment error between the input cloud and the map, and you may need to implement some code by yourself. I think one good way is to compute inlier_fraction
between cloud and map like the RANSAC pose estimator does.
thank you! I will try it.
Hi @zang09,
Have you made some progress. I also have the same issue. Would you mind giving some instruction on it? Thanks a lot.
You can get score by add code like this:
double score;
auto aligned = pose_estimator->correct(filtered, score);
after pose_estimator->predict()
Hi @zang09 ,
Thanks for your kindly reply. But the pose_estimator -> correct()
function only has one argument. In pose_estimator.hpp:
/**
* @brief correct
* @param cloud input cloud
* @return cloud aligned to the globalmap
*/
pcl::PointCloud<PointT>::Ptr correct(const pcl::PointCloud<PointT>::ConstPtr& cloud) {
You can consider trying pub_status
branch in which some information on the scan matching result (convergence, matching_error, inlier_fraction) are published to /status
topic.
https://github.com/koide3/hdl_localization/blob/pub_status/msg/ScanMatchingStatus.msg
In my case, I added new argument.
But I think pub_status
branch that @koide3 mention is the better option!
pcl::PointCloud<PointT>::Ptr correct(const pcl::PointCloud<PointT>::ConstPtr& cloud, double &fitnessScore) {
.
.
.
pcl::PointCloud<PointT>::Ptr aligned(new pcl::PointCloud<PointT>());
registration->setInputSource(cloud);
registration->align(*aligned, init_guess);
fitnessScore = registration->getFitnessScore();
.
.
.
}