Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

also check headings in shouldProcessScan #545

Open
wants to merge 1 commit into
base: ros2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/slam_toolbox_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ bool SlamToolbox::shouldProcessScan(
static double min_dist2 =
smapper_->getMapper()->getParamMinimumTravelDistance() *
smapper_->getMapper()->getParamMinimumTravelDistance();
static double min_heading = math::DegreesToRadians(smapper_->getMapper()->getParamMinimumTravelHeading());
static int scan_ctr = 0;
scan_ctr++;

Expand Down Expand Up @@ -522,7 +523,8 @@ bool SlamToolbox::shouldProcessScan(

// check moved enough, within 10% for correction error
const double dist2 = last_pose.SquaredDistance(pose);
if (dist2 < 0.8 * min_dist2 || scan_ctr < 5) {
double heading_diff = pose.GetHeading() - last_pose.GetHeading();
if ((dist2 < 0.8 * min_dist2 && fabs(heading_diff) < 0.9 * min_heading) || scan_ctr < 5) {
return false;
}

Expand Down