Robotics StackExchange | Archived questions

Create Map from Rosbag

Hi I am having problem with creating map(.pgm and .yaml) files. First i tried to create a map using the existing bag file following this tutorial. I was successful to create map. Now I created a bag file following this tutorial. I created a bag file. But when I try to create a map using this newly created bag file I am getting the message

ras@ubuntu:~/bagfiles$ rosrun map_server map_saver -f ~/testmap
[ INFO] [1470969136.155361289]: Waiting for the map

Edit2:

I have kinect which gives PointCloud2 data over the topic /camera/depth/points . I want to convert is first to LaserScan type and then create the bag file.

The steps how i created bag files are given below :

  1. roscore
  2. roslaunch freenect_launch freenect.launch
  3. rosrun pointcloudtolaserscan pointcloudtolaserscan_node
  4. rosrun depthimagetolaserscan depthimagetolaserscan image:=/camera/depth/image_raw
  5. rostopic echo /scan --//and here I can see the converted data of LaserScan type. I am sure now it is publishing LaserScan data
  6. rosbag record -O subset /scan /tf --//Recording /scan and /tf data. it will create a subset.bag file

Now its time to Create the map from the logged data Steps are given below:

  1. rosparam set usesimtime true
  2. rosrun gmapping slamgmapping scan:=basescan /I have confusion on the base_scan as my data on /scan/
  3. rosbag play --clock ~/bagfiles/subset.bag //play the bag file
  4. rosrun mapserver mapsaver -f /home/ras/bagfiles/rastest_kinect

Here in the step 4, it just shows waitng for the map. But if I change the file name from step 3 which I downloaded from here, I get a map generated. The sample bag file which I generated is attached and the rqt graph is here

the comparision of the two bag files are as below:

the downloaded file --this is okay and successfully generates map

ras@ubuntu:~/mynectws$ rosbag info ~/bagfiles/downloaded.bag path: /home/ras/bagfiles/downloaded.bag version: 2.0 duration: 1:32s (92s) start: Jan 01 1970 01:00:34.60 (34.60) end: Jan 01 1970 01:02:06.80 (126.80) size: 8.2 MB messages: 3693 compression: none [11/11 chunks] types: sensormsgs/LaserScan [90c7ef2dc6895d81024acba2ac42f369] tf/tfMessage [94810edda583a504dfda3829e70d7eec] topics: /basescan 924 msgs : sensormsgs/LaserScan

/tf 2769 msgs : tf/tfMessage


My generated file -- for this one map_saver waits for the map

ras@ubuntu:~/mynectws$ rosbag info ~/bagfiles/subset.bag path: /home/ras/bagfiles/subset.bag version: 2.0 duration: 1:31s (91s) start: Aug 21 2016 18:30:19.07 (1471797019.07) end: Aug 21 2016 18:31:50.32 (1471797110.32) size: 7.7 MB messages: 6379 compression: none [11/11 chunks] types: sensormsgs/LaserScan [90c7ef2dc6895d81024acba2ac42f369] tf2msgs/TFMessage [94810edda583a504dfda3829e70d7eec] topics: /scan 2735 msgs : sensormsgs/LaserScan

/tf 3644 msgs : tf2_msgs/TFMessage (4 connections)

Can anyone please help me regarding this. Thanks.

EDIT1: As I am pretty new I did not checked first about recording topic and. Now I understand that it requires LaserScan type messages. I am using Robotino and I do not have Laser Scanner hardware. I can get data of PointCloud2 and Odeometry type. So i tried to use the pointcloudtoLaserScan convert which punlish data on /scan topic. So I tried again to generate bag files from the /scan topic which publishes LaserScan type msgs. but my problem is still not solved.

Asked by rasoo on 2016-08-11 21:49:26 UTC

Comments

Hi, Can you add more details about what topics you recorded? Also, any error from rosout when you run gmapping while playing the bag? Were you able to view the map from RVIZ?

Asked by DavidN on 2016-08-15 04:36:32 UTC

Thanks for your concern. I have updated the main question. Can you please suggest me now what can i DO? I tried rostopic echo /scan But it shows nothing.

Asked by rasoo on 2016-08-16 17:44:30 UTC

This is not enough information to answer your question. Please provide any error messages appearing, a screenshot of rosrun rqt_graph rqt_graph showing all topics, the configuration and launch files you use for mapping... In short: http://www.sscce.org/

Asked by mgruhler on 2016-08-17 01:31:42 UTC

Remember to record the /tf topic too. If you have tf set up probably, then you should be able to see the map.

Asked by DavidN on 2016-08-18 20:53:37 UTC

@DavidN, thanks fro your suggestion but unfortunately no luck for me. I edited the main question and attched the bag file. I recorded /scan and /tf. Can you please have a look.

Asked by rasoo on 2016-08-21 12:17:39 UTC

@mig I attached the link of the rqt_grah. I hope it can give you proper information.

Asked by rasoo on 2016-08-21 12:24:28 UTC

@DavidN: Somehow I am able to create a map file. I recorded /scan /tf /odom. Then using that map file and gmapping slam I am able to create a map. The kinect was set to the top of robotino. But the map is not as expected. The map file is attached.

Asked by rasoo on 2016-08-23 11:16:47 UTC

Rasoo, did you fix the 'waiting for map' issue, I have the exact same issue, not sure how to fix

Asked by sincole on 2018-01-09 11:48:37 UTC

Answers