Summary
Package lists for SLAM development
install.sh [updating]
# Install ROS
sudo apt-get install ros-kinetic-desktop-full
sudo apt-get install libsuitesparse-dev
System Environment
yubao@yubao-Z370M-S01:~/Software$ uname -a
Linux yubao-Z370M-S01 4.15.0-46-generic #49~16.04.1-Ubuntu SMP Tue Feb 12 17:45:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
By defult, I install these packages use apt-get rather than source code to avoid the lib conflict.
Eigen
sudo apt-get install libeigen3-dev
Installed to:
/usr/include/eigen3
sensors
sudo apt-get install lm-sensors
sudo modprobe coretemp
Boost
sudo apt-get install libboost-all-dev
Procedure, refer Installing Boost C++ libraries
- Log on to the computer as the root user or as a user with sudo permissions.
- Download the Boost C++ libraries. For example, go to https://sourceforge.net/projects/boost/files/boost/1.57.0/, and download boost_1_57_0.zip.
- Decompress boost_1_57_0.zip. For example, go to the directory where you downloaded boost_1_57_0.zip, and enter the following command: unzip boost_1_57_0.zip.
- Go to the boost_1_57_0 directory.
- Enter the following command to build the installer: ./bootstrap.sh.
- Enter the following command to run the installer: ./b2 install.
Test Example:
libboost-test.cpp:
#include<iostream>
#include<boost/bind.hpp>
using namespace std;
using namespace boost;
int fun(int x,int y){return x+y;}
int main(){
int m=1;int n=2;
cout<<boost::bind(fun,_1,_2)(m,n)<<endl;
return 0;
}
g++ libboost-test.cpp -o libboost-test
PCL
The installation instructions are:
sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
sudo apt-get update
#sudo apt-get install libpcl-all
sudo apt-get install libpcl-dev
Compile PCL from source code
- Clone source code from [pcl-git]: https://github.com/PointCloudLibrary/pcl.git
- Read compile instruction on Compiling PCL from source on POSIX compliant systems
Remove preinstalled: sudo apt-get remove pcl
git clone https://github.com/PointCloudLibrary/pcl pcl-trunk
vim io/src/hdl_grabber.cpp add #include <thread>
cd pcl-trunk && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_GPU=ON -DBUILD_apps=ON -DBUILD_examples=ON ..
make -j2
sudo make -j2 install
Common Errors
/home/yubao/Software/3rdPartyLibs/pcl/io/src/hdl_grabber.cpp: In member function ‘void pcl::HDLGrabber::readPacketsFromPcap()’:
/home/yubao/Software/3rdPartyLibs/pcl/io/src/hdl_grabber.cpp:716:10: error: ‘std::this_thread’ has not been declared
std::this_thread::sleep_for(std::chrono::microseconds(usec_delay));
^
/home/yubao/Software/3rdPartyLibs/pcl/io/src/hdl_grabber.cpp:716:38: error: ‘std::chrono’ has not been declared
std::this_thread::sleep_for(std::chrono::microseconds(usec_delay));
^
io/CMakeFiles/pcl_io.dir/build.make:218: recipe for target 'io/CMakeFiles/pcl_io.dir/src/hdl_grabber.cpp.o' failed
make[2]: *** [io/CMakeFiles/pcl_io.dir/src/hdl_grabber.cpp.o] Error 1
CMakeFiles/Makefile2:499: recipe for target 'io/CMakeFiles/pcl_io.dir/all' failed
make[1]: *** [io/CMakeFiles/pcl_io.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 12%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_cone.cpp.o
Refer https://github.com/PointCloudLibrary/pcl/issues/2952 to solve.
Try to add #include at the top of “hdl_grabber.cpp” file.
OpenNI
Install from prebuild
check Install libopenni2-dev
sudo apt-get update
sudo apt-get install libopenni-dev
sudo apt-get install libopenni2-dev
Install and Config OpenNI2 from source
-
Download OpenNI2 from
occipital/OpenNI2 -
make and Install
make
sudo ./install.sh
Config environment
check file “OpenNIDevEnvironment”
Add these to your ~/.bashrc and then source ~/.bashrc
Header and libraries: You will find a OpenNIDevEnvironment file containing the paths for two environment variables: OPENNI2_INCLUDE and OPENNI2_REDIST. Use these include and library paths when you build your own C++ code that uses OpenNI. To link with OpenNI libraries add the -lOpenNI2 directive.
export OPENNI2_INCLUDE=/home/yubao/Software/4rdPartyLibs/install/OpenNI-Linux-x64-2.2/Include
export OPENNI2_REDIST=/home/yubao/Software/3rdPartyLibs/install/OpenNI-Linux-x64-2.2/Redist
or
cat OpenNIDevEnvironment >> ~/.bashrc
Additional Config
Tools$ sudo cp OpenNI2 /usr/lib -r
OpenNI-Linux-x64-2.2/Include$ sudo cp * /usr/include/openni2/ -r
OpenNI-Linux-x64-2.2$ sudo cp Redist/libOpenNI2.* /usr/lib
You may see this error when you build OpenKinect/libfreenect2 if you do not config them.
[ 70%] Building CXX object CMakeFiles/freenect2-openni2.dir/src/openni2/ColorStream.cpp.o
In file included from /home/yubao/Software/3rdPartyLibs/libfreenect2/src/openni2/ColorStream.cpp:29:0:
/home/yubao/Software/3rdPartyLibs/libfreenect2/src/openni2/ColorStream.hpp:31:33: fatal error: Driver/OniDriverAPI.h: No such file or directory
compilation terminated.
CMakeFiles/freenect2-openni2.dir/build.make:62: recipe for target 'CMakeFiles/freenect2-openni2.dir/src/openni2/ColorStream.cpp.o' failed
- Refer
- How to install and use OpenNI2
-
OpenNI2安装
for more information
How to use librealsense with OpenNI
Compile libreasense driver and then copy librs2driver.so and
librealsense2.so to the Drivers folder.
For example:
cp _out/librs2driver.so [PATH]/OpenNI2/Bin/x64-Release/OpenNI2/Drivers/
cp librealsense2.so [PATH]/OpenNI2/Bin/x64-Release/OpenNI2/Drivers/
cd Tools
./NiViewer
Common Errors
libOpenNI.so.0
yubao@yubao-Z370M-S01:~/Software/3rdPartyLibs/install/OpenNI-Linux-x64-2.2$ NiViewer
NiViewer: error while loading shared libraries: libOpenNI.so.0: cannot open shared object file: No such file or directory
Reference
[1] Compiling PCL from source on POSIX compliant systems
[2] Ubuntu16.04下PCL库的安装与测试