Ask Your Question
0

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:

<launch>
<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>

<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">
<rosparam>
odom_frame: odom
maxUrange: 5.4
maxRange: 5.4
base_frame: base_link
</rosparam>
<remap from="scan" to="base_scan" />
</node>
</launch>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

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

Comments

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

Delb gravatar imageDelb ( 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 imagemgruhler ( 2018-03-02 07:42:05 -0500 )edit

Thanks a ton! @mig everything works!

denisolt gravatar imagedenisolt ( 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 imageDelb ( 2018-03-05 01:38:33 -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

2 followers

Stats

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

Seen: 600 times

Last updated: Mar 02 '18