< >
Home » TK1入门教程软件篇 » TK1入门教程软件篇-安装Turtlebot

TK1入门教程软件篇-安装Turtlebot

TK1入门教程软件篇-安装Turtlebot

说明:

  • 介绍在TK1上如何安装Turtlebot

准备:

安装uvcvideo驱动

安装USB驱动

安装Turtlebot:

  • 新建ROS和脚本
mkdir ~/ROS
cd ~/ROS
touch installTurtlebot.sh
  • 查看脚本
vim installTurtlebot.sh
  • 内容如下:
sudo apt-get install ros-indigo-turtlebot ros-indigo-turtlebot-apps ros-indigo-turtlebot-interactions  ros-indigo-kobuki-ftdi ros-indigo-rocon-remocon ros-indigo-rocon-qt-library ros-indigo-ar-track-alvar-msgs
  • 官网的的软件包ros-indigo-turtlebot-simulator不能安装,之后采用源码安装
  • 分配权限,执行安装:
chmod +x installTurtlebot.sh
./installTurtlebot.sh
  • 源码安装turtlebot-simulator
  • 创建工作空间下载源码并编译
mkdir -p ~/turtlebot_ws/src/
cd ~/turtlebot_ws/src/
git clone https://github.com/turtlebot/turtlebot_simulator.git
cd ..
catkin_make
  • 增加工作空间,增加如下代码到~/.bashrc文件
source /home/ubuntu/turtlebot_ws/devel/setup.bash
  • 至此Turtlebot安装完成。

全源码安装

测试:

  • 连接好Turtlebot2底盘,打开电源

  • 检查是否创建别名:

ls /dev/kobuki
roslaunch turtlebot_bringup minimal.launch 
  • 新终端,检查底座
rqt -s kobuki_dashboard
  • 新终端,启动键盘控制
roslaunch turtlebot_teleop keyboard_teleop.launch

Hack OpenCV:

  • 安装好的OpenCV版本是2.4.13,但是编译一些包提示需要2.4.8,需要做一些更改,以便使用新版本的
  • 需要变更如下文件:
/opt/ros/<ros-version>/lib/pkgconfig/cv_bridge.pc
/opt/ros/<ros-version>/lib/pkgconfig/image_geometry.pc
/opt/ros/<ros-version>/share/cv_bridge/cmake/cv_bridgeConfig.cmake
/opt/ros/<ros-version>/share/image_geometry/cmake/image_geometryConfig.cmake
  • 新备份目录hacksopencv,备份文件:
$ mkdir ~/hacksopencv
$ sudo cp /opt/ros/indigo/lib/pkgconfig/cv_bridge.pc ~/hacksopencv/cv_bridge.pc-bak
$ sudo cp /opt/ros/indigo/lib/pkgconfig/image_geometry.pc ~/hacksopencv/image_geometry.pc-bak
$ sudo cp /opt/ros/indigo/share/cv_bridge/cmake/cv_bridgeConfig.cmake ~/hacksopencv/cv_bridgeConfig.cmake-bak
$ sudo cp /opt/ros/indigo/share/image_geometry/cmake/image_geometryConfig.cmake ~/hacksopencv/image_geometryConfig.cmake-bak
  • 对以上文件修改如下几处:

    1. 删除/usr/lib/arm-linux-gnueabihf/libopencv_ocl.so.2.4.8
    2. 替换/usr/lib/arm-linux-gnueabihf/为/usr/lib
    3. 替换2.4.8为2.4.13(或当前在opencv4tegra中的OpenCV版本)
  • 使用sed批量替换:

sed -i 's/原字符串/替换字符串/g' filename
  • 删除/usr/lib/arm-linux-gnueabihf/libopencv_ocl.so.2.4.8:
sed -i 's/\/usr\/lib\/arm-linux-gnueabihf\/libopencv_ocl.so.2.4.8//g' cv_bridge.pc image_geometry.pc cv_bridgeConfig.cmake  image_geometryConfig.cmake 
  • 替换/usr/lib/arm-linux-gnueabihf/为/usr/lib:
sed -i 's/\/usr\/lib\/arm-linux-gnueabihf/\/usr\/lib/g' cv_bridge.pc image_geometry.pc cv_bridgeConfig.cmake  image_geometryConfig.cmake 
  • 替换2.4.8为2.4.13:
sed -i 's/2.4.8/2.4.13/g' cv_bridge.pc image_geometry.pc cv_bridgeConfig.cmake  image_geometryConfig.cmake 
  • 最后写成shell,在gist可以获取:
  • 内容为:
#!/bin/bash
#author: ncnynl 
#Website:ncnynl.com

#New category
mkdir ~/hacksopencv    

#backup files
sudo cp /opt/ros/indigo/lib/pkgconfig/cv_bridge.pc ~/hacksopencv/cv_bridge.pc-bak
sudo cp /opt/ros/indigo/lib/pkgconfig/cv_bridge.pc ~/hacksopencv/cv_bridge.pc

sudo cp /opt/ros/indigo/lib/pkgconfig/image_geometry.pc ~/hacksopencv/image_geometry.pc-bak
sudo cp /opt/ros/indigo/lib/pkgconfig/image_geometry.pc ~/hacksopencv/image_geometry.pc

sudo cp /opt/ros/indigo/share/cv_bridge/cmake/cv_bridgeConfig.cmake 
~/hacksopencv/cv_bridgeConfig.cmake-bak
sudo cp /opt/ros/indigo/share/cv_bridge/cmake/cv_bridgeConfig.cmake 
~/hacksopencv/cv_bridgeConfig.cmake

sudo cp /opt/ros/indigo/share/image_geometry/cmake/image_geometryConfig.cmake  ~/hacksopencv/image_geometryConfig.cmake-bak

sudo cp /opt/ros/indigo/share/image_geometry/cmake/image_geometryConfig.cmake  ~/hacksopencv/image_geometryConfig.cmake

#handle
cd ~/hacksopencv

#remove each instance “/usr/lib/arm-linux-gnueabihf/libopencv_ocl.so.2.4.8;“
sed -i 's/\/usr\/lib\/arm-linux-gnueabihf\/libopencv_ocl.so.2.4.8//g' cv_bridge.pc image_geometry.pc cv_bridgeConfig.cmake  image_geometryConfig.cmake 


#replace each instance of “/usr/lib/arm-linux-gnueabihf/” with “/usr/lib“
sed -i 's/\/usr\/lib\/arm-linux-gnueabihf/\/usr\/lib/g' cv_bridge.pc image_geometry.pc cv_bridgeConfig.cmake  image_geometryConfig.cmake 

#replace each instance of “2.4.8” with “2.4.12” (or the current version of OpenCV in opencv4tegra package)
sed -i 's/2.4.8/2.4.13/g' cv_bridge.pc image_geometry.pc cv_bridgeConfig.cmake  image_geometryConfig.cmake 

#cp back 
#sudo cp ~/hacksopencv/cv_bridge.pc /opt/ros/indigo/lib/pkgconfig/cv_bridge.pc 
#sudo cp ~/hacksopencv/image_geometry.pc /opt/ros/indigo/lib/pkgconfig/image_geometry.pc 
#sudo cp ~/hacksopencv/cv_bridgeConfig.cmake /opt/ros/indigo/share/cv_bridge/cmake/cv_bridgeConfig.cmake 
#sudo cp ~/hacksopencv/image_geometryConfig.cmake /opt/ros/indigo/share/image_geometry/cmake/image_geometryConfig.cmake  
  • 执行shell
chmod +x hacksopencv.sh 
sudo ./hacksopencv.sh 
  • 为了安全起见,注释掉cp back部分代码,自行替换文件。

问题:

  • 问题1:接上usb转串口线,然后ls /dev/则没有ttyUSB0.原因是没有驱动

  • 解决:参考准备的安装USB驱动。因为这是嵌入式设备,需要自己添加驱动到内核。可以直接使用Grinch

  • 问题2:

[rospack] Warning: error while crawling /home/xxx: boost::filesystem::status: Permission denied: "/home/xxx/.gvfs"
  • 解决:
~$ sudo umount /home/congleetea/.gvfs
~$ rm -rf .gvfs/

参考:

  • http://wiki.ros.org/librealsense#Installation
  • http://wiki.ros.org/turtlebot/Tutorials/indigo/Turtlebot%20Installation
  • http://www.jetsonhacks.com/2016/06/20/intel-realsense-camera-installation-nvidia-jetson-tk1/
  • https://github.com/ncnynl/installJetsonBot
  • http://blog.csdn.net/iriving_shu/article/details/54561986
  • https://github.com/ncnynl/installLibrealsense
  • https://devtalk.nvidia.com/default/topic/762653/-howto-build-own-kernel-for-jetson-tk1/
  • http://www.jetsonhacks.com/2015/06/14/ros-opencv-and-opencv4tegra-on-the-nvidia-jetson-tk1/
  • http://myzharbot.robot-home.it/blog/software/ros-nvidia-jetson-tx1-jetson-tk1-opencv-ultimate-guide/

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: tk1入门教程软件篇