ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

gmapping only updates map once

asked 2017-11-13 03:02:52 -0500

simon gravatar image

updated 2017-11-13 03:29:52 -0500


I am having problems getting gmapping to work.

I am running kinetic on Ubuntu 16.04, with a Turtlebot robot

The problem is gmapping runs but only updates the map once with the first laser scan. All subsequent scans are registered, and localisation seems to occur (odom is updated when robot moves, and robot is localised against initial map, but the map does not change (no new maps are broadcast). The output of slam_gmapping shows "Regsitering scans: Done" & "Laser Pose =...". Sometimes I see: "Partilces Deleted", but no other output

I believe I have set up the frames correctly, rtq_tf_tree shows map->odom->base_footprint->base_link->laser and I can see laser and updated odom in rviz.

I checked rtq_console for gmapping debugging and it says "cannot process scan" from laserCallback:630

EDIT> problem seems to occur in slam_gmapping.cpp int function addScan()

which calls gsp_->processScan(reading)

where reading is:

GMapping::RangeReading reading(scan.ranges.size(), ranges_double, gsp_laser_, scan.header.stamp.toSec());

The gsp_ object is of type GMapping::GridSlamProcessor, which I can't find the code for at the moment.

I guess the problem might be in the scan.header timestamp? Anything specific I should check? - EDIT

I will look at that code (I presume 630 is the line number)

I generate the scans from point_cloud_to_laser_scan (using Occam Stereo ros node to generate pointcloud2 had to hack code to change from pointcloud type & publish as pointcloud2) so I guess I might be doing something wrong there, but the scans are visible and gmapping says they are being registered OK.


I convert using sensor_msgs::convertPointCloudToPointCloud2() then publish The Occam node code only seems to be initising the point cloud header frame_id before I convert to pointcloud so the lack of a time stamp here might be the problem.

Does publishing initialise timestamps or shoul I set manually before publishing? -EDIT

Anything likely candidates as to why scan produced by point_cloud_to_scan can be registered for localisation but not processed for map update?

I have tried setting "linearUpdate", "angularUpdate", "temporalUpdate" & "map_update_interval" to appropriate values.

I would appreciate any suggestions.

edit retag flag offensive close merge delete


Does publishing initialise timestamps or shoul I set manually before publishing?

not an answer, but no, calling publish(..) does not update timestamps, you have to set those fields yourself.

gvdhoorn gravatar image gvdhoorn  ( 2017-11-13 03:35:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-11-13 03:37:54 -0500

simon gravatar image

Fixed - setting the header time stamp in the occam stereo node fixed the problem. Sorry to waste anyone time reading this, but writing this out helped me to think about the problem. Hope it can help someone else.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-11-13 03:02:52 -0500

Seen: 568 times

Last updated: Nov 13 '17