Ask Your Question

Error in creating 2D global map of the Environment [closed]

asked 2013-10-26 19:21:26 -0600

RB gravatar image

updated 2013-11-13 18:00:51 -0600

Hi, I am going through the [slam_gmapping]( I can move my P3AT in the environment through keyboard. I try to follow the steps mentioned in the tutorial but unable to generate the map.

step:1 terminal:1 rosparam set use_sim_time true

step:2 terminal:2 rosrun gmapping slam_gmapping scan:=lms200 _odom frame:=odom

step:3 terminal:3 rosbag record -O mylaserdata.bag /lms200 /tf

INFO 1383223128.547387984: Subscribing to /lms200 INFO 1383223128.548429961: Subscribing to /tf INFO 1383223128.549742465: Recording to mylaserdata.bag.

WARN 1383223128.549933629: Less than 5GB of space free on disk with

After step 3 the mylaserdata.bag should be created.ATLAST BAG IS CREATED.

small success

step:4 terminal:4 rosbag play mylaserdata.bag

INFO 1383224702.381804366: Opening mylaserdata.bag

Waiting 0.2 seconds after advertising topics... done.

Hit space to toggle paused, or 's' to step. RUNNING Bag Time: 1383223567.472784 Duration: 438.600031 / 438.658882

command list

  1. Start-up roscore

  2. rosbag record -O mylaserdata.bag /lms200 /tf

INFO 1383223128.547387984: Subscribing to /lms200

INFO 1383223128.548429961: Subscribing to /tf

INFO 1383223128.549742465: Recording to mylaserdata.bag.

WARN 1383223128.549933629: Less than 5GB of space free on disk with

  1. Start-up USARSim on the windows pc environment started in usarsim

  2. Start-up the ROS interface, roslaunch usarsim_inf usarsim.launch(robot placed in environment)

5.Run the tele-op keyboard which should allow you to drive the robot around.:

$ rosrun teleop_twist_keyboard

6.$ rosrun gmapping slam_gmapping scan:=lms200 _odom_frame:=odom

  1. rosbag play mylaserdata.bag

successfully completed.

  1. rosrun map_server map_saver



image: map.pgm

resolution: 0.050000

origin: [-100.000000, -100.000000, 0.000000]

negate: 0

occupied_thresh: 0.65

free_thresh: 0.196

//////////END OF MAP.YAML///////////////////

  1. then I run

rosrun rviz rviz

image description

Now laser messages are properly published and the tf tree looks ok. But no transform from [/GrndTruth] to frame[/map] and no transform from [/base_GrndTruth to frame[/map].

Thanks in advance

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by RB
close date 2013-11-21 05:24:24


It seems that the problem is in opening bag file. First I would suggest you to just run rosbag play and see if its running...Look here for more details. Try rosbag -fix parameter and see if theat changes or solves ur problem

sai gravatar imagesai ( 2013-10-26 20:56:47 -0600 )edit

rosbag record -O mylaserdata.bag /lms200 /tf It should generate the mylaserdata.bag and after moving the robot related information must be included here. Am I right?

RB gravatar imageRB ( 2013-10-27 02:08:07 -0600 )edit

yes...still not solved?

sai gravatar imagesai ( 2013-10-27 07:11:14 -0600 )edit

mylaserdata.bag has not been generated. Whats's the problem I can't figure out.

RB gravatar imageRB ( 2013-10-27 18:43:46 -0600 )edit

rosbag record -a

sai gravatar imagesai ( 2013-10-27 18:45:50 -0600 )edit

It will record all topics, I think. Will it help in creating the map?

RB gravatar imageRB ( 2013-10-27 19:14:46 -0600 )edit

Yes, having all topics will be able to create map. you can map even without using the logged data, for that you must use the data from laser and wheel odom online.

sai gravatar imagesai ( 2013-10-27 19:51:29 -0600 )edit

Hello Sai, can you mention the procedure what should be done after rosbag record -a. As you have said map can be obtained using online how it is possible. I have not found out any tutorial.

RB gravatar imageRB ( 2013-10-27 22:02:08 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-11-21 05:23:25 -0600

RB gravatar image

Error lies in the USARSim simulator (Canvas.uc). Use UDK-2013-07 and USARSim-current, it will lead you to get the map of the environment.

edit flag offensive delete link more

answered 2013-11-11 14:25:38 -0600

cognitiveRobot gravatar image

Commands to build a map using slam_gmapping from logged bag $roscore

$rosparam set use_sim_time true

$rosrun tf static_transform_publisher 0 0 0 0 0 0 base_link laser 100

$rosbag play --clock <your-ros-bag.bag>

For slam_gmapping you need tf and laserScan. after above commands, open a new terminal then execute $rostopic list

then look whether tf and laserScan are being published. if you see /scan then run $rosrun gmapping slam_gmapping scan:=scan

if you see /base_scan then run $rosrun gmapping slam_gmapping scan:=base_scan

to see map in rviz run $rosrun rviz rviz

then add a map then put topic /map

to save a map run $rosrun map_server map_saver -f map1

it will save a map named map1.pgm in current directory.

Let me know whether it works or not.

edit flag offensive delete link more


/scan or /base_scan should be visible in rostopic list? I don't understand laser 100? I have lms200 mounted on P3AT. @cognitiveRobot thanks for you reply. You can look here. I have given details of the question with screenshot.

RB gravatar imageRB ( 2013-11-11 17:48:01 -0600 )edit

I also used sick lms200. And above methods work for me. You also can check ur logged bag by using rqt. $rqt then run plugin bag then open your bag. then you will be able what you have in your bag. you also can send me your bag at i can have a look.

cognitiveRobot gravatar imagecognitiveRobot ( 2013-11-11 20:45:19 -0600 )edit

I get an empty map, now. I will send my bag at your mail id @cognitiveRobot.

RB gravatar imageRB ( 2013-11-13 17:25:12 -0600 )edit

Brian, I checked ur bag which contains /lms200 and /tf. but slam_gammping subscribes to /scan ( type sensor_msgs/LaserScan) and /tf. u can check What you have to do now is record ur bag by $rosbag record -o mylaserdata.bag /scan /tf. let me know ur progess.

cognitiveRobot gravatar imagecognitiveRobot ( 2013-11-14 17:37:04 -0600 )edit

@cognitiveRobot after rosbag play, we should run map_server utility. Again one more thing my map size is almost 15.3 MB. Why we need to type static_transform_publisher? Thanks in advance.

RB gravatar imageRB ( 2013-11-14 17:37:15 -0600 )edit

rosrun gmapping slam_gmapping scan:=lms200 _odom_frame:=odom; in this command also we need to change lms200 to scan ? @cognitiveRobot

RB gravatar imageRB ( 2013-11-14 17:44:33 -0600 )edit

Yes. to save ur map u have to run map_server. I still don't know why static_transform_publisher. when i do without that i get warning as "Message from [/play_1384494508191805188] has a non-fully-qualified frame_id [laser]". I'm looking for that answer too. but it works as i answered above.

cognitiveRobot gravatar imagecognitiveRobot ( 2013-11-14 17:46:29 -0600 )edit

yes. that's right. new slam_gmapping command will be $rosrun gmapping slam_gmapping scan:=scan

cognitiveRobot gravatar imagecognitiveRobot ( 2013-11-14 17:52:42 -0600 )edit

Question Tools



Asked: 2013-10-26 19:21:26 -0600

Seen: 1,076 times

Last updated: Nov 21 '13