Rosanswers logo

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" />

Originally posted by denisolt on ROS Answers with karma: 3 on 2018-03-01

Post score: 0


1 Answer 1


Rosanswers logo

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.

Originally posted by mgruhler with karma: 12390 on 2018-03-02

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by Delb on 2018-03-02:
I would also add that you have to remap from="base_scan" to= "scan", you have inverted them.

Comment by mgruhler on 2018-03-02:
@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...

Comment by denisolt on 2018-03-02:
Thanks a ton! @mig everything works!

Comment by Delb on 2018-03-05:
@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 !


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.