git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
sudo apt install autotools-dev ccache doxygen dh-autoreconf git liblapack-dev libblas-dev libgtest-dev libreadline-dev libssh2-1-dev pylint clang-format-3.9
sudo apt-get install libeigen3-dev
git clone https://github.com/stevenlovegrove/Pangolin.git
sudo apt-get install libglew-dev
sudo apt-get install cmake
sudo apt-get install libpython2.7-dev
sudo apt-get install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev
sudo apt-get install libdc1394-22-dev libraw1394-dev
sudo apt-get install libjpeg-dev libtiff5-dev libopenexr-dev
sudo apt-get install libxkbcommon-dev
cd Pangolin
mkdir build
cd build
cmake ..
cmake --build .
sudo gedit build.sh,在最后将 -j
取消掉。
在include里面的system.h加入#include
官网下载opencv包,随便放哪里,解压,进解压目录,创建mybuild文件夹,进mybuild目录,进行文件配置:
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
编译(20分钟):
sudo make -j8
安装(1分钟):
sudo make install
将OpenCV的库添加到路径
sudo gedit /etc/ld.so.conf.d/opencv.conf
在打开文文件末添加如下代码(打开是空白的,不要慌,是这样的,添加下面路径进去):
/usr/local/lib
使得配置路径生效
sudo ldconfig
配置环境变量
sudo gedit /etc/bash.bashrc
在文件末尾添加如下环境变量代码:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
使得环境变量生效
source /etc/bash.bashrc
更新数据
sudo updatedb
查看是否安装成功opencv:(打印出版本即可)
pkg-config opencv --modversion
如果第二个bulid_ros.sh提示找不到makefile就不管他= =
chmod +x ./build.sh
./build.sh
chmod +x ./build_ros.sh
./build_ros.sh
效果如下:
然后再orb_slam2目录新建个data文件夹,下载数据集rgbd_dataset_freiburg1_xyz到data文件夹里面
下载TMU数据集:
链接:https://pan.baidu.com/s/1laDzRQ78SKDFf85HyrtfHQ
提取码:kcsi
如图:
运行:
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml Data/rgbd_dataset_freiburg1_xyz/
试试能不能打开摄像头:
sudo apt-get install guvcview
guvcview -d /dev/video
能打开,继续进入ros空间,下载usb_cam
git clone https://github.com/bosch-ros-pkg/usb_cam.git
git clone https://github.com/ros-interactive-manipulation/manipulation_msgs.git
git clone https://github.com/ros-interactive-manipulation/household_objects_database_msgs.git
回到上层目录,make一下:
catkin_make
程序注册,使得该功能包生效
source ./devel/setup.bash
进src/usb_cam/,新建build,进build,
cmake ..
make -j8
进usb_cam下/launch文件夹中找到usb_cam-test.launch文件
让他成为可执行文件:
chmod +x usb_cam-test.launch
运行这个launch相机节点:
roslaunch usb_cam usb_cam-test.launch
运行Mono:
rosrun ORB_SLAM2 Mono Vocabulary/ORBvoc.txt Examples/ROS/ORB_SLAM2/Asus.yaml
遇到点问题,尚在努力!以后更新~
反正这个调用摄像头我失败了,不管了~
下载好数据集kitti_images:
链接:https://pan.baidu.com/s/1DvlT2hIyLaM5c-s0pSUANw
提取码:mijm
解压,把calib里面的两个txt拿到外面来,修改KItti_imag_2文件夹名为image_0
运行:
/Examples/Monocular/mono_kitti Vocabulary/ORBvoc.txtExamples/Monocular/KITTI00-02.yaml data/kitti_Image
效果图: