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

Localization issue using gmapping and odom data.

asked 2014-01-09 02:32:08 -0600

dneuhold gravatar image

updated 2014-01-28 17:18:59 -0600

ngrennan gravatar image

Hi all,

I do have a problem with my localization! I use gmapping to build a map and to determine the robots position. Apparently my map (base_frame: /map) and my costmap (base_frame: /odom) do not correlate. Unforeseeable jumps appear. As soon as new space is explored, the map is not really extended, but the robot is shifted to the opposite direction. After a while, the robots position is redetermined and the costmap is shifted back to its "real" position. This seems to be weird and mess up my map. Additionally my robots position is also not correct which is a problem for further processing!

image description

as you see in the screenshot ... mapping works fine and also the costmap was right. Then the robot rotates and as soon as new space (beneath the robot) is explored, the costmap makes a jump to the top!! Instead of expanding the underlying map, the costmap is shifted and the robots position is wrongly determined!! The real Position is close to the "/map" tf (same offset as robot to "/odom" tf).

Here is my tf tree:

image description

Accuracy of my odom data seem to bee right ...

image description


Here is a link to a video showing the problem. Hopefully this helps to understand the problem which appears. It can be seen that no /odom /map problems appear as long as the robot moves to the front or backwards, but immediately when it starts to rotate, the mapping gets screwed up and "/map" and "/odom" differ.

https://www.dropbox.com/s/v4y6i7s5l0jhy7r/mapping.mpeg

Here is my gmapping.launch file:

<launch> <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">

  <param name="base_frame" value="base_footprint"/>
  <param name="map_frame" value="map"/>
  <param name="odom_frame" value="odom"/>
  <param name="map_update_interval" value="0.1"/>
  <param name="maxUrange" value="4.0"/>
  <param name="maxRange" value="5.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="srr" value="0.01"/>
  <param name="srt" value="0.02"/>
  <param name="str" value="0.01"/>
  <param name="stt" value="0.02"/>
  <param name="linearUpdate" value="0.01"/>
  <param name="angularUpdate" value="0.01"/>
  <param name="temporalUpdate" value="0.1"/>
  <param name="resampleThreshold" value="0.5"/>
  <param name="particles" value="1"/>

  <param name="xmin" value="-5.0"/>
  <param name="ymin" value="-5.0"/>
  <param name="xmax" value="5.0"/>
  <param name="ymax" value="5.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"/>
</node>

</launch>

FYI, I do not face processing problems due to high update rates. I just want the map to be updated continuously. CPU load is at 60% when running all nodes.

Has anyone experienced some similar problems?

BR Daniel

edit retag flag offensive close merge delete

Comments

Is your laser scanner mounted in a somewhat unusual position? (Like facing backwards, seen from positive x of your base_link) What are your transforms from base_link to laser? Would it be possible to post your launch file(s) and maybe a small bag recording?

Ben_S gravatar image Ben_S  ( 2014-01-09 02:59:28 -0600 )edit

Thanks for your hint, but the laser scanner is mounted correctly. Which launch file do you mean ... if it is an tf issue, I did not change anything there. The more I turn the robot the more "/map" and "/odom" differ.

dneuhold gravatar image dneuhold  ( 2014-01-10 00:22:57 -0600 )edit
2

Some difference between "map" and "odom" is expected (this is what SLAM approaches are supposed to correct). If there is a large discrepancy, this could mean that SLAM/localization is failing, or odometry is bad (or not well calibrated). Have you checked the accuracy of the odometry you´re getting?

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2014-01-10 01:16:49 -0600 )edit

Thanks Stefan for you tip. Do you know another way how to get the accuracy of the odom data instead of having a look at the /odom topic (as I did in the picture above?). I do also think that my SLAM/localization is failing ... but I do not have any approach how to mitigate this.

dneuhold gravatar image dneuhold  ( 2014-01-10 01:32:28 -0600 )edit
1

Well it seems that my accuracy is quite ok. But even if there is a larger discrepancy, how to reconfigure the gyro on an turtlebot with kobuki base? So my suggestion is also that SLAM/ localization fails. Do you have any ideas how to configure it better?

dneuhold gravatar image dneuhold  ( 2014-01-12 19:49:07 -0600 )edit

Thanks for the additional informations. Would it be possible to post a similar video while having the fixed frame set to /odom?

Ben_S gravatar image Ben_S  ( 2014-01-14 00:21:32 -0600 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2014-01-19 21:24:48 -0600

dneuhold gravatar image

I found the reason for my localization error. Even if i increased my "particle" value to a number of 100, localization is still wrongly estimated. But if I decrease my resolution to 0.01 (e.g. 1 cm grid size), the localization works perfectly and the estimation error (occurs very rarely) is in the range of 2-4 cm.

So maybe that may help you ...

Here is my actual configuration:

<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
<param name="base_frame" value="base_footprint"/>
<param name="odom_frame" value="odom"/>
<param name="map_update_interval" value="0.5"/>
<param name="maxUrange" value="16.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="srr" value="0.01"/>
<param name="srt" value="0.02"/>
<param name="str" value="0.01"/>
<param name="stt" value="0.02"/>
<param name="linearUpdate" value="0.01"/>
<param name="angularUpdate" value="0.01"/>
<param name="temporalUpdate" value="-1.0"/>
<param name="resampleThreshold" value="0.5"/>
<param name="particles" value="10"/>

<param name="xmin" value="-4.0"/>
<param name="ymin" value="-4.0"/>
<param name="xmax" value="4.0"/>
<param name="ymax" value="4.0"/>

<param name="delta" value="0.01"/>
<param name="llsamplerange" value="0.01"/>
<param name="llsamplestep" value="0.01"/>
<param name="lasamplerange" value="0.005"/>
<param name="lasamplestep" value="0.005"/>
<remap from="scan" to="$(arg scan_topic)"/>
</node>

BR, Daniel

edit flag offensive delete link more
3

answered 2014-01-14 00:36:55 -0600

Ben_S gravatar image

updated 2014-01-14 02:25:37 -0600

You made some really large (and some even absurd) changes to some of the gmapping parameters, which may lead to the observed behaviour...

<param name="linearUpdate" value="0.01"/>
<param name="angularUpdate" value="0.01"/>
<param name="temporalUpdate" value="0.1"/>

These settings will force an update with almost every new scan and benefit the accumulation of even small errors in scan matching. This may be the main culprit and what makes your odometry mostly meaningless.

Try setting these parameters closer to the default like linear 0.2, angular 0.3 and especially temporal to something like 5-10 (or even -1 to turn it off completely).

<param name="particles" value="1"/>

Now regarding the "even absurd" part of your config. GMapping is a particle filter based SLAM approach. So it needs some particles with each representing one "guess" of the current position and traveled path. When setting particles to 1 you are in fact doing dead reckoning based on scan matching, odometry and even some (intentionally!) added noise. You should set particles to at least the default value of 30 or even better higher! (Whatever your CPU can support. We typically use between 50 and 80 particles.)

In general i would advise you to start of with the default GMapping config and change only those parameters you really need and even then not by a factor of over 30 to begin with...

edit flag offensive delete link more

Comments

Good points, never used gmapping so the weird values didn´t catch my eye ..The "1" particle count did, though :)

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2014-01-14 01:17:03 -0600 )edit

Well the reason for these "absurd" values is for the purpose of updating the map continuously. Particle values of 10 to 20 are rather ok but everything above slows the speed of map creation tremendously down. Which is not applicable for my application. Therefore I experimented with the parameters and figured out that there is absolutely no purpose for setting the particles value to a higher number. Localisation is performed wrong, also for a particle value of 100, update rates of 20 secs and temporalUpdate -1 (The rest is based on the default configuration for gmapping). Is it possible that some other topics mess the localisation up? Following is started: turtlebot_bringup minimal.launch and turtlebot_navigation gmapping.launch

dneuhold gravatar image dneuhold  ( 2014-01-14 23:56:38 -0600 )edit
2

answered 2014-01-13 03:44:47 -0600

From the video the fault definitely looks like a SLAM issue. It appears as soon as just a flat wall is visible in the simulated LIDAR scan (with no corner, which previously served to make the match non-ambiguous) the scanmatcher provides wrong matches. I thought this really shouldn´t happen, as gmapping should rely on odometry in cases like this. There appears to be no parameter that allows you to tell the system "trust odometry more" directly, as this probably is easier thought of than done. Editing your original question and providing the config you use for gmapping might help people to make an educated guess on what parameters you could tweak, however.

edit flag offensive delete link more

Comments

I agree with you. This is what I already thought of. So does anyone have experience on the field of SLAM? Because that would really help to get the system running stable. The actual configuration is posted in my question above (gmapping.launch file). I already thought of using gmapping without odometry data? Do you think this is worth to try?

dneuhold gravatar image dneuhold  ( 2014-01-13 22:57:59 -0600 )edit

Well it´s the odometry that would help with the problem (if gmapping would trust it more as opposed to following the wrong scanmatching), so it doesn´t appear to be a good idea to try to not use odometry. Can you increase the particle count? A particle count of 1 means there is just one pose and map estimate, which means this you´re not really using a particle filter.

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2014-01-14 00:44:47 -0600 )edit

Question Tools

4 followers

Stats

Asked: 2014-01-09 02:32:08 -0600

Seen: 9,212 times

Last updated: Jan 19 '14