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

Simulate kidnapped robot problem using amcl

asked 2021-05-10 05:37:08 -0500

Cropets gravatar image

Hi I am currently trying to similate the kidnapped robot problem in ROS using turtlebot3 and the ros amcl node. However whenever I move the robot using Gazebo, the particles redestribute according to some kind of distribution that I have not been able to find.

  • I let the robot spawn in the world
  • Drive it around to have the particles converge
  • Use gazebo to pick up the robot and place it in a different room. This message is published as gazebo/set_model_state
  • When this happends the particles are redistributed which I would like for them not to be. I want to visualise the problem of the kidnapped robot problem of having all particles converged in one location and moving it to a location where there are none.
  • By the particles redistributing this is not possible for me as of now.

Any help is appriacted on how to resolve this. I assume it has something to do with the adaptive sampling of amcl so that as the weight of the particles decreases it redistributes more. However I have tried to remove that to the best of my ability and have had no success. So if that is the problem I am more than happy to recieve tips on what to comment out more preciesly in amcl.

edit retag flag offensive close merge delete


Duplicate of #378041. Please close one of the two questions.

shonigmann gravatar image shonigmann  ( 2021-05-10 12:16:34 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-02-04 05:09:53 -0500

Phgo gravatar image

updated 2022-02-04 05:11:51 -0500

Hi, I recently encountered a similar problem with amcl and a gazebo simulation. I can not tell from your description if it is exactly the same problem or not, but it might be helpful anyway.

Similar to yours, after setting a new pose with gazebo/set_model_state or gazebo GUI, the position of the robot was immediately updated to the correct position. However, I noticed that the map->odom tf (from nav2_amcl) was not affected by this change at all and was completely taken over by odom->baselink tf (from gazebo plugin).

The turtlebot3 default gazebo configuration uses the plugin to publish odom transformations. However, this plugin has an odometrySourceparameter that allows it to use either the pose in the world or the encoder data from the simulated wheel motion as an odometry source, with "world" being the default. (see e.g.

Adding the following line to the differential drive controller plugin configuration in the gazebo urdf file of my robot description resulted in the desired behavior:

<!-- Odometry source, 0 for ENCODER, 1 for WORLD, defaults to WORLD -->
edit flag offensive delete link more

Question Tools


Asked: 2021-05-10 05:37:08 -0500

Seen: 271 times

Last updated: Feb 04 '22