Ubuntu18.04安裝PCL
Ubuntu18.04安裝ROS的版本爲ros-melodic
Ubuntu16.04安裝ROS的版本爲ros-kinetic
下面介紹Ubuntu18.04下安裝ros-melodic
(跟着步驟,一步一步走)
安裝依賴
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.8 libflann-dev
sudo apt-get install libeigen3-dev 這個需要自己下載正確版本安裝
sudo apt-get install libboost-all-dev
sudo apt-get install libvtk7.1-qt libvtk7.1 libvtk7-qt-dev
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
在ubuntu18.04
中libtk
已經從網上說的5.10
版本變成了7.10
。當然隨着時間的退役7.10
也會被捨棄,這時我們要用到
sudo apt-cache search libvtk
我們用這行命令去搜索libtk的最新版本。
在ubuntu18.04
中qt-sdk
已經被捨棄,親身測試不需要安裝。
下載編譯
下載就不用說了,這是網址https://github.com/PointCloudLibrary/pcl.git ,可手動下載也可用git下載
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
等待漫長的編譯之後
sudo make install
驗證PCL是否安裝成功
按照以上步驟直接生成.cpp
文件運行會發現找不到頭文件,原因是需要使用Cmake
編譯(包括連接到PCL
庫等)
具體操作直接參照官網(http://pointclouds.org/documentation/tutorials/using_pcl_pcl_config.php#using-pcl-pcl-config)
步驟包括:
(1).在project
文件夾下生成 pcd_write.cpp
(見官網上提供的鏈接)
(2).生成 CMakeLists.txt
,直接複製一下內容(不需要任何修改):
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(MY_GRAND_PROJECT)
find_package(PCL 1.3 REQUIRED COMPONENTS common io)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(pcd_write_test pcd_write.cpp)
target_link_libraries(pcd_write_test ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES})
然後編譯運行
cd /PATH/TO/MY/GRAND/PROJECT (project 所在的文件夾)
mkdir build
cd build
cmake ..
make
./pcd_write_test
安裝完成,盡情享受PCL的魅力吧。
PCL卸載
卸載有問題的PCL1.7
(vtk bug
等等,例如:不能顯示深度圖)
(這裏描述的pcl1.7,具體版本請查看自己安裝的對應版本)
sudo rm -r build
sudo rm -r /usr/include/pcl-1.7 /usr/share/pcl /usr/bin/pcl* /usr/lib/libpcl*
執行上述命令, 上述四個目錄中,可能會找不到某些目錄。可以自己去 usr
目錄下搜索 關鍵字 pcl
或者 libpcl
。本人在目錄 /usr/libx86_64-linux-gnu
下找到 相關libpcl*文件,刪除即可,刪除命令同上。
致謝:
https://blog.csdn.net/qq_40022890/article/details/100786946
https://www.cnblogs.com/winslam/p/12074432.html
https://www.cnblogs.com/lifeofershisui/p/9037829.html