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

make minimum_travel_heading work #451

Open
wants to merge 3 commits into
base: melodic-devel
Choose a base branch
from
Open
Changes from 1 commit
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 slam_toolbox/src/slam_toolbox_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ bool SlamToolbox::shouldProcessScan(
static ros::Time last_scan_time = ros::Time(0.);
static const double dist_thresh_sq = smapper_->getMapper()->getParamMinimumTravelDistance()*
smapper_->getMapper()->getParamMinimumTravelDistance();
static const double head_thresh = smapper_->getMapper()->getParamMinimumTravelHeading();

// we give it a pass on the first measurement to get the ball rolling
if (first_measurement_)
Expand Down Expand Up @@ -446,8 +447,9 @@ bool SlamToolbox::shouldProcessScan(

// check moved enough, within 10% for correction error
const double sq_dist_to_last_accepted_pose = last_pose.SquaredDistance(pose);
const double head_to_last_accepted_pose = fmod(fabs(pose.GetHeading() - last_pose.GetHeading()), M_PI) / M_PI * 180;
zengxiaolei marked this conversation as resolved.
Show resolved Hide resolved

if(sq_dist_to_last_accepted_pose < 0.8 * dist_thresh_sq || scan->header.seq < 5)
if((sq_dist_to_last_accepted_pose < 0.8 * dist_thresh_sq && head_to_last_accepted_pose < head_thresh)|| scan->header.seq < 5)
zengxiaolei marked this conversation as resolved.
Show resolved Hide resolved
{
return false;
}
Expand Down