Robotics StackExchange | Archived questions

Simulate kidnapped robot problem using amcl

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.

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.

Asked by Cropets on 2021-05-10 05:37:08 UTC

Comments

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

Asked by shonigmann on 2021-05-10 12:16:34 UTC

Answers

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 libgazebo_ros_diff_drive.so plugin to publish odom transformations. However, this plugin has an odometrySource parameter 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. http://gazebosim.org/tutorials?tut=ros_gzplugins)

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 -->
<odometrySource>0</odometrySource>

Asked by Phgo on 2022-02-04 06:09:53 UTC

Comments