0
$\begingroup$

Rosanswers logo

Hello, I wan to customize my global costmap cost to control the path range of global planner,

I try to draw some pictures to descripte my question clearly as follows:

< pic 1. > The original global costmap with StaticLayer, ObstacleLayer(by laser scaner) and InflationLayer: image description

< pic 2. > The normal global path by global planner (global_planner/GlobalPlanner , dijkstra algo.): image description

< pic 3. > Customize the cost of global costmap, both of yellow and white field are FREE SPACE, but the cost of yellow is higher than white (the white field has the lowest valid cost): image description

< pic 4. > after adjust the cost of global costmap, one example path which generated by the global planner: image description

I already read the similar question before: Custom CostMap Values

But I don't need to change the cost dynamic, just one time when load the static global map.

  • in short

I need to let the global planner know:

##The white field is the best choice, but the yellow is still good.##

when planning a global path.

P.S. I also tried to edit the .pgm map file by GIMP, keep the white field color to 0xFEFEFE, and set yellow field color to 0xEEEEEE, but the behaviour of global planner was not changed.

From I know, the initialize of global map static layer convert the map value to only three types:

  • FREE_SPACE
  • LETHAL_OBSTACLE
  • NO_INFORMATION

If you can not understand my question because my poor English, I will explain it as clearly as I can.

Thanks for your help.


Originally posted by timo1219520 on ROS Answers with karma: 3 on 2018-03-19

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The best way to do this is to edit the static map, which you tried, but can be tricky.

Using your altered image file, change the map.yaml to add mode: scale and make sure your occupied threshold is above 0.93 (0xEE / 0xFF). This should make it so that the map topic reflects your new map.

To get this properly read by the global planner, make sure that your static layer has trinary_costmap set to false. Documentation

(Your question made me realize the documentation was out of sync for the map_server, but I've updated it since.)


Originally posted by David Lu with karma: 10932 on 2018-03-19

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by timo1219520 on 2018-03-22:
Dear David, forgive me for replying so late cause I think I need to to study as detail as possible. After referring to your answer and the source code, I achieved my goal successfully ,whether it the mode in RAW or SCALE. I have in depth comprehension about it right now, thank you very very much!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.