gmapping that seems to look great in Rviz but then the exported map is all blank

750 views
Skip to first unread message

Mark Johnston

unread,
Mar 22, 2017, 3:03:11 AM3/22/17
to HomeBrew Robotics Club
Have shifted gears from use of hector slam and this discussion is for ROS Kinetic so it is 'common ground'.

This is standard stuff below so I hope somebody will offer up a clue.  I thank anyone in advance for tips here.  Really hit a wall so had to ask the board.  Thanks.

Am able to run my bot with lidar and  then run rosrun gmapping slam_gmapping scan:=scan.   
Then run rviz and the bot, the laserscan and even the map shows up because this bot can see all walls in just one place.
I start with a map file that is all grey and have tried all white as well and sure enough Rviz when running gmapping does show me the map that I  'think'  I want saved to a file later.

I don't move the bot at all so odom remains completed fixed and never changing.

Then while gmapping is running I use   rosrun map_server map_saver -f robo-mag-ils    and it appears to be very 'happy' and generates a pgm and yaml map file.


This all seems really nice but then when I open the pgm file it is totally blank yet Rviz is really nicely showing /map as an area that is grey right under my lidar scan boundaries.
The grey area is not fully surrounded with black as a few areas just end in gray but end right where the lidar is showing.

The   rosrun tf view_frames   offers up a picture where top to bottom I see  map  -> odom  ->  base_link -> laser

So my question is perhaps self answered but I ask anyway because it all looks very nice in Rviz the code has made a map visually, I just cannot save it.
I run rviz on a VM also on Kinetic that has worked very well for me so far visually and the  bot is on same linux,  ubuntu mate 16.04

So it looks really nice BUT some of the darn  tf errors for timestamps show up so here is a diagnostic   'rosrun tf tf_monitor'
RESULTS: for all Frames

Frames:
Frame: /laser published by unknown_publisher Average Delay: -0.0191184 Max Delay: 0
Frame: /odom published by unknown_publisher Average Delay: -0.0191513 Max Delay: 0
Frame: /sensor_axis published by unknown_publisher Average Delay: -0.0190958 Max Delay: 0
Frame: base_link published by unknown_publisher Average Delay: 0.00096508 Max Delay: 0.00184041
Frame: odom published by unknown_publisher Average Delay: -0.0493939 Max Delay: 0

And 'finally' here is what gmapping shows with a key 'clue' I think of the TF_OLD_DATA  yet the dang map shows really nicely in Rviz

Since I don't know how this is 'supposed' to look maybe it is obvious to others.   If it is the timestamp thing I have no idea how to 'loosen up' the window because the times above don't strike me as insane, just non zero yet the message comes out.

 rosrun gmapping slam_gmapping scan:=scan
Warning: TF_OLD_DATA ignoring data from the past for frame base_link at time 1.49016e+09 according to authority unknown_publisher
Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
         at line 260 in /tmp/binarydeb/ros-kinetic-tf2-0.5.13/src/buffer_core.cpp
Warning: TF_OLD_DATA ignoring data from the past for frame sensor_axis at time 1.49016e+09 according to authority unknown_publisher
Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
         at line 260 in /tmp/binarydeb/ros-kinetic-tf2-0.5.13/src/buffer_core.cpp
[ INFO] [1490157882.056171892]: Laser is mounted upwards.
 -maxUrange 4.99 -maxUrange 4.99 -sigma     0.05 -kernelSize 1 -lstep 0.05 -lobsGain 3 -astep 0.05
 -srr 0.1 -srt 0.2 -str 0.1 -stt 0.2
 -linearUpdate 1 -angularUpdate 0.5 -resampleThreshold 0.5
 -xmin -100 -xmax 100 -ymin -100 -ymax 100 -delta 0.05 -particles 30
[ INFO] [1490157882.142816158]: Initialization complete
update frame 0
update ld=0 ad=0
Laser Pose= -0.03 0 -3.14159
m_count 0
Registering First Scan


ANOTHER QUESTION:  Is it a clearly 'bad' sign that gmapping stops right here after above line?   Maybe it is?

I'm about ready to fire up my neato stuff and try to see what working map looks like on gmapping screen and I have not noted that level of detail on one of Camp's  20000 demos ...  (we love the demos Camp)

Camp Peavy

unread,
Mar 22, 2017, 4:00:46 PM3/22/17
to hbrob...@googlegroups.com
Are you sure you're opening the file you saved? What are you using to view it? Maybe it's just real small and hiding somewhere.
 
Thanks,
Camp


From: Mark Johnston <mjst...@gmail.com>
To: HomeBrew Robotics Club <hbrob...@googlegroups.com>
Sent: Wednesday, March 22, 2017 12:12 AM
Subject: [HBRobotics] gmapping that seems to look great in Rviz but then the exported map is all blank

--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at https://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/d/optout.


Mark Johnston

unread,
Mar 22, 2017, 5:00:50 PM3/22/17
to HomeBrew Robotics Club
My main question was I think if I had to move the bot and get gmapping to get PAST the 'Registering first scan' message for it to work.  I doubt if anybody does what I am doing now.
I have my bot sitting on a table so it's hard to get it to move around to do more while gmapping is active.

I found a link that discusses getting 'stuck' on the Registering first scan   message and it is as simple as I guess I have to move my bot afterall and will report back if that too does not lead to a map.

yes I am sure I am looking at the correct  pbm file as timestamp agrees with when I saved it.
I know what you mean about it may be really tiny as an example one I had from neato github had tiny actual non-gray map.   
I'm also leary that maybe the map is in an area that is NOT where my odom and other tf are saying so maybe the map of interest is OUTSIDE of what I asked mapper to plot to a pgm.

The yaml file first had said -100 to 100 (i think these are limits in meters) and the plot was 4000x4000 pixels.   I have since setup the starting map (blank) as much smaller and set the yaml to about 3 meters but still blank map.

No reply here required unless you see and know of something that is known to you.    I will try Alan and Camps thoughts and I will get this bot to move around while gmapping as that is almost #1 on my list of possible reasons no map goes to disk even though I see a very believable map on /map that clearly gmapping made because I fed it in an empty map to start with (I think).

Thanks,
Mark

Brain Higgins

unread,
Mar 22, 2017, 7:19:06 PM3/22/17
to hbrob...@googlegroups.com
Camp are you receiving my emails?

Sent from my iPhone 10

Curt Meyers

unread,
Mar 26, 2017, 3:00:35 PM3/26/17
to HomeBrew Robotics Club
When you start driving the robot around, gmapping will start building a map. It can't really do anything if you don't move the bot around.

Once you like what you see in rviz you save the map using the map server command, "rosrun map_server map_saver -f map_name", that is documented on the ROS wiki.

You can not start with a map when using gmapper or any other mapper as far as I know. The map will only update every few seconds as you move around, his depends on the settings that you have set in the ros parameters.


On Wednesday, March 22, 2017 at 12:03:11 AM UTC-7, Mark Johnston wrote:

Mark Johnston

unread,
Mar 26, 2017, 4:38:29 PM3/26/17
to HomeBrew Robotics Club

Thanks Curt,
I started to do driving as well and see progress from gmapper, but map is always blank.

So you say 'can not start with a map'  this then makes me think I have to NOT start the map server when doing gmapping and that may be my biggest fault.  I start map service and give it a dummy blank map.   I was thinking gmapping  gathered its own map then the map_server map_saver saved the newly created one in gmapping memory.

I only ran without moving because I put bot on table in workshop and full map showed on RViz so I felt I could save that as it was looking good like that even without movement (bot stayed at 0,0,0)

Assumptions kill ya.     I'll run without map server running and then there will be no need for the dummy map.   Perhaps what is happening is I tell map server the map_saver thing and it saves right back out the dummy map untouched by gmapping.   I'll have to sort out in my gray matter why gmapping generates a map but map_server saves it.  I will also have to figure out if I can run my bot without map server serving a map because since that was an earlier issue is why I decided 'maybe I should serve up a dummy map from map server while gmapping does it's thing'.   Need to learn more on the mechanics which is the point of all this anyway.  Don't like following blind menu, very little learning in that.

Thanks,
Mark

Ralph Gnauck

unread,
Mar 26, 2017, 8:35:54 PM3/26/17
to hbrob...@googlegroups.com
Mark,
There are typically two ways we are running ROS,
1) Mapping Mode:  You start with no map - use gmaping (or other mapping packages) to create the map by teleoping the robot, then save the map to a file when you are finished.
2) Navigation Mode: You start with a previously saved map and use the navigation packages (usual amcl and move-base) to have the robot drive itself to locations within the existing map.

In 1) you do not start the map_server node at the beginning, just start the base driver and gmapping nodes, you must move the robot for any map to be created, it will not generate the map if it is standing still.
After you have a map you are satisfied with you can save the current map to a file by running the map server from a command below - while gmapping etc is still running!  the command is as Curt notes:

rosrun map_server map_saver -f map_name

Then shutdown all the nodes and now you can restart in nav mode using the map you just created.

In 2 Nav mode,  start your base and then amcl, move_base and this time also map_server to publish the saved map

put this in a launch file:

<!-- Run the map server -->
  <node name="map_server" pkg="map_server" type="map_server" args="$(find <your bot package>)/maps/map.yaml"/>

assuming you saved the map to the maps folder of the package <your bot package>


NOTE: in the first command used to save the map the command is:

rosrun map_server map_saver -f map_name


in the second command you are running 
  <node name="map_server" pkg="map_server" type="map_server" args="$(find <your bot package>)/maps/map.yaml"/>


Two different commands, map_saver and map_server - both from the map_server package but used at different times.

Ralph




From: Mark Johnston <mjst...@gmail.com>
To: HomeBrew Robotics Club <hbrob...@googlegroups.com>
Sent: Sunday, March 26, 2017 1:38 PM
Subject: [HBRobotics] Re: gmapping that seems to look great in Rviz but then the exported map is all blank

Mark Johnston

unread,
Mar 26, 2017, 10:21:50 PM3/26/17
to HomeBrew Robotics Club
Thanks for confirmation Ralph.  I had done all this stuff with other systems like the neato node environment and also some messing with Ubiquity things but never put together my own system on my own bot and tried to do these things.

I'm aware of the two modes and the saver command and the starting of map server in non gmapping mode.

My folly was in starting map server while gmapping.  I suspect it seems obvious to you but due to not knowing if it was needed and I could convince myself that maybe it just had to be running and would know gmapping was active from it's topics and just 'do the right thing'.   Not knowing the mechanics I was naively thinking perhaps gmapping fed the active map server and map server sort of renewed it's map in that case.    Lots of moving parts so sometimes you have to sort of take your best shot.  In my case, it was to my foot.  OUCH.   Lol!

So what is going on is not as smart is what I am wrongly assuming and it is all now understood why it did what i saw.

So thanks for that key point on no map server and you must move the bot.  My map looked really nice just sitting in one place with well controlled fixed solid walls around it so that led me to think the mapping had happened.  Seems obvious but not if you have no real clue what is going on with the nodes and topics while doing gmapping.

 I saw a really nice and apparently full map in RViz when I knew the map I had started mapserver (in error) was empty I figured gmapping had done it's thing and just save it.   

Anyway, it is involved enough that an assumption does not cut the cake in the land of ROS.  Yes I do know the old expression but it only made the donkey out of me so no loss.   LOL


Thanks gents, all is well ... for now

Mark

Camp Peavy

unread,
Mar 27, 2017, 1:18:06 AM3/27/17
to hbrob...@googlegroups.com
So let me understand... you ran "map_saver" before creating the map?
 
- Camp


From: Mark Johnston <mjst...@gmail.com>
To: HomeBrew Robotics Club <hbrob...@googlegroups.com>
Sent: Sunday, March 26, 2017 7:21 PM

Subject: [HBRobotics] Re: gmapping that seems to look great in Rviz but then the exported map is all blank

Mark Johnston

unread,
Mar 27, 2017, 1:31:59 AM3/27/17
to HomeBrew Robotics Club
No Camp.   I ran map_server with a blank map while I was running gmapping and my bot as I thought it had to be there to sort of 'soak up' the map being created by gmapping.

The whole process was 'close but no cigar'.   I feel the issue will be resolved if I do not run map_server while gmapping.  My error was thinking map_server had to be going to do something for gmapping but that is not the case.

I had hit some error that made it sound like I had to run map_server early on and it seemed 'sort of part-way logical' that maybe it had to run so I ran it while gmapping.

Doing this the later   incantation to use  map_saver line ended up generating a new map that was the same map I had told the map_server to run as I was gmapping.

It ain't no 'toaster' is all and I made bad assumptions even after reading assorted docs so missed this sort of important point.
Reply all
Reply to author
Forward
0 new messages