# Is it possible to use a pre-built map ?

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: http://wiki.ros.org/map_server

EDIT 2: Link to the map we built with the corresponding yml file. https://github.com/Bacab/SARGAS/blob/... https://github.com/Bacab/SARGAS/blob/...

edit retag close merge delete

Sort by » oldest newest most voted

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 http://wiki.ros.org 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: http://gazebosim.org/tutorials ,hope it will useful ~

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.

( 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 ~

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

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

A1_map.pgm

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

A1_map.yaml:

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

maps/

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

( 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 ~

( 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

( 2015-01-13 10:28:19 -0600 )edit

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

( 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?

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

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

( 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 ~

( 2015-01-20 20:22:47 -0600 )edit

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

( 2015-01-28 01:32:24 -0600 )edit

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.

more

I'm not sure what you mean, but...yes...you 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.

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