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

Custom CostMap Values

asked 2012-01-09 03:35:46 -0500

David Lu gravatar image

updated 2012-01-09 03:36:06 -0500

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 flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-01-09 04:51:21 -0500

DimitriProsser gravatar image

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.

edit flag offensive delete link more

answered 2012-02-08 08:39:14 -0500

David Lu gravatar image

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.

edit flag offensive delete link 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.

fmarques gravatar image fmarques  ( 2012-02-20 05:29:07 -0500 )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.

David Lu gravatar image David Lu  ( 2012-02-20 05:41:55 -0500 )edit

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

fmarques gravatar image fmarques  ( 2012-02-21 23:10:22 -0500 )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?

oswinium gravatar image oswinium  ( 2014-03-18 08:13:56 -0500 )edit

David Lu gravatar image David Lu  ( 2014-03-19 04:45:12 -0500 )edit

Question Tools



Asked: 2012-01-09 03:35:46 -0500

Seen: 2,800 times

Last updated: Feb 08 '12