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

How is possible to modify manually occupancy grid cells on a map?

asked 2019-02-26 12:00:15 -0500

chbloca gravatar image

So the point is that during the mapping with a mobile robot I will get a set of coordinates during the process. I was wondering, how is possible to modify the values of the occupancy grid cells nearby such coordinates.

For instance, these coordinates would represent objects that I don't want them in the map but they have been detected and stored in the map during the gmapping process as obstacles. I am not sure how to approach, whether using a real-time processing or post-processing.

Is there any available tool that can achieve something similar?

edit retag flag offensive close merge delete

Comments

Can you be more specific about what you exaclty want to achieve please ? How will you use your modified occupancy grid ?

I will get a set of coordinates during the process

How will you get them ?

Delb gravatar image Delb  ( 2019-02-27 02:22:34 -0500 )edit

An object detector implementation with a depth camera will provide the coordinates of certain objects. See for instance find_object. So when the robot detects these certain objects while gmapping, I'd like to remove them from the map (e.g. a paper bin).

chbloca gravatar image chbloca  ( 2019-02-27 03:35:18 -0500 )edit

And by saying " remove them from the map" you mean clear the cell value at the pose of the object (i.e. from 100=obstacle to 0=free) to get a map with only the walls, do I understand your issue correctly ?

Delb gravatar image Delb  ( 2019-02-27 03:44:33 -0500 )edit

Indeed, that's what exactly what I wanted to express.

chbloca gravatar image chbloca  ( 2019-02-27 03:45:54 -0500 )edit

Alsoo one last precision please : how will this new occupancy grid be used ? During the gmapping process or you just want to build a map without objects inside (meaning that you wouldn't have to "reinject" your occupancy grid in the mapping process)

Delb gravatar image Delb  ( 2019-02-27 03:46:59 -0500 )edit

The idea would be to "remove" from the occupancy grid little areas around the markers during gmapping process if possible, that is to build a map without objects inside.

chbloca gravatar image chbloca  ( 2019-02-28 01:39:11 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-02-28 03:57:44 -0500

Delb gravatar image

What you want to achieve could be tricky. From my understanding of the pakage find_object (and correct me if I'm wrong, it's a key point), you will be able to get the position of some objects, it will be only one poisition but not the edges of this object. That means that you would know in the occupancy grid the area where you need to change the cells data, but not the exact pose of each cells.

With that in mind, you will have to find the edges of an object given its position.

First, you will need to get the occupancy grid from gmapping. To create your new map I would use two occupancy grid : one occupancy grid will be your objects free map, I'll call it cleared_map,and the other one would be used to create the previous one, I'll call it history_map.

Why two occupancy grids ?

The idea is to use the data from gmapping to create a new map. The data from the topic map is an array containing the value of each cells of your map. With gmapping the cells have three values :

  • -1 : UNKNOWN.
  • 0 : FREE.
  • 100 : OCCUPIED.

Your goal is to create a new map by replacing the values of the cells at the pose of an object from 100 to 0, that would remove the objects from the map. You need to have another occupancy grid to save the history of your objects that have been removed. This occupancy grid would have cells with intermediate values at the pose of the objects (I'll suggest 50 but anything different than 0, -1 or 100 would be fine). This occupancy grid will be constantly overwritten (meaning the value of each cells) by the occupancy grid from gmapping to always have the updated map, unless the cells have the value 50. By doing so you won't have to deal with the same object each time. Without history_map, you wouldn't know which cell needs to be overwritten or not and you would do the same calculations over and over.

Then you will have to remove the objects and you'll be able to create the cleared_map by changing every cells of histroy_map from the value 50 to 0.

Delete your objects

You now have your history_map, the goal is now to find which cells will be set at the value 50. You do have the pose of your objects. To work from a pose with an occupancy grid you first need to convert this pose to an index to get the corresponding cell.

Now here's the tricky part. You have to find all the cells corresponding to your object. You can assume that an object in map is always a group of cells at the value -1 and the edges at 100 (because gmapping can't see inside objects so the cells are always unknown). For a cylindric paper bin as you used this example the map data ... (more)

edit flag offensive delete link more

Comments

I do really find your answer very helpful indeed. I thought about the idea of creating an additional occupancy grid besides the map but I didn't think about having an auxiliar map in order to avoid redundant computations. I will research about the implementation of your approach, many thanks Delb.

chbloca gravatar image chbloca  ( 2019-02-28 06:37:03 -0500 )edit

Glad it helps. Can you also tell me what is the otput of find_object ? Is it just one pose for an object or all the edges of the objects ?

Delb gravatar image Delb  ( 2019-02-28 09:58:00 -0500 )edit

It returns the transformations of the detections, i.e., the pose. Regardless what package I use, the procedure will be the same. I can also use packages more sophisticated based on deep learning instead.

chbloca gravatar image chbloca  ( 2019-02-28 10:16:04 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-02-26 12:00:15 -0500

Seen: 2,580 times

Last updated: Feb 28 '19