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

Is it possible to use a pre-built map ?

asked 2015-01-08 05:23:52 -0600

Bacab gravatar image

updated 2015-01-12 04:04:30 -0600

Hi everyone,

I apologize in advance if my question is either inaccurate, stupid, or inappropriate.

Please consider me as a newbie in ROS related subject. I have quickly been through the navigation tutorial and if I correctly understand the logic behind the navigation stack it is possible for it to use an external map (static_map seems to be the correct name). Since my robot will evolve in a rather static environment I would like to provide it with a manually pre-built map of this environment. 1. Is it possible ?

  1. If it is indeed possible how can I do it ? (see below) Answered The specifications of the map file are here:

I thank you in advance for your answers and your advice.

EDIT 2: Link to the map we built with the corresponding yml file.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2015-01-12 03:02:38 -0600

forinkzan gravatar image

I think i can't really understand what are you mean , Do you want : (1) load a 2D pre-built map to ROS map server and use this map to test robot navigation package? or (2) Simulate a 3D environment and let robot use this simulator environment to build a map then using to navigation stack .

if the situation (1) : follow @Andromeda 's answer , and i think the "arbotix" simulator and "rbx1" package which you can find in will help you . (2) : can't find any tutorial already exist , but you can try to use gazebo_world_edit & ros_plugin , some tutorial link: ,hope it will useful ~

edit flag offensive delete link more


Thank you. Your first assumption is correct (ie:"(1) load a 2D pre-built map to ROS map server and use this map to test robot navigation package."). However it is not for tests, the final robot will use it for navigation.

Bacab gravatar image Bacab  ( 2015-01-12 03:36:56 -0600 )edit

I think may be you should use a launch file to load your map (.yaml & .pgm) to your ros map_server package then use it in navigation stack . but I am not sure , hope it can help you ~

forinkzan gravatar image forinkzan  ( 2015-01-12 19:08:38 -0600 )edit

answered 2015-01-10 16:18:49 -0600

Andromeda gravatar image

updated 2015-01-10 16:20:13 -0600

I'm not really sure, if I understood your question, but I share with you what I did, perhaps it helps. I've created a pgm file using Gimp


with a good pixel definition. And then I created a yaml file with the resolution, width, height, etc...


image: A1_map.pgm
resolution: 0.01
origin: [-10, -10, 0]
occupied_thresh: 0.65
free_thresh: 0.196 # Taken from the Willow Garage map in the turtlebot_navigation package
negate: 0
width:  20
height: 20

where for height and width you put the desired dimension expressed in meters. So opening the map with RViz one side of the map corresponds to 20 cells of RViz (if 1 cell has a dimension of 1 meter)

Both files are copied into the main folder of my package under


edit flag offensive delete link more


I've managed to do the same. I teleoperated my robot on a simulated Gazebo World to build a map of the environment using the GMapping package, and then saved it using the (map_saver tool) from the map_server package. The problem is to load that map to navigate on it

Sergio MP gravatar image Sergio MP  ( 2015-01-12 11:50:45 -0600 )edit

@Sergio MP It's a surprise for me to find your comment , as you say you can using gazebo environment to build a map ? you already done that ? I also want to do it , but don't know how to do - - | could you help me ? thank you very much ~

forinkzan gravatar image forinkzan  ( 2015-01-12 19:02:31 -0600 )edit

@forinkzan Sure. What I did was to create a .world file with the workspace where I want my robot to navigate. Then, make sure to include a Hokuyo 2D laserscan or Kinect in your robot's URDF with their respective Gazebo plugin included. Spawm your robot into the Gazebo world, configure and execute

Sergio MP gravatar image Sergio MP  ( 2015-01-13 10:28:19 -0600 )edit

the gmapping node to build the map, and drive it around using your keyboard with the node. Finally, if you want to save the map that gmapping just created, you can use the map_server. Cheers!

Sergio MP gravatar image Sergio MP  ( 2015-01-13 10:31:16 -0600 )edit

thanks very much ~ how can i drive the robot ? with a diff_drive plugin & set odom frame ? I don't know why i can't add plugin to my robot urdf file , it's always fail = =... , are there some tutorials?

forinkzan gravatar image forinkzan  ( 2015-01-13 19:07:55 -0600 )edit

Jum, I see. You should check the Husky description package for reference. Cheers!

Sergio MP gravatar image Sergio MP  ( 2015-01-14 05:50:02 -0600 )edit

@Sergio MP Finally i can build map in gazebo ~ , thank you very much , now i prepare to navigation in it ~

forinkzan gravatar image forinkzan  ( 2015-01-20 20:22:47 -0600 )edit

@Sergio MP Can you load map and navigation on it now ? in gazebo ?

forinkzan gravatar image forinkzan  ( 2015-01-28 01:32:24 -0600 )edit

answered 2015-01-11 12:59:23 -0600

Bacab gravatar image

updated 2015-01-12 01:03:49 -0600

Thank you for your answer.

Yes I have finally found the specifications of the yaml file.

According to your experience the navigation stack can work with a map not generated by sensors, am I correct ?

EDIT: I'm trying to explain my question

I'm only considering a 2D map that will be used by the robot for guidance purpose. I don't care about visualization or simulation. The documentation states that a map like that is built by the map server thanks to the data of the LIDAR to provide global route planing. I want to know if I can built this map while the robot is offline using the blueprints of the batiment the robot will have to navigate into.

If the answer is yes I can use a map like that then the only sensors I need are odometric wheels so the robot knows where it is on the map.

edit flag offensive delete link more


I'm not sure what you mean, can move for visualization's purposes your robot on a map with a overlapping grid. I mean....don't aspect to draw a 3D image with gimp and use it as a 3D map generated by the sensors. They are different things. Hope I understood you correctly.

Andromeda gravatar image Andromeda  ( 2015-01-11 13:16:29 -0600 )edit

Question Tools



Asked: 2015-01-08 05:23:52 -0600

Seen: 7,010 times

Last updated: Jan 12 '15