红联Linux门户
Linux帮助

TX1 Ubuntu16.04系统下安装ros kinetic和turtlebot

发布时间:2017-04-25 09:29:45来源:linux网站作者:Holy_Lee
1、TX1刚刷完机,只能手动添加源:执行下图的三段命令,然后在把模板添加到source.list中。添加不同的源见wiki.ubuntu.org.cn/模板:16.04source
TX1 Ubuntu16.04系统下安装ros kinetic和turtlebot
 
2、下载谷歌浏览器:
sudo add-apt-repository  ppa:chromium-daily/stable
sudo apt-get update
sudo apt-get install chromium-browser
 
3、安装ros kinetic:
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-kinetic-desktop-full
 
4、配置kinetic
sudo rosdep init
rosdep update
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
如果执行sudo rosdep init出错,执行sudo c_rehash /etc/ssl/certs
 
5、安装turtlebot,参考以下:
安装准备
$ sudo apt-get install python-rosdep python-wstool ros-kinetic-ros
$ sudo rosdep init
$ rosdep update
分别建立三个工作空间rocon,kobuki,turtlebot,下载和编译源码
建立rocon目录,下载和编译,rocon都有对应的kinetic版本
$ mkdir ~/rocon
$ cd ~/rocon
$ wstool init -j5 src https://raw.github.com/robotics-in-concert/rocon/release/kinetic/rocon.rosinstall
$ source /opt/ros/kinetic/setup.bash
$ rosdep install --from-paths src -i -y
$ catkin_make
建立kobuki目录,下载和编译.
kobuki使用kinetic的版本下载会失败,先用indigo版本生成下载的rosinstall文件,再修改对应包为kinetic版本
$ mkdir ~/kobuki
$ cd ~/kobuki
$ wstool init src -j5 https://raw.github.com/yujinrobot/yujin_tools/master/rosinstalls/indigo/kobuki.rosinstall 
$ vim src/.rosinstall#参照src/.rosinstall文件内容,修改后在进行。
$ source ~/rocon/devel/setup.bash
$ rosdep install --from-paths src -i -y
$ catkin_make
src/.rosinstall文件为:
# THIS IS AN AUTOGENERATED FILE, LAST GENERATED USING wstool ON 2016-12-08
- git:
local-name: kobuki
uri: https://github.com/yujinrobot/kobuki.git
version: kinetic
- git:
local-name: kobuki_core
uri: https://github.com/yujinrobot/kobuki_core.git
version: kinetic
- git:
local-name: kobuki_desktop
uri: https://github.com/yujinrobot/kobuki_desktop.git
version: kinetic
- git:
local-name: kobuki_msgs
uri: https://github.com/yujinrobot/kobuki_msgs.git
version: kinetic
- git:
local-name: yocs_msgs
uri: https://github.com/yujinrobot/yocs_msgs.git
version: release/0.6-kinetic
- git:
local-name: yujin_ocs
uri: https://github.com/yujinrobot/yujin_ocs.git
version: kinetic
建立turtlebot目录,下载和编译.
turtlebot使用kinetic的版本下载会失败,先用indigo版本生成下载的rosinstall文件,再修改对应包为kinetic版本,没有kinetic版本的保持为indigo版本
$ mkdir ~/turtlebot
$ cd ~/turtlebot
$ wstool init src -j5 https://raw.github.com/yujinrobot/yujin_tools/master/rosinstalls/indigo/turtlebot.rosinstall
$ vim src/.rosinstall#参照src/.rosinstall文件内容,修改后在进行。
$ source ~/kobuki/devel/setup.bash
$ rosdep install --from-paths src -i -y
$ catkin_make
src/.rosinstall文件内容:
# THIS IS AN AUTOGENERATED FILE, LAST GENERATED USING wstool ON 2016-12-08
- git:
local-name: turtlebot
uri: https://github.com/turtlebot/turtlebot.git
version: kinetic
- git:
local-name: turtlebot_apps
uri: https://github.com/turtlebot/turtlebot_apps.git
version: indigo
- git:
local-name: turtlebot_create
uri: https://github.com/turtlebot/turtlebot_create.git
version: indigo
- git:
local-name: turtlebot_create_desktop
uri: https://github.com/turtlebot/turtlebot_create_desktop.git
version: kinetic
- git:
local-name: turtlebot_interactions
uri: https://github.com/turtlebot/turtlebot_interactions.git
version: indigo
- git:
local-name: turtlebot_msgs
uri: https://github.com/turtlebot/turtlebot_msgs.git
version: indigo
- git:
local-name: turtlebot_simulator
uri: https://github.com/turtlebot/turtlebot_simulator.git
version: indigo
生成kobuki别名
$ rosrun kobuki_ftdi create_udev_rules
安装kinect驱动
$ sudo apt-get install ros-kinetic-openni-* ros-kinetic-openni2-* ros-kinetic-freenect-*
注意:(1)执行rosdep install --from-paths src -i -y时可能会出现权限问题,执行sudo chmod 777 -R ~/.ros/
(2)编译kobuki和turtlebot时编译会出错,可能时kinetic与indigo有不一样的地方把。仔细看问题所在的文件,发现问题文件有三个:
~/turtlebot/src/turtlebot_create_desktop/create_gazebo_plugins/src/gazebo_ros_create.cpp
~/kobuki/src/kobuki_desktop/kobuki_gazebo_plugins/src/gazebo_ros_kobuki_loads.cpp
~/kobuki/src/kobuki_desktop/kobuki_gazebo_plugins/src/gazebo_ros_kobuki_updates.cpp
这三个文件都是gazebo仿真用到的节点,心想我们是要连接实物,不需要方针,于是我把对应节点的CMakeLists.txt更改,不编译这三个节点,于是编译就顺利的通过了。(困扰了我一天,不得已为之)
 
6、turtlebot安装好了,把TX1与turtlebot连接,使用笔记本在远端控制turtlebot。
使用官网教程配置网络即可:http://wiki.ros.org/turtlebot/Tutorials/indigo/Network%20Configuration
之后在TX1上运行:
roslaunch turtlebot_bringup minimal.launch --screen
在远端电脑上运行:
roslaunch turtlebot_teleop keyboard_teleop.launch --screen
即可完成对turtlebot的控制。
 
注意:电脑与TX1一定要连接到同一个路由器上,不要连接到同一个交换机上,否则他们不在同一个网段上。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/30268.html