如何将具有多个值的非二进制占用网格映射到 ROS 中的成本图? [英] How do I map a non-binary Occupancy Grid with several values to a cost map in ROS?
问题描述
我正在寻找一种将非二元占用网格映射到全局成本图的方法.占用网格的值为 -1 表示未定义,0 表示非碰撞,1-100 表示碰撞区域.这里有一个类似的问题,给出的答案没有提供具体的解决方案:
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:
https://answer.ros.org/question/335530/what-range-of-costs-does-ros-navigation-support/
为了更好的概览:
我使用的是 ROS Melodic.
I'm using ROS Melodic.
我的占用网格如下所示:占用网格图像
My occupancy grid looks like this: Image of Occupancy grid
我的 global_costmap_params.yaml 如下所示:
My global_costmap_params.yaml looks like this:
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
请注意,我是成本地图的纯粹初学者,所以这可能根本没有意义!
Note that I'm a pure beginner in costmaps, so it might be that this doesn't make sense at all!
使用给定的 global_costmap_params.yaml 提供以下成本图:生成的全局成本图的图像一个>
Using the given global_costmap_params.yaml deliveres the following costmap: Image of the resulting global costmap
如您所见,成本图忽略"了碰撞区域,并以与非碰撞路径区域相同的成本映射它们.有什么办法可以修改costmap_params,让它正确映射占用网格吗?
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?
提前致谢!
推荐答案
发现插件不知何故无法从 global_costmap_params.yaml 中读取给定的参数(有关原因可能是什么或如何解决这个问题的任何想法?).
Turned out the plugin somehow isn't able to read the given params from the global_costmap_params.yaml (any ideas about what the reason could be or how to fix that?).
我通过将导航存储库克隆到我的 catkin_ws/src 文件夹(而不是通过 sudo apt-get install ros-melodic-navigation 安装导航)解决了这个问题,并更改默认值将 costmap_2d/plugins/static_layer.cpp 中的 trinary_costmap-param 改为 'false'.
I solved the issue by cloning the navigation-repo into my catkin_ws/src folder (instead of installing navigation via sudo apt-get install ros-melodic-navigation) and change the default-value for the trinary_costmap-param inside costmap_2d/plugins/static_layer.cpp to 'false'.
现在可以正确映射占用网格的所有中间值.
It's now able to map all intermediate values of the occupancy grid correctly.
我发现这是由于命名空间问题.由于 trinary_costmap 是 static_layer-plugin 的插件内部参数,看来必须明确指定命名空间.
I figured out that this is due to a namespace issue. Since the trinary_costmap is a plugin-internal parameter for the static_layer-plugin, it appears that the namespace must be specified explicitly.
因此,像这样在 global_costmap_params.yaml 中设置参数:
Therefore, setting the param in global_costmap_params.yaml like this works:
/move_base/global_costmap/static_layer/trinary_costmap:假
这篇关于如何将具有多个值的非二进制占用网格映射到 ROS 中的成本图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!