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
  1. 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
  1. 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
  1. 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 
  1. 测试
#启动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
  1. 测试结果
    在这里插入图片描述在这里插入图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值