Ask Your Question

gmapping overrides map

asked 2020-05-03 13:57:29 -0500

rexrayne92 gravatar image

updated 2020-05-04 00:17:10 -0500

Hey Guys, I need some help to create a map with gmapping. I use ROS Kinetic and a differential drive robot with a YDLidar X4. On the robot is a raspberry Pi 3 and a teensy for the motors. Gmapping is running on a laptop with ubuntu and also ROS kinetic. I used teleop to drive my robot and the results were shown in rviz and everytime i moved the robot just a bit, the map updates and I got a overlayed update to the previous map. So everything get really messy. I tried also to just slow down the robot, but that doesn´t seem to get better. Maybe it is something wrong with my tf-tree? The tree is map--> odom--> base_link--> laser_frame (I would provide the real tf-tree if I get enough points to upload files)

I have also a bag file, with scan and tf messages for debugging purpose. Maybe someone could tell me what is most likely the problem for that issue?

edit here the link to bagfile and tf frames "bagfile+tf"

kind regards Rex

edit retag flag offensive close merge delete


Your TF tree is correct, but that doesn't mean the transforms are all correct.

I guess you have a PC you can use to run RVIZ or you wouldn't be able to describe what you did, so tell us how it looks in RVIZ. If you view the laser scan in RVIZ using ODOM as the frame for RVIZ, the laser scan should stay mostly stationary as the robot moves (it will dither a bit). See if it does.

If you have a transform setup incorrectly, you should be able to tell by watching RVIZ closely. In one case it took me several minutes to realize the laser scanner had left and right mixed up. The transform had it inverted along either X or Y.

billy gravatar image billy  ( 2020-05-03 14:47:16 -0500 )edit

Thank you for your quick answer. I did what you suggested. I replayed the bag file and set global fixed frame to odom and also axis to odom (to see that the robot is moving). The axis stay in place and the point cloud of the Lidar is moving according to the inputs I gave to the robot. (Hopefully this is understandable) But sometimes it seems the robot is "behind" a wall just through rotating. So this doesn´t make sense at all. I guess you are write with an inverted axe. Could you please tell me how do I fix this ? Also if I used base_link as fixed frame the robot seems to move right. No Jumps through walls or something similiar.

rexrayne92 gravatar image rexrayne92  ( 2020-05-03 15:43:40 -0500 )edit

I upvoted your question. you should be able to now post a screen shot if needed.

I guess if one of your transforms was messed up it may appear in RVIZ that the robot passes through a wall when rotating. It may also be that the node that publishes ODOM has an issue and is rotating the robot about X or Y in the orientation part of pose..

billy gravatar image billy  ( 2020-05-03 18:33:08 -0500 )edit

thank you for your upvote. I figured out that my robot turn left/right were reversed so I changed it, but even that don´t made an difference. The builded map is still messy. It is really fascinating.

rexrayne92 gravatar image rexrayne92  ( 2020-05-04 09:01:13 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-05-23 10:35:45 -0500

rexrayne92 gravatar image

I finally figured out why gmapping overrides the map! It wasn´t a problem of the odometry. I mounted the lidar wrong on the robot. I didn´t care about the lidar coordinate system. So I figured out in rviz when i rotate my robot to the left, the lidar-data rotate to the right. And this messed everything up. After I mounted the Lidar right -the spinning motor has to face to the back side of the robot- everything works fine.

edit flag offensive delete link more


That's the same as saying the transform from laser to baselink was incorrect. It could have been corrected with the proper transform instead of changing how the laser was mounted.

billy gravatar image billy  ( 2020-05-23 16:31:55 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-05-03 13:57:29 -0500

Seen: 28 times

Last updated: May 23