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

Gmapping: map doesn't update

asked 2018-03-01 13:51:06 -0500

denisolt gravatar image

updated 2018-03-01 14:01:40 -0500

We have a custom 2 wheel robot using Pololu Motor Shields, with ROS_arduino_bridge to convert odometry ticks into quaternion and publishing to /odom. We also use a Hokuyo Laser Scanner. While running the Gmapping launch file, we are capable of getting the first map. However, it does not update. We have tried setting small parameters for Angular and Linear update - nothing. When we force gmapping to make a map using TemporalUpdate, it just creates multiple maps and puts one on top of another. On top of everything when we do not use TemporalUpdate, the base scan starts drifting all over the map.

Any suggestions on how to fix these issues:

  1. getting rid off drifting
  2. updating the map

Our gmapping launch file:

<node pkg="urg_node" type="urg_node" name="laser_scan">
<param name="port" value="/dev/ttyACM0"/>
<param name="frame_id" value="map"/>
<remap from="scan" to="base_scan"/>

<node pkg="tf" type="static_transform_publisher" name="base_link_to_base_laser_link" args="0.058 0 0.125 0.0 0.0 3.1416 /base_link /base_scan 100"/>

<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
odom_frame: odom
maxUrange: 5.4
maxRange: 5.4
base_frame: base_link
<remap from="scan" to="base_scan" />
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-02 03:33:23 -0500

mgruhler gravatar image

updated 2018-03-02 03:36:12 -0500

I see several issues with your configuration:

  1. the frame_id of the urg_node should definitely not be map. laser_link or something would be more suited. Otherwise, the data coming from the laser would always be considered to be sent w.r.t map, which makes no sense. This should be the cause for Problem 1.
  2. the static_transform_publisher needs to go from base_link to the frame_id you specify above, in my example laser_link. This will then provide you with the possibility to transform the laser data from the laser_link to base_link.
  3. The gmapping config seems to be correct, assuming you do publish the transform from odom to base_link. If this is not published to tf, gmapping won't update, which could be your Problem 2. You can check with rosrun tf tf_echo odom base_link if there is a tf published. If not, you need to create a tf_broadcaster from your odometry, see the wiki for how to do that.
edit flag offensive delete link more


I would also add that you have to remap from="base_scan" to= "scan", you have inverted them.

Delb gravatar image Delb  ( 2018-03-02 03:51:34 -0500 )edit

@Delb You think so? The remapping should be correct, as gmapping, by default, has a scan topic. So @denisolt is asking gmapping to listen to base_scan. One could argue that this is unnecessary, as he is doing the same remapping above in the urg_node, so you could get rid of both...

mgruhler gravatar image mgruhler  ( 2018-03-02 07:42:05 -0500 )edit

Thanks a ton! @mig everything works!

denisolt gravatar image denisolt  ( 2018-03-02 11:46:04 -0500 )edit

@mig Yes you're right I checked again and urg_node is also by default publishing on scan so yes the remapping is unnecessary. Thank you for pointing that out !

Delb gravatar image Delb  ( 2018-03-05 01:38:33 -0500 )edit

Question Tools



Asked: 2018-03-01 13:51:06 -0500

Seen: 1,746 times

Last updated: Mar 02 '18