Ubuntu16.04 源码安装turtlebot

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/HERO_CJN/article/details/76281801

turtlebot 源码安装
在安装turtlebot之前本教程假定你已经正确安装了ros-kinetic-desktop-full

1 、安装准备

sudo apt-get install python-rosdep python-wstool ros-kinetic-ros 
sudo rosdep init 
rosdep update

注:rosdep init命令执行失败,无法找到源的错误修复
在一些arm平台上安装ros系统可能出现执行rosdep不成功的错误:
root@93885206a51a:/# rosdep init
ERROR: cannot download default sources list from:
https://raw.github.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
第一步:
sudo apt-get install ca-certificates -q
第二步:
sudo c_rehash /etc/ssl/certs
第三步:
sudo rosdep init
第四步:
rosdep update

2、源码编译安装

在用户主目录分别创建rocon、kobuki、turtlebot三个目录下载和编译源码

1>创建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

2>创建kobuki目录下载并编译源码
kobuki使用kinetic的版本下载会失败,先用indigo版本生成下载的rosinstall文件,再修改对应包为 kinetic版本

mkdir ~/kobuki 
cd ~/kobuki 
wget https://raw.github.com/yujinrobot/yujin_tools/master/rosinstalls/indigo/kobuki.rosinstall 
vim kobuki.rosinstall #参照kobuki.rosinstall文件内容,修改后在进行 
wstool init src -j5 kobuki.rosinstall 
source ~/rocon/devel/setup.bash 
rosdep install --from-paths src -i -y 
catkin_make

kobuki.rosinstall 文件为:

- git: {local-name: yocs_msgs, version: release/0.6-kinetic, uri: 'https://github.com/yujinrobot/yocs_msgs.git'}
- git: {local-name: yujin_ocs, version: kinetic, uri: 'https://github.com/yujinrobot/yujin_ocs.git'}
- git: {local-name: kobuki_msgs, version: kinetic, uri: 'https://github.com/yujinrobot/kobuki_msgs.git'}
- git: {local-name: kobuki_core, version: kinetic, uri: 'https://github.com/yujinrobot/kobuki_core.git'}
- git: {local-name: kobuki, version: kinetic, uri: 'https://github.com/yujinrobot/kobuki.git'}
- git: {local-name: kobuki_desktop, version: kinetic, uri: 'https://github.com/yujinrobot/kobuki_desktop.git'}

3>建立turtlebot目录,下载并编译
turtlebot使用kinetic的版本下载会失败,先用indigo版本生成下载的rosinstall文件,再修改对应包为kinetic版本,没有kinetic版本的保持为indigo版本

mkdir ~/turtlebot 
cd ~/turtlebot 
wget https://raw.github.com/yujinrobot/yujin_tools/master/rosinstalls/indigo/turtlebot.rosinstall 
vim turtlebot.rosinstall #参照turtlebot.rosinstall文件内容,修改后在进行。
wstool init src -j5 turtlebot.rosinstall 
source ~/kobuki/devel/setup.bash 
rosdep install --from-paths src -i -y 
catkin_make

turtlebot.rosinstall文件内容:

- git: {local-name: turtlebot_msgs, version: indigo, uri: 'https://github.com/turtlebot/turtlebot_msgs.git'}
- git: {local-name: turtlebot_create, version: indigo, uri: 'https://github.com/turtlebot/turtlebot_create.git'}
- git: {local-name: turtlebot, version: kinetic, uri: 'https://github.com/turtlebot/turtlebot.git'}
- git: {local-name: turtlebot_apps, version: indigo, uri: 'https://github.com/turtlebot/turtlebot_apps.git'}
- git: {local-name: turtlebot_interactions, version: indigo, uri: 'https://github.com/turtlebot/turtlebot_interactions.git'}
- git: {local-name: turtlebot_simulator, version: indigo, uri: 'https://github.com/turtlebot/turtlebot_simulator.git'}
- git: {local-name: turtlebot_create_desktop, version: kinetic, uri: 'https://github.com/turtlebot/turtlebot_create_desktop.git'}

3、生成kobuki别名

rosrun kobuki_ftdi create_udev_rules

4、配置网络并添加环境变量

turtlebot主机端

echo export ROS_MASTER_URI=http://IP_OF_TURTLEBOT:11311 >> ~/turtlebot/devel/setup.sh 
echo export ROS_HOSTNAME=IP_OF_TURTLEBOT >> ~/turtlebot/devel/setup.sh

添加配置脚本

vim ~/.bashrc 
在文件中添加: 
source /opt/ros/kinetic/setup.bash 
source ~/rocon/devel/setup.bash 
source ~/kobuki/devel/setup.bash 
source ~/turtlebot/devel/setup.bash

5、安装到ROS库文件中

1>

$ sudo su
$[sudo] password for <user>:

2>

$ source /home/<user>/<user_catkin_workspace>/devel/setup.bash

OR

$ source /opt/ros/<distro>/setup.bash

3>

catkin_make -DCMAKE_INSTALL_PREFIX=/opt/ros/<distro> install    
注:distro为ROS的发行版本
展开阅读全文

没有更多推荐了,返回首页