title: How do I map a non-binary Occupancy Grid with several values to a cost map in ROS?
body: <p>I'm looking for a way to map a non-binary occupancy grid to a global cost map. The occupancy grid has the values -1 for undefined, 0 for non-collision and 1-100 for collision areas. There is a similar question here for which the given answer doesn't offer a concrete solution: </p>
  
  <p><a href="https://answers.ros.org/question/335530/what-range-of-costs-does-ros-navigation-support/" rel="nofollow noreferrer">https://answers.ros.org/question/335530/what-range-of-costs-does-ros-navigation-support/</a></p>
  
  <p>For a better overview:</p>
  
  <p>I'm using ROS Melodic.</p>
  
  <p>My occupancy grid looks like this:
  <a href="https://i.stack.imgur.com/3QEQO.png" rel="nofollow noreferrer">Image of Occupancy grid</a></p>
  
  <p>My global_costmap_params.yaml looks like this:</p>
  
  <pre><code>global_costmap:
  plugins: 
  - {name: static_layer, type: "costmap_2d::StaticLayer"}
  - {name: inflation_layer, type: "costmap_2d::InflationLayer"}
  global_frame: base_link
  map_topic: "prediction_occ_grid"
  update_frequency: 10.0
  publish_frequency: 10.0
  rolling_window: true
  always_send_full_costmap: true
  height: 26.9
  width: 36.4
  </code></pre>
  
  <p>Note that I'm a pure beginner in costmaps, so it might be that this doesn't make sense at all!</p>
  
  <p>Using the given global_costmap_params.yaml deliveres the following costmap: <a href="https://i.stack.imgur.com/MErnf.png" rel="nofollow noreferrer">Image of the resulting global costmap</a></p>
  
  <p>As you can see the costmap "ignores" the collision-areas and maps them in the same costs as the non-collision-path-area. Is there any way to modify the costmap_params in order for it to map the occupancy grid properly?</p>
  
  <p>Thanks in advance!</p>