18.04下 LOAM_Velodyne 的编译安装(PCL为1.11.0)
1 Ubuntu18.04使用源代码编译安装PCL
1.1 安装依赖
sudo apt-get update
sudo apt-get install git build-essential linux-libc-dev
sudo apt-get install cmake cmake-gui
sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev
sudo apt-get install mpi-default-dev openmpi-bin openmpi-common
sudo apt-get install libflann1.9 libflann-dev //这里如果是1.8改为1.9才可以
sudo apt-get install libeigen3-dev
sudo apt-get install libboost-all-dev
sudo apt-get install libvtk6.3-qt libvtk6.3 libvtk6-dev
//这里如果不能用需用sudo apt-cache search libvtk 找新版本替换
sudo apt-get install libqhull* libgtest-dev
sudo apt-get install freeglut3-dev pkg-config
sudo apt-get install libxmu-dev libxi-dev
sudo apt-get install mono-complete
sudo apt-get install openjdk-8-jdk openjdk-8-jre
//qt-sdk已无法定位软件
1.2 下载编译
下载pcl包,目前为1.11.0
git clone https://github.com/PointCloudLibrary/pcl.git
编译
cd pcl
mkdir release
cd release
cmake -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_GPU=ON -DBUILD_apps=ON -DBUILD_examples=ON \
-DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
//不建议使用cpu的最大线程来编译,可能会死机,用4线程即可大约20min
sudo make install
2 Loam的编译安装
2.1 下载
cd ~/catkin_ws/src
git clone https://github.com/laboshinl/loam_velodyne.git
将路径 /home/nj/catkin_ws/src/loam_velodyne/src/lib 下的 LaserMapping.cpp 中139-153行注释掉
2.2 编译
cd catkin_ws
catkin_make
报错:CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package): Could not find a package configuration file provided by “pcl_conversions” with any of the following names:
pcl_conversionsConfig.cmake
pcl_conversions-config.cmake
解决:
sudo apt-get install ros-melodic-navigation
sudo apt-get install ros-melodic-pcl-conversions ros-melodic-pcl-ros
此处可尝试直接运行第二步,我直接运行第二步显示无法找到cl-conversions,然后再catkin_make 即可成功。
将其路径写在 ./bashrc 中,如下
2.3 运行
在此链接中下载所需bag http://wiki.ros.org/loam_velodyne
roslaunch loam_velodyne loam_velodyne.launch
rosbag play ~/nsh_indoor_outdoor.bag
运行后会打开rviz并等待雷达数据,播放bag,即可在rviz中看到点云效果
|