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

How to edit a map programmatically?

asked 2020-04-29 06:50:00 -0500

DesperateCookie gravatar image


i am currently on Ubuntu, using ROS Melodic.
I work with a self built robot, that has a laser scanner.
With the gmapping package I create a map, that I save with the map_server package.
I get the mymap.pgm and the mymap.yaml file like expected.

How can I programatically edit the .pgm file to have borders? I want to take the path of the robot and use them to draw borders inside the file. Manually doing it with a photo editing program is not a solution (see background info).

Background: I need to develop a mowing robot for outside purposes. I am not indoors with walls, and all sides of the map can be expected open, as the fences might not be detectable (small metal wires or ropes). It is required to drive around the borders of the property once to save the boundaries of the area that is to be mowed. I want to use the path of that drive around and draw it as a line inside the map. But is that actually the smartest way to do it? After some research I haven't found any good solutions.

Thanks for the help.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-04-29 07:32:22 -0500

Procópio gravatar image

Create a scprit that, once you run it, will save the map and add borders using something like OpenCV.

edit flag offensive delete link more



Out solution now is like this 1. Log position inside a csv file 2. Calculate the correct pixel coordinates using the map.yaml information 3. Draw lines between the points using an pything image editing library

DesperateCookie gravatar image DesperateCookie  ( 2020-05-02 08:42:25 -0500 )edit

Hello! I am currently working on a project and I am facing kinda the same issue. I am trying to edit a map that I previously build using explore_lite + move_base and rtab_map packages so that I can add into it some virtual walls (no-go zones for the robot). Basically I am just trying to edit the map by drawing some lines into it given a set of coordinates, but I am having trouble in computing the correct pixel coordinates using the map.yaml information. Can you please give some information or hints related to how you did this specific thing? Thank you!

geoporus gravatar image geoporus  ( 2020-07-29 09:33:38 -0500 )edit

@geoporus, it is better to ask a new question regarding your specific issue.

Procópio gravatar image Procópio  ( 2020-08-19 05:51:43 -0500 )edit

@DesperateCookie I am working on the same problem. Is it possible for you to share your code? Thanks

darshb34 gravatar image darshb34  ( 2020-11-21 03:23:56 -0500 )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: 2020-04-29 06:50:00 -0500

Seen: 790 times

Last updated: Apr 29 '20