【SLAM】关于A-LOAM基于Ubuntu20.04 ROS1 noetic版本读取相关数据集

1 篇文章 0 订阅
1 篇文章 0 订阅

相关参考:【slam】Ubuntu20.04 ROS1 noetic版本 A-LOAM跑kitti_error opening file: kitti_2011_09_30_drive_0027_sy-CSDN博客

一、下载数据集

准备好已有数据集,如果没有可以在此下载笔者提供的kitt数据集(建议):

链接: https://pan.baidu.com/s/1ZArRRqDEUMC3oGcmyRUJpQ?pwd=542b 提取码: 542b

二、下载ceres

本文使用的是ceres2.0.0版本,如果版本过高则在后续A-LOAM 编译过程中报错

2.1安装ceres依赖项

sudo apt-get install  liblapack-dev libsuitesparse-dev libcxsparse3 libgflags-dev libgoogle-glog-dev libgtest-dev

2.2下载ceres

https://github.com/ceres-solver/ceres-solver/tags

选择其中的2.0.0版本(建议)

2.3对ceres进行编译

mkdir build
cd build
cmake ..
make -j4
sudo make install

2.4ceres相关依赖项

ceres相关依赖项可有选择下载

# CMake
sudo apt-get install cmake
# google-glog + gflags
sudo apt-get install libgoogle-glog-dev libgflags-dev
# Use ATLAS for BLAS & LAPACK
sudo apt-get install libatlas-base-dev
# Eigen3
sudo apt-get install libeigen3-dev
# SuiteSparse (optional)
sudo apt-get install libsuitesparse-dev

三、下载PCL

git clone https://github.com/PointCloudLibrary/pcl.git

四、修改ros相关文件

//将scanRegistration.cpp中的sub接口改一下
ros::Subscriber subLaserCloud = nh.subscribe<sensor_msgs::PointCloud2>("/velodyne_points", 100, laserCloudHandler);
//改为
ros::Subscriber subLaserCloud = nh.subscribe<sensor_msgs::PointCloud2>("/points_raw", 100, laserCloudHandler);
//改完后保存

五、下载并且编译A-LOAM

   cd ~/catkin_ws/src
    git clone https://github.com/HKUST-Aerial-Robotics/A-LOAM.git
    cd ../
    catkin_make
    source ~/catkin_ws/devel/setup.bash

5.1在编译A-LOAM时catkin_make时可能遇到的错误

错误1:

at A-LOAM/CMakeLists.txt:24 (find_package):   By not providing "FindCeres.cmake" in CMAKE_MODULE_PATH this project has   asked CMake to find a package configuration file provided by "Ceres", but   CMake did not find one. 

 解决方式:

git clone https://ceres-solver.googlesource.com/ceres-solver

错误2:

编译中大概率出现很长很长的错误代码,则进行以下修改:

//改A-LOAM下的CMakeLists.txt
c++11 改为 c++14
 
//改A-LOAM/src/kittiHelper.cpp
CV_LOAD_IMAGE_GRAYCALE 改为 cv::IMREAD_GRAYSCALE       //91行和93行
 
//改A-LOAM/src/scanRegistration.cpp里的
#include <opencv/cv.h> 改为 #include <opencv2/imgproc.hpp>
 
//改A-LOAM/src/三个cpp文件laserMapping.cpp和scanRegistration.cpp和laserOdometry.cpp
//使用ctrl+h快捷键快速替换
/camera_init 改为 camera_init

修改完成后进行重新编译:

catkin_make -j8

错误3:

 错误报告中出现类似的如下问题,可能是之前装过ceres,但是版本问题过高,导致ceres不能被识别。如此直接卸载高版本ceres,重新下载上文所述2.0.0版本即可解决。

/home/tfc/livox-loam/catkin_ws/src/loam_livox/source/point_cloud_registration.hpp:221:20: error: ‘LocalParameterization’ is not a member of ‘ceres’
             ceres::LocalParameterization *      q_parameterization = new ceres::EigenQuaternionParameterization();
                    ^~~~~~~~~~~~~~~~~~~~~
/home/tfc/livox-loam/catkin_ws/src/loam_livox/source/point_cloud_registration.hpp:221:49: error: ‘q_parameterization’ was not declared in this scope
             ceres::LocalParameterization *      q_parameterization = new ceres::EigenQuaternionParameterization();
                                                 ^~~~~~~~~~~~~~~~~~
/home/tfc/livox-loam/catkin_ws/src/loam_livox/source/point_cloud_registration.hpp:221:74: error: expected type-specifier
             ceres::LocalParameterization *      q_parameterization = new ceres::EigenQuaternionParameterization();
                                                                          ^~~~~
In file included from /home/tfc/livox-loam/catkin_ws/src/loam_livox/source/laser_mapping.cpp:37:0:
————————————————
原文链接:https://blog.csdn.net/m0_62161738/article/details/134936944

ceres卸载指令:

sudo rm -r /usr/local/lib/cmake/Ceres
sudo rm -rf /usr/local/include/ceres /usr/local/lib/libceres.a

错误4:

如果之前下载过ananconda,则可能会报错ananconda和ros中的opencv版本冲突

笔者多番寻觅并未找到解决良方,便将anaconda卸载,错误根除!

五、XX,启动!

//初始化(在工作空间文件夹下如:catkin_ws)
source devel/setup.bash 
//运行A-LOAM(在工作空间文件夹下如:catkin_ws)
roslaunch aloam_velodyne aloam_velodyne_HDL_64.launch
//运行kitti数据集(在数据集所在的文件夹下重新打开一个终端)
rosbag play kitti_2011_09_30_drive_0027_synced_SELF.bag

 运行结果如下:

  • 30
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值