Ask Your Question

is it possible to define custom costmap values ?

asked 2018-03-08 16:46:02 -0500

Developer gravatar image

updated 2018-03-08 16:47:01 -0500


I want to define custom value for for the costmap.

In costmap2D API there are 4 special values:

static const unsigned char NO_INFORMATION = 255;

static const unsigned char LETHAL_OBSTACLE = 254;

static const unsigned char INSCRIBED_INFLATED_OBSTACLE = 253;

static const unsigned char FREE_SPACE = 0;

How can i define my particular costmap value ?


edit retag flag offensive close merge delete


There's nothing stopping you from saying const unsigned char FOO=42 but I have the feeling you mean something deeper. What do you want that value to do?

David Lu gravatar image David Lu  ( 2018-03-09 08:03:44 -0500 )edit

yes you are right,case is deeper.I want to integrate/use that custom value in the global path planner. Global path planner should create ways on this new defined const unsigned char.The Question is: is it possible and which files should be manipulated?(except costvalues.p, costmap_2d_publisher.cpp )

Developer gravatar image Developer  ( 2018-03-09 13:44:02 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-09 15:01:29 -0500

David Lu gravatar image

You have to do two separate things:

  1. You have to get the value into the costmap (if it is not already in the costmap). You could start here
  2. You have to get the global planner to see the value and act differently because of it. That's a semi-complex operation, but I would look here to start.
edit flag offensive delete link more


Thank you for the valuable answer

Developer gravatar image Developer  ( 2018-03-10 06:33:04 -0500 )edit

please hit the checkmark to the left

David Lu gravatar image David Lu  ( 2018-03-10 09:51:19 -0500 )edit

Is there a way to do this to create "virtual preferred paths"?

curi_ROS gravatar image curi_ROS  ( 2019-03-19 10:00:01 -0500 )edit

Please open your own question with more context.

David Lu gravatar image David Lu  ( 2019-03-19 10:34:24 -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

1 follower


Asked: 2018-03-08 16:46:02 -0500

Seen: 98 times

Last updated: Mar 09 '18