BLAM(Berkeley Localization And Mapping)安装使用教程

简介:

LiDAR-based real-time 3D localization and mapping

github:https://github.com/erik-nelson/blam.git

官方视频:https://youtu.be/08GTGfNneCI

一、安装依赖包

1、安装ROS

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
source /opt/ros/kinetic/setup.zsh

2、安装 GTSAM

#Boost >= 1.43
sudo apt-get install libboost-all-dev
#CMake >= 2.6
sudo apt-get install cmake

git clone https://bitbucket.org/gtborg/gtsam.git
cd gtsam
mkdir build
cd build
cmake ..
sudo make install

二、安装BLAM

git clone https://github.com/erik-nelson/blam.git

首先确保ROS_PACKAGE_PATH中没有任何其他ROS工作区

cd blam
./update

常见问题

1、fatal error: ros/ros.h: No such file or directory

cd blam/internal/src/geometry_utils

添加以下两行到 package.xml

<build_depend>roscpp</build_depend>
<run_depend>roscpp</run_depend>

添加以下下两行到CMakeList.txt

find_package(catkin REQUIRED COMPONENTS roscpp)
include_directories(include ${catkin_INCLUDE_DIRS})

2、Invalid (NaN, Inf) point coordinates given to nearestKSearch!

my solution is edit the “point_cloud_filter.cc”, add the following code at the end of the Filter function

if (!points->is_dense)
{
points_filtered->is_dense = false;
std::vector indices;
pcl::removeNaNFromPointCloud(points_filtered,points_filtered, indices);
}

3、按照以上方法修改后,在回环后还是出现Invalid (NaN, Inf) point coordinates given to nearestKSearch

修改”BlamSlam.cc”,修改以下几行(这几行不是连在一起的),即把使用原始msg的地方替换为msg_filtered

//1、change loop_closure_.AddKeyScanPair(0, msg); to
loop_closure_.AddKeyScanPair(0, msg_filtered);  

//2、change if (HandleLoopClosures(msg, &new_keyframe)) to
if (HandleLoopClosures(msg_filtered, &new_keyframe))

//3、localization_.TransformPointsToFixedFrame(*msg, msg_fixed.get());
localization_.TransformPointsToFixedFrame(*msg_filtered, msg_fixed.get());

以上nan问题主要是因为所使用的点云数据is_desne:false也就是说,点云里面可能含有nan所以在filter里面

统一做了去除无效值

三、使用

官方使用的是velodyne的数据

rosbag play velodyne.bag#输出话题rslidar_points

source your_path/blam-master/internal/devel/setup.zsh
roslaunch blam_example test_online.launch

使用自己的数据集,修改test_online.launch文件

<remap from="~pcld" to="/rslidar_points"/> <!--/rslidar_points替换成自己的话题名-->

使用自定义数据集常见问题

1、效果不好

注意查看自己的点云数据量和velodyne的区别,如果点云数量少就修改point_cloud_filter/config/parameters.yaml

#关闭voxel grid filter
grid_filter: false

2、按照1修改了,效果还不好,旋转特别大

修改point_cloud_localization/config/parameters.yaml

  # Maximum acceptable incremental rotation and translation.
  transform_thresholding: true #false
  max_translation: 0.5 #0.05
  max_rotation: 0.3 #0.1

3、不回环

观察你的pose相差多远,修改laser_loop_closure/config/parameters.yaml

#默认0.5米检测一次回环或记录关键帧,值越大效率越高,发现构图缓慢的时候可以放大这个值
translation_threshold: 1.0 #0.5

#默认是在1.5米范围内匹配,根据你自己的回环误差放大这个值
proximity_threshold: 10 #1.5

#ICP "fitness score" must be less than this number,就是越小越难回环
max_tolerable_fitness: 5 #0.15

#根据你自己的地图大小适当放宽跳过回环的点数,一般地图越大值越大
skip_recent_poses: 100 #40
poses_before_reclosing: 100 #40

4、看到位姿回环并修正了,但是点云没有被修正

取消订阅/blam/blam_slam/octree_map_updates再重新订阅就看到了

使用自己的rslidar室外数据集,效果如下(网格大小10m):

首次构图,还未回环,几乎无偏差
首次构图
经过一圈之后已经产生了角度的偏差,回环之后依然良好,最终图如下

这里写图片描述
这里写图片描述

总结:

效果还不错,首次构图误差小,回环速度够快,调参也方便,关键是不需要其他传感器

  • 5
    点赞
  • 41
    收藏
    觉得还不错? 一键收藏
  • 33
    评论
评论 33
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值