ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# Custom CostMap Values

I'd like to add values to the costmap used by move_base (and the PR2). However I don't want to add obstacles from sensor data. Instead, I'd like to just be able to arbitrarily raise the cost of going through particular locations. For instance, our lab has a kitchen, and we'd rather the robots don't go into that area unless they absolutely have to. Seems like you could do that by making the value of the costmap in that area less than 127 (as per the costmap documentation).

It seems like there might be three approaches to this problem.

1. Formulate the restrictions as artificial sensor data. Seems tricky and hacky.
2. Dynamically edit the global map.
3. Enhance move_base to subscribe to some additional information source.

It seems like 3 is the most straightforward solution, but I'm wondering if there's a better way.

tl;dr; How do I add "I'd really rather you didn't go there" areas to the costmap?

edit retag close merge delete

Sort by » oldest newest most voted

I'd say that if you just wanted to avoid that area completely, you could simply mark those areas as obstacles in a static map and load that map into the global map using map_server.

If you want to preserve the ability to traverse it, the above are the best options in my opinion.

I'll add a fourth option, just in case:

Carry two static maps loaded from image files. One with the areas in question marked as obstacles, and one with them as free. Then, you can use actionlib to watch for a path-planning failure due to no route. If this error is received, you could then load the emptier map and retry. This is also a fairly hacky solution, but it eliminates the need for marking the areas as obstacles dynamically.

more

What I actually ended up doing was what I listed as option 1, which was easier than expected. I created a PointCloud designating where I didn't want the robot to go. Then I fed that in as one of the observation sources.

I had initially tried to send the PointCloud with the frame_id /map but move_base didn't like that, so I transformed it to /base_laser_link instead.

I'm still interested if anyone has hacked up option 3 so that you don't have to mark things as obstacles necessarily, but just increase the cost a little bit.

more

I'm also interested in adding custom values to the costmap, so I can raise the cost of a certain cells. My idea is to add a pointcloud as an observation source with the intensity off a given point as the cost to be added to the costmap.

( 2012-02-20 05:29:07 -0600 )edit

What application are you considering? I'm currently developing a patch to costmap that can take in cost map adjustments and trying to decide what sort of values you might want to feed in.

( 2012-02-20 05:41:55 -0600 )edit

I'm trying to make a generic way to fuse multiple sensors, so that some of then increase cost and some decrease cost.

( 2012-02-21 23:10:22 -0600 )edit

David, are there any tutorials or step-by-step guides for how to actually go about doing this i.e. manually creating a PointCloud; positioning it in a certain location in a costmap; and feeding it in as an observation source?

( 2014-03-18 08:13:56 -0600 )edit
1

http://wiki.ros.org/costmap_2d/Tutorials/Configuring%20Layered%20Costmaps

( 2014-03-19 04:45:12 -0600 )edit