ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to instruct a robot to cover the whole mapped 2D area?

asked 2015-02-26 10:53:27 -0600

sobot gravatar image

updated 2015-05-03 15:13:00 -0600

Hello experts,

I've been searching and trying to figure out how to implement a SLAM based coverage method using ROS on a Turtlebot, that in which the robot builds a map of its workplace and visits every unvisited area of the map (e.g. used floor cleaning applications). You can see what im trying to explain in the following video link:SLAM based cleaning video.

In theory, I know that I have to implement a mapping method (gmapping) to build the map and to Transform robot's Pose to /map and save them or assign a higher cost to the visited areas on the map.

  • I don't know how to instruct or set different dynamically changing goals in the path planner node(s) for the robot to go over unvisited areas in order to give me a complete coverage of the mapped area. (as you could see in the video)

Any ideas or pointing me to the correct direction would be highly appreciated. ps: i'm not a pro programmer but i know my way around it.


I figured out that one good way to achieve this goal is to use Spanning Tree Coverage (STC) Algorithm, for that one need to export FREE map cell coordinates and build the spanning tree that robot has to navigate through to cover the whole (Unoccupied) area. An explorer node can be used initially to build the map of the environment, but next step would be exporting the FREE Cell coordinates and Spanning Tree (or Greedy) algorithm on the cell coords. STC Paper - any help or guidance in those areas are highly appreciated.


edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2015-03-06 04:46:14 -0600

You could have a look at the frontier_exploration package.

edit flag offensive delete link more


Does the frontier_exploration package provide complete map coverage? I have implemented it and once the region within the set boundaries is explored, the robot stops. Is there any way of using this package to make the robot move to every cell in the set boundary?

gautam2410 gravatar image gautam2410  ( 2015-03-06 05:08:32 -0600 )edit

On the wiki page, I see the sentence "To run an unbounded exploration task, simply leave the boundary blank". I'm not sure how exactly should I do this? The same question is asked here

gautam2410 gravatar image gautam2410  ( 2015-03-06 05:09:39 -0600 )edit

Thanks Martin, I checked this package. what i'm working on is somewhat different. need to save the visited (x,y), autonomously set next goals which are not among the visited (x,y) list, and an obstacle hugging method to start with. - i'd appreciate it if u have any code snips that may help my cause.

sobot gravatar image sobot  ( 2015-03-10 09:40:15 -0600 )edit

hi @Martin Günther i tried frontier_exploration package. in its standard form ofc. to try exploration feature. i ran into some problem with the package. posted a question here which no one replied so far, any ideas? tnx

sobot gravatar image sobot  ( 2015-05-11 16:47:14 -0600 )edit

answered 2015-02-27 02:16:39 -0600

marguedas gravatar image

updated 2015-03-06 02:20:48 -0600

Hi, I did a sloppy version of that on a turtlebot2 a year ago but I don't think that I still have the code.
What I did is at each step I find the closest frontier point (free cell neighour to an unknown cell) (at least a meter away from the turtlebot) on the map and run an A* on it. And loop until either everything is covered or unreacheable.
There are more efficient ways to do it using entropy (e.g. http://www2.informatik.uni-freiburg.d... ).

NOTE: if you use only odometry and gmapping you're map will certainly be drifting over time so coming back to the base station might be more challenging that it seems (solved it by putting ar markers every ten meters to stabilize the map, but there must be more elegant way to do it).
Also don't forget to inflate your obstacles to avoid unwanted collisions. Otherwise your robot might spend a lot of time trying to explore uneachable areas.

This is just to get you started, I guess that many people will have more efficient/reliable solutions. Hope this helps,

edit flag offensive delete link more


Thanks! My problem is exactly "how to" find and set the unknown (unvisited) points and then how to mark those points as visited or covered so the robot avoid them or at least doesn't put the goal there again. btw, did you provide a static map for your scenario or built one on the fly...?

sobot gravatar image sobot  ( 2015-02-27 16:06:08 -0600 )edit

Hi, I built one on the fly.
I think that I used the occupancy grid published by gmapping. Inflate the obstacles. Then checked the values (white=free, black=occupied, gray=unknown). Found the closest unknown point and used an A* to find a path to this point, if unreachable, chose another unknown

marguedas gravatar image marguedas  ( 2015-02-28 20:47:12 -0600 )edit

Hi Sobot, I am trying to achieve something similar but with hector slam and ROS navigation stack. Were you successful in running it? Thanks!

gautam2410 gravatar image gautam2410  ( 2015-03-05 23:58:15 -0600 )edit

@gautam2410 not yet, i'm still working on it though but still no success, how did ur gig go so far? any partial results?

sobot gravatar image sobot  ( 2015-03-30 17:18:36 -0600 )edit

answered 2015-03-16 02:25:02 -0600

You can also take a look at the hector_exploration_planner. It has a "inner exploration" mode that will keep visiting places in the map even after the complete environment has been explored. See also here and here.

edit flag offensive delete link more


thank you, gonna try it

sobot gravatar image sobot  ( 2015-05-04 07:59:22 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2015-02-26 10:53:27 -0600

Seen: 3,921 times

Last updated: May 03 '15