Create Map from Rosbag

asked 2016-08-11 21:49:26 -0500

rasoo gravatar image

updated 2016-08-23 11:33:09 -0500

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 pointcloud_to_laserscan pointcloud_to_laserscan_node
  4. rosrun depthimage_to_laserscan depthimage_to_laserscan 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 use_sim_time true
  2. rosrun gmapping slam_gmapping scan:=base_scan /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 map_server map_saver -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:~/mynect_ws$ 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: sensor_msgs/LaserScan [90c7ef2dc6895d81024acba2ac42f369] tf/tfMessage [94810edda583a504dfda3829e70d7eec] topics: /base_scan 924 msgs : sensor_msgs/LaserScan

/tf 2769 msgs : tf/tfMessage


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

ras@ubuntu:~/mynect_ws$ 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: sensor_msgs/LaserScan [90c7ef2dc6895d81024acba2ac42f369] tf2_msgs/TFMessage [94810edda583a504dfda3829e70d7eec] topics: /scan 2735 msgs : sensor_msgs/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 ... (more)

edit retag flag offensive close merge delete

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?

DavidN gravatar image DavidN  ( 2016-08-15 04:36:32 -0500 )edit

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.

rasoo gravatar image rasoo  ( 2016-08-16 17:44:30 -0500 )edit

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/

mgruhler gravatar image mgruhler  ( 2016-08-17 01:31:42 -0500 )edit

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

DavidN gravatar image DavidN  ( 2016-08-18 20:53:37 -0500 )edit

@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.

rasoo gravatar image rasoo  ( 2016-08-21 12:17:39 -0500 )edit

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

rasoo gravatar image rasoo  ( 2016-08-21 12:24:28 -0500 )edit

@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.

rasoo gravatar image rasoo  ( 2016-08-23 11:16:47 -0500 )edit
1

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

sincole gravatar image sincole  ( 2018-01-09 10:48:37 -0500 )edit