Ask Your Question

tf::MessageFilter, laser callback in gmapping

asked 2014-02-06 03:34:07 -0500

bvbdort gravatar image

updated 2016-10-24 08:35:49 -0500

ngrennan gravatar image

hi ,

i am working with offlinedata to build gridmap using gmapping in ros.

My query is why SlamGMapping::laserCallback is not getting called everytime it recieves a sensor_msgs::LaserScan.

For mycase when i am publishing 107 sensor_msgs::LaserScan and 107 /tf and 107 nav_msgs::Odometry messages SlamGMapping::laserCallback is called only for 6 times for messages 0,1,18,65,78,99.


  scan_filter_sub_ = new message_filters::Subscriber<sensor_msgs::LaserScan>(node_, "scan", 5);
  scan_filter_ = new tf::MessageFilter<sensor_msgs::LaserScan>(*scan_filter_sub_, tf_, odom_frame_, 5);
  scan_filter_->registerCallback(boost::bind(&SlamGMapping::laserCallback, this, _1));


void SlamGMapping::laserCallback(const sensor_msgs::LaserScan::ConstPtr& scan)
  ROS_INFO("laser_count_= %d  sequence =%d",laser_count_,scan->header.seq);

why SlamGMapping::laserCallback is not getting called everytime it recieves sensor_msgs::LaserScan and /tf.

How to make all the scans being processed.

-- Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-02-06 19:29:18 -0500

fergs gravatar image

gmapping does not use every laserscan, as this would cause the graph to get huge and also probably run quite slowly. Instead, it uses laserscans that are "sufficiently far apart", based on three parameters:

  • linearUpdate
  • angularUpdate
  • temporalUpdate (usually not used)

The parameters and their defaults are described on the wiki page:

edit flag offensive delete link more


@fergs i am using settings "linearUpdate" ="0.5"( 50 cm) and "angularUpdate"="0.052"(3 degrees) "temporalUpdate"="-1.0"( all scans) but checking these settings is in processscan which is called from addscan which is from laser call back. I doubt i need to sync odom->base tf with laserscan.

bvbdort gravatar image bvbdort  ( 2014-02-06 21:01:30 -0500 )edit

I'm not familiar with the interior of the code base, but, -1.0 for a temporalUpdate does not mean "all scans", rather it means that you never trigger based on temporal updates, thus only based on x/angular movement (if you never moved, you would never update).

fergs gravatar image fergs  ( 2014-02-06 22:41:46 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-02-06 03:34:07 -0500

Seen: 762 times

Last updated: Feb 24 '14