Rosanswers logo

Hi, I am quite new to gmapping and I am seeking some advice regarding the gmapping parameter. So, I did a gmapping and the result (the map) is not quite good enough. As you can see in the attachment, the map bends to the left where it supposes to be straight as the red line.

I teleop my turtlebot (waffle pi) to move forward (upward in the map) at 0.1 m/s. I did stop it and made it turn around several times. The room size is about 3 m wide and 35 m long. My gmapping parameter is as below.

 <!-- Gmapping -->
 <node pkg="gmapping" type="slam_gmapping" name="turtlebot3_slam_gmapping" output="screen">
    <param name="base_frame" value="$(arg set_base_frame)"/>
    <param name="odom_frame" value="$(arg set_odom_frame)"/>
    <param name="map_frame"  value="$(arg set_map_frame)"/>
    <param name="map_update_interval" value="2.0"/>
    <param name="maxUrange" value="3.0"/>
    <param name="sigma" value="0.05"/>
    <param name="kernelSize" value="1"/>
    <param name="lstep" value="0.05"/>
    <param name="astep" value="0.05"/>
    <param name="iterations" value="5"/>
    <param name="lsigma" value="0.075"/>
    <param name="ogain" value="3.0"/>
    <param name="lskip" value="0"/>
    <param name="minimumScore" value="50"/>
    <param name="srr" value="0.1"/>
    <param name="srt" value="0.2"/>
    <param name="str" value="0.1"/>
    <param name="stt" value="0.2"/>
    <param name="linearUpdate" value="1.0"/>
    <param name="angularUpdate" value="0.2"/>
    <param name="temporalUpdate" value="0.5"/>
    <param name="resampleThreshold" value="0.5"/>
    <param name="particles" value="100"/>
    <param name="xmin" value="-10.0"/>
    <param name="ymin" value="-10.0"/>
    <param name="xmax" value="10.0"/>
    <param name="ymax" value="10.0"/>
    <param name="delta" value="0.05"/>
    <param name="llsamplerange" value="0.01"/>
    <param name="llsamplestep" value="0.01"/>
    <param name="lasamplerange" value="0.005"/>
    <param name="lasamplestep" value="0.005"/>

I also checked the CPU usage, which is about 90% in total. So, I think map_update_interval is not a problem.

I know that the odometry isn't going to give the accurate pose or location, but can someone please tell me which parameter should I tune to get a better map? I read the ros programming book, but I still don't understand which parameters give the most impact on the result. I really appreciate some advice. Thanks!

Originally posted by rw1725 on ROS Answers with karma: 11 on 2020-07-05

Post score: 0


1 Answer 1


Rosanswers logo

I see no reason to assume it is a gmapping parameter issue. Have you checked the accuracy of your ODOM? My guess is that your robot doesn't go straight when you tell it to go straight and that tuning the ODOM can improve the accuracy.

Line the robot up at one end of hall and drive down the hall next to the wall until you get to end. See how many encoder counts each wheel has accumulated. You may also find that you need to tune counts while rotating as well. Especially if you rotated the same direction each time while you were mapping. A small error caused by each rotation could accumulate.


Originally posted by billy with karma: 1850 on 2020-07-06

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by rw1725 on 2020-07-07:
Hi billy! Thank you for your answer. Your guess is right, my robot doesn't move straight when I tell it to go straight. I read the link that you gave. The article just said the same thing as you said, nothing about how to tune the ODOM. Does changing the decay time of the laser scan can improve the ODOM? Can you tell me how can I tune my ODOM? Like which file should I look for.

Comment by billy on 2020-07-08:
Somewhere in your setup there is a file that converts encoder counts to meters and meters/second to encoder counts/second. It may be parameters in a YAML file dealing with ODOM, or maybe it's camouflaged is an equation and converts wheel rotations by wheel radius. I can't say for sure.

It looks like you need to tweak one or more of the parameters or equations to account for whatever is creating the robot to not go straight.

You can also check the physical robot for issues that may cause the wheels to have different diameters (tape or dirt on the wheels) or maybe the wheels aren't aligned and one tends to slide a bit and has worn down over time.

I have an outdoor robot and I can tune ODOM by manipulating air pressure in the tires to change tire diameter. I can also do it in SW if I decide I'm not interested in correcting tire pressure.

Maybe you have the batteries off to one side so it's unbalanced? Something dragging? 100 things can cause. Fix in HW or SW.


Your Answer

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