今天先搭建开发环境,包括ROS indigo,OpenCV,PCL,Turtlebot2,Kinect,开发RGB-D SLAM需要的我们今天都一口气装完!
首先,伙计,确保你是用的Ubuntu,如果不知道版本的话,就跟我一样吧,14.04,这个资料比较多。安装可以参考这个网站http://wiki.ros.org/indigo/Installation/Ubuntu,嫌英文麻烦就看我的
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo apt-get update
sudo apt-get install ros-indigo-desktop-full
sudo rosdep init
rosdep update
echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt-get install python-rosinstall
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
source /devel/setup.bash
echo $ROS_PACKAGE_PATH
/home/youruser/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks
这样就表明配置成功了。
rosrun turtlesim turtlesim_node
rosrun turtlesim turtlesim_teleop_key
接下来就能看到一个小海龟,并且可以用键盘控制运动啦,ROS安装到此告一段落。
sudo apt-get update
sudo apt-get install ros-indigo-turtlebot ros-indigo-
turtlebot-apps ros-indigo-turtlebot-interactions ros-indigo-turtlebot-simulator ros-indigo
-kobuki-ftdi ros-indigo-rocon-remocon ros-indigo-rocon-qt-library ros-indigo-ar-track-alvar-msgs
PS(如果在后面的检查中发现不对,可参考http://wiki.ros.org/turtlebot/Tutorials/indigo/Turtlebot%20Installation这里面的教程)
roslaunch turtlebot_bringup minimal.launch
roslaunch turtlebot_teleop keyboard_teleop.launch
这样,就能通过键盘控制Kobuki运动啦!
rosrun kobuki_ftdi create_udev_rules
这样就成功啦!
sudo apt-get install ros-indigo-openni-* ros-indigo-openni2-* ros-
indigo-freenect-*
rospack profile
echo $TURTLEBOT_3D_SENSOR
如果正确,应该输出
#Output: kinect
不对的话,输入
echo "export TURTLEBOT_3D_SENSOR=kinect" >> .bashrc
重启终端,再echo 3D传感器就正确啦 !
roslaunch turtlebot_bringup minimal.launch
roslaunch openni_launch openni.launch
rosrun image_view image_view image:=/camera/rgb/image_color
这样,就能看到Kinect的彩色图啦,如果要看深度图,那么输入
rosrun image_view image_view image:=/camera/depth_registered/image
因为2.x和3.x系列接口差距挺大的,我们这里用的2.x系列,那大家就用这个吧,这里给出链接,先下载源码包OpenCV这里我下的2.4.13版本的,无所谓,更新的话,可能会有小错误。
sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev
libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen2-dev yasm
libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev
libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex
-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev
时间比较长,可以玩一会再回来瞅瞅。
mkdir build
cd build
cmake ..
make
sudo make install
这个时间就更长了,慢慢等,玩会再来。
sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
sudo apt-get update
sudo apt-get install libpcl-all
没了。
#Prepare Workspace
source /opt/ros/indigo/setup.bash
mkdir -p ~/rgbdslam_catkin_ws/src
cd ~/rgbdslam_catkin_ws/src
catkin_init_workspace
cd ~/rgbdslam_catkin_ws/
catkin_make
source devel/setup.bash
#Get RGBDSLAM
cd ~/rgbdslam_catkin_ws/src
wget -q http://github.com/felixendres/rgbdslam_v2/archive/indigo.zip
unzip -q indigo.zip
cd ~/rgbdslam_catkin_ws/
#Install
rosdep update
rosdep install rgbdslam
catkin_make
运行 roslaunch rgbdslam openni+rgbdslam.launch,就能看到一个漂亮的界面和点云图啦。
sudo apt-get install ros-indigo-octomap*
cd turtlebot_ws/src
git clone https://github.com/RobustFieldAutonomyLab/turtlebot_exploration_3d.git
catkin_make
sudo apt-get update
sudo apt-get install ros-indigo-turtlebot-exploration-3d
roslaunch turtlebot_exploration_3d minimal_explo.launch
roslaunch turtlebot_exploration_3d turtlebot_gmapping.launch
rosrun turtlebot_exploration_3d turtlebot_exploration_3d
roslaunch turtlebot_exploration_3d exploration_rviz.launch
git clone https://github.com/OctoMap/octomap
cd octomap
mkdir build
cd build
cmake ..
make
进入octomap的bin目录,执行
./octovis /home/yourname/ot文件
至此,所有基本工具都安装配置完毕。