Robotics StackExchange | Archived questions

Localization drifting when slam_gmapping with RosAria and MobileSim

I'm working on a Pioneer LX robot and I'm currently trying to use slam_gmapping to create a map of an existing .map file by driving the robot around in the MobileSim simulator using the rosaria_client. However, I experience som weird errors when monitoring the map and laserscan in rviz. Initially, the map and the readings from the laserscan seem to overlap pretty well, but after driving around some obstacles and returning to the point I started the localization is totally off (see the images below). It seems to have lost some angular odometry after a while.

Images: MobileSim image and corresponding RVIZ image.

Are these tuning related issues? Since I use a simulator I assume that the sensors are tuned "perfectly". Any ideas of what's causing this?

edit: The error seems to occur if I rotate the robot a lot (>100 degrees ish) in one movement...

Some (maybe) relevant code:

gmapping.launch:

<launch>
  <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
    <remap from="scan" to="/RosAria/sim_S3Series_1_laserscan"/>
    <param name="odom_frame" value="odom"/>
    <param name="base_frame" value="base_link"/>
    <param name="map_frame" value="map"/>
    <param name="throttle_scans" value="1"/>
    <param name="maxUrange" value="5.0"/>
    <param name="maxRange" value="10.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="minimumScore" value="0.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.1"/>
    <param name="angularUpdate" value="0.05"/>
    <param name="temporalUpdate" value="-1.0"/>
    <param name="resampleThreshold" value="0.5"/>
    <param name="particles" value="10"/>
    <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.02"/>
    <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>

AMCL.launch:

<launch>
<node pkg="amcl" type="amcl" name="amcl" output="screen">
  <remap from="scan" to="/RosAria/sim_S3Series_1_laserscan" />

  <param name="odom_model_type" value="diff"/>
  <param name="odom_alpha5" value="0.1"/>
  <param name="transform_tolerance" value="0.2" />
  <param name="gui_publish_rate" value="10.0"/>
  <param name="laser_max_beams" value="30"/>
  <param name="min_particles" value="500"/>
  <param name="max_particles" value="5000"/>
  <param name="kld_err" value="0.05"/>
  <param name="kld_z" value="0.99"/>
  <param name="odom_alpha1" value="0.2"/>
  <param name="odom_alpha2" value="0.2"/>

  <param name="odom_alpha3" value="0.8"/>
  <param name="odom_alpha4" value="0.2"/>
  <param name="laser_z_hit" value="0.5"/>
  <param name="laser_z_short" value="0.05"/>
  <param name="laser_z_max" value="0.05"/>
  <param name="laser_z_rand" value="0.5"/>
  <param name="laser_sigma_hit" value="0.2"/>
  <param name="laser_lambda_short" value="0.1"/>
  <param name="laser_lambda_short" value="0.1"/>
  <param name="laser_model_type" value="likelihood_field"/>

  <!-- <param name="laser_model_type" value="beam"/> -->
  <param name="laser_likelihood_max_dist" value="2.0"/>
  <param name="update_min_d" value="0.2"/>
  <param name="update_min_a" value="0.5"/>
  <param name="odom_frame_id" value="odom"/>
  <param name="resample_interval" value="1"/>
  <param name="transform_tolerance" value="0.1"/>
  <param name="recovery_alpha_slow" value="0.0"/>
  <param name="recovery_alpha_fast" value="0.0"/>
</node>
</launch>

Asked by fendrbud on 2019-11-05 08:53:28 UTC

Comments

Answers

I've experienced this exact issue with a Pioneer 3dx in a real world environment. In my case the robot base's odometry was a bit off and I needed to adjust parameters in AMCL to improve localization.

For what you're describing, check out this ROS navigation tuning guide, specifically section "5.2 Parameters for measurement and motion models". There's also a Navigation tuning guide on the ROS wiki.

Make sure you have a good understanding of AMCL 's odometry model parameters. Also found this answer helpful.

Good luck!

Asked by cat_in_box on 2019-11-06 13:09:31 UTC

Comments

I will try your suggestions, however, I think it is weird how it localizes well for a given amount of time and then suddenly localizes wrong when rotating. I would assume that if the tuning is off, then the localization wouldn't work well up to the point where the error occurs?

Also, using amcl with gmapping is not necessarily required right? Since both gmapping and amcl provide localization. Is it even good to use two localization nodes?

Asked by fendrbud on 2019-11-07 07:55:47 UTC

Found a good question&answer thread here that might help: https://answers.ros.org/question/93986/combining-amcl-gmapping-odometry/

Also, you should not be running amcl and gmapping at the same time. Use amcl to localize; use gmapping to make a map.

Asked by cat_in_box on 2019-11-08 10:36:24 UTC