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

gmapping Map not updating correctly.

asked 2015-10-10 09:10:04 -0500

davidgitz gravatar image

updated 2015-10-10 09:11:37 -0500

Hi everybody. I am having an issue with gmapping. I have a simulated Rover that is publishing LaserScan messages and odometry data. Basically I am seeing that when I drive my Rover next to an obstacle in a straight line, the occuppied cells created by gmapping (seen in rviz) moves with the Rover. I have followed REP-103 and REP-105 and the "Seting up your robot using tf" as close as I can tell. Sorry for the long post.

For tf frames I have:

geometry_msgs::Quaternion base_quat = tf::createQuaternionMsgFromYaw(0.0);
geometry_msgs::TransformStamped base_trans;
base_trans.header.stamp = current_time;
base_trans.header.frame_id = "odom";
base_trans.child_frame_id = "base_link";
base_trans.transform.translation.x = current_Northing_m;
base_trans.transform.translation.y = current_Easting_m;
base_trans.transform.translation.z = -0.2794;
base_trans.transform.rotation = base_quat;

geometry_msgs::Quaternion scan_quat = tf::createQuaternionMsgFromYaw(0.0);
geometry_msgs::TransformStamped scan_trans;
scan_trans.header.stamp = ros::Time::now();
scan_trans.header.frame_id = "base_link";
scan_trans.child_frame_id = "laser";
scan_trans.transform.translation.x = 0.0;
scan_trans.transform.translation.y = 0.0;
scan_trans.transform.translation.z = 0.3556;
scan_trans.transform.rotation = scan_quat;

And my frame links: image description

As you can see I am not doing anything with rotation yet.

And here are some pictures of my Simulated Rover in my GUI, along with the output of Rviz When I start my program: image description image description

And now when the Rover is driven alongside the Obstacle: image description image description

And now when the Rover is driven well past the Obstacle: image description image description As you can see, the Map is shifting with the Rover.

And here is some output of the gmapping package:

Odom Pose Theta: 0.000000 MPose Theta: 0.430916
 Center x: -0.400000 y: -0.400000
 update frame 3624
 update ld=2.91054e-14 ad=0
 Laser Pose= 7.70492 -3 0
 m_count 108
 Average Scan Matching Score=499.238
 neff= 29.9807
 Registering Scans:Done

It is worth mentioning that in rviz, when I drive the Rover forwards, the Red axis on the tf frame is the one moving in the correct direction.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-10-13 19:05:37 -0500

davidgitz gravatar image

So the answer was to add: , link: which then creates a map that doesn't move with the Rover and is re-generated with new scan data. However for my application this won't work apparently. I am using Sonar sensors (not LIDAR) and the map it creates is just not very useful. I knew this would be an issue from the start but hoped otherwise. I will create my own occupancy grid generator. Thanks for your help!

edit flag offensive delete link more

answered 2015-10-10 16:19:39 -0500

It seems like your simulated LaserScan does not properly fill beyond max range scan points. This makes gmapping update the map with the max range LIDAR end points, essentially leading the system to believe the robot is inside a round room. This of course leads to all sorts of problems, as the general shape of the LIDAR scan does not change, even though the robot is moving. The LIDAR scan for the round obstacle in your GUI also doesn't look quite as expected.

edit flag offensive delete link more


@Stefan - Thanks for this! I found 2 bugs in my code, one that was not calculating when an obstacle was in view of the beam, and not setting the beam distance to -1 when no obstacle was present. After fixing this though I am still seeing the same problems, does my tf structure/numbers make sense?

davidgitz gravatar image davidgitz  ( 2015-10-13 06:37:13 -0500 )edit

Do you still see the circles added to maps by gmapping? Note that a largely empty scenario is pretty challenging too because it doesn't have many features from which to localize.

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2015-10-13 11:13:56 -0500 )edit

@Stefan - Yes I do. I added 2 more obtacles. When I drive the Rover forward the map moves along with the Rover. Honestly I don't really care about the transform from odom -> map, I only want the occupancy grid. Is there a way to just compute this with out the extra tf stuff?

davidgitz gravatar image davidgitz  ( 2015-10-13 18:25:35 -0500 )edit

Question Tools



Asked: 2015-10-10 09:10:04 -0500

Seen: 1,439 times

Last updated: Oct 13 '15