ubuntu16.4运行RGBD SLAM
作者:互联网
####仅作为笔记
环境:
Ubuntu16.04
照例贴出build.sh的内容:
#This script installs rgbdslam_v2 and g2o in ~/Code
#This script can be downloaded individually, as it
#does not require rest of the rgbdslam repository.
#It will download all required code in the process.
#If you have a fast machine with 4GB RAM or more, increase the
#two occurences of "-j2" below to parallelize the compilation more
#Prepare System
if test ! -d /opt/ros/kinetic; then
echo This script assumes ROS kinetic to be installed
echo The directory /opt/ros/kinetic was not found
exit 1
fi
SUBDIR=~/Code ##这里可以修改成自己设定的目录
echo "This script puts all code into '$SUBDIR'. Edit this script to change the location."
echo "Press enter to continue, Ctrl-C to cancel"
read
mkdir -p $SUBDIR
source /opt/ros/kinetic/setup.bash
echo
echo "Removing packages known to conflict (password required for apt-get)"
echo
sudo apt-get purge ros-kinetic-libg2o libqglviewer-dev
echo
echo "Updating ROS dependency database"
echo
rosdep update
echo "Install dependences for g2o"
sudo apt-get install libsuitesparse-dev libeigen3-dev
echo
echo
echo "Downloading, building and installing g2o"
echo
G2O_REPO_DIR=$SUBDIR/g2ofork
git clone -b c++03 https://github.com/felixendres/g2o.git $G2O_REPO_DIR
mkdir $G2O_REPO_DIR/build
cd $G2O_REPO_DIR/build
cmake .. -DCMAKE_INSTALL_PREFIX=$G2O_REPO_DIR/install -DG2O_BUILD_EXAMPLES=OFF
nice make -j2 install
echo
echo "Preparing catkin workspace for rgbdslam_v2"
echo
WORKSPACE=$SUBDIR/rgbdslam_catkin_ws
mkdir -p $WORKSPACE/src
cd $WORKSPACE/src
catkin_init_workspace
catkin_make -C $WORKSPACE
source $WORKSPACE/devel/setup.bash
echo
echo "Downloading rgbdslam_v2"
echo
#Get and build rgbdslam_v2
export G2O_DIR=$G2O_REPO_DIR/install
git clone -b kinetic https://github.com/felixendres/rgbdslam_v2.git $WORKSPACE/src/rgbdslam
#Install missing dependencies
rosdep install rgbdslam
echo
echo "Building rgbdslam_v2"
echo
nice catkin_make -C $WORKSPACE -j2
- g2o
sudo apt-get install cmake libeigen3-dev libsuitesparse-dev libqt4-dev qt4-qmake libqglviewer-dev qt5-qmake
git clone https://github.com/felixendres/g2o.git
cd g2o && mkdir build && cd build
cmake ..
make -j4 && sudo make install
- pcl-1.8
wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.1.tar.gz
tar -xvzf pcl-1.8.1.tar.gz
cd pcl-1.8.1 && mkdir build && cd build
cmake .. && make -j4
sudo make install
- rgbd slam
#修改 find_package(PCL 1.7 REQUIRED COMPONENTS common io)为:
# find_package(PCL 1.8 REQUIRED COMPONENTS common io)
#CMakeLists第6行加入:add_compile_options(-std=c++11)
cd ~/catkin_ws/src
wget -q http://github.com/felixendres/rgbdslam_v2/archive/kinetic.zip
rosdep update
rosdep install rgbdslam
catkin_make
- 测试
#启动rgbdslam节点
roslaunch rgbdslam rgbdslam.launch
#主要修改topic
<param name="config/topic_image_mono" value="/camera/rgb/image_color"/>
<param name="config/topic_image_depth" value="/camera/depth/image"/>
#播放数据集
rosbag play rgbd_dataset_freiburg1_xyz.bag
- 测试结果
标签:rgbdslam,make,catkin,echo,SLAM,build,install,ubuntu16.4,RGBD 来源: https://blog.csdn.net/wyy13273181006/article/details/108858385