2

建图时去除动态障碍

 1 year ago
source link: https://charon-cheung.github.io/2022/09/23/%E6%BF%80%E5%85%89SLAM/Cartographer/%E6%BA%90%E7%A0%81%E8%A7%A3%E8%AF%BB/%E5%BB%BA%E5%9B%BE%E6%97%B6%E5%8E%BB%E9%99%A4%E5%8A%A8%E6%80%81%E9%9A%9C%E7%A2%8D%20(%E4%B8%80)/#%E8%BF%90%E8%A1%8C
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

建图时去除动态障碍 | 沉默杀手

cartographer的内容实在太庞大了,还有去除建图时动态障碍的模块。

cartographer在建图后比较每个栅格被击中和被路过的次数来判断动静态栅格
参数voxel_filter_and_remove_moving_objects和类OutlierRemovingPointsProcessor,可以用来配置Voxel过滤数据,并仅传递我们认为在非运动对象上的点。

追本溯源,发现这一机制只在cartographer_assets_writer中,顺序是 assets_writer_main.cc —— assets_writer.cc —— points_processor_pipeline_builder.cc中的RegisterBuiltInPointsProcessors —— OutlierRemovingPointsProcessor

其实很简单,有三个阶段,筛选出 hit > 0 的 voxel,计算经过这些voxel的 rays-cast 次数,可以按miss集合理解,然后比较rays和hits数目关系

// 第二阶段
// 如果栅格之前的 hit>0,那么就 ray 次数增加
if (voxels_.value(index).hits > 0)
{
++voxels_.mutable_value(index)->rays;
}

// 第三阶段
// 如果点的 rays > 3*hits 那么就认为是动态障碍物
if (!(voxel.rays < miss_per_hit_limit_ * voxel.hits))
{
to_remove.insert(i);
}

这个逻辑有点过于简单了,如果一个栅格被障碍占据,那么rays为0,全是hits,不是动态障碍。如果rays次数过多,就认为是假障碍,进行清除。

assets_writer_backup_2d.launch如下

<launch>
<arg name="config_file" default="assets_writer_backpack_2d.lua"/>
<node name="cartographer_assets_writer" pkg="cartographer_ros" required="true"
type="cartographer_assets_writer" args="
-configuration_directory $(find cartographer_ros)/configuration_files
-configuration_basename $(arg config_file)
-urdf_filename $(find cartographer_ros)/urdf/backpack_2d.urdf
-bag_filenames $(arg bag_filenames)
-pose_graph_filename $(arg pose_graph_filename)"
output="screen">
</node>
</launch>

参考:如何使用Cartographer生成的地图


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK