Ubuntu16.04下安装ROS教程及报错解决方法

2019-12-30 16:17:15 浏览数 (1)

1、设置sources.list

sudo sh <span class="token operator">-</span>c <span class="token string">'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'</span>

12

sudo sh <span class="token operator">-</span>c <span class="token string">'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'</span>

2、设置key(公钥已更新)

sudo apt<span class="token operator">-</span>key adv <span class="token operator">--</span>keyserver <span class="token string">'hkp://keyserver.ubuntu.com:80'</span> <span class="token operator">--</span>recv<span class="token operator">-</span>key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

12

sudo apt<span class="token operator">-</span>key adv <span class="token operator">--</span>keyserver <span class="token string">'hkp://keyserver.ubuntu.com:80'</span> <span class="token operator">--</span>recv<span class="token operator">-</span>key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

3、更新package

sudo apt<span class="token operator">-</span>get update

12

sudo apt<span class="token operator">-</span>get update

4、安装ROS kinetic完整版

sudo apt<span class="token operator">-</span>get install ros<span class="token operator">-</span>kinetic<span class="token operator">-</span>desktop<span class="token operator">-</span>full

12

sudo apt<span class="token operator">-</span>get install ros<span class="token operator">-</span>kinetic<span class="token operator">-</span>desktop<span class="token operator">-</span>full

5、初始化rosdep

注意:在使用ROS之前需要初始化rosdep

sudo rosdep init

12

sudo rosdep init

rosdep update

12

rosdep update

6、配置ROS环境

echo <span class="token string">"source /opt/ros/kinetic/setup.bash"</span> <span class="token operator">>></span> <span class="token operator">~</span><span class="token operator">/</span><span class="token punctuation">.</span>bashrc source <span class="token operator">~</span><span class="token operator">/</span><span class="token punctuation">.</span>bashrc

123

echo <span class="token string">"source /opt/ros/kinetic/setup.bash"</span> <span class="token operator">>></span> <span class="token operator">~</span><span class="token operator">/</span><span class="token punctuation">.</span>bashrcsource <span class="token operator">~</span><span class="token operator">/</span><span class="token punctuation">.</span>bashrc

7、安装依赖项

sudo apt<span class="token operator">-</span>get install python<span class="token operator">-</span>rosinstall python<span class="token operator">-</span>rosinstall<span class="token operator">-</span>generator python<span class="token operator">-</span>wstool build<span class="token operator">-</span>essential

12

sudo apt<span class="token operator">-</span>get install python<span class="token operator">-</span>rosinstall python<span class="token operator">-</span>rosinstall<span class="token operator">-</span>generator python<span class="token operator">-</span>wstool build<span class="token operator">-</span>essential

8、测试ROS是否安装成功

(1)、CTRL ALT T打开终端(Termial),输入以下命令,初始化ROS环境:

roscore

12

roscore

成功打开如下图所示:

上面显示有ROS的版本,还有一些节点、端号等内容。

(2)、再 打开一个新的终端(Termial),输入以下命令,弹出一个小乌龟窗口:

rosrun turtlesim turtlesim_node

12

rosrun turtlesim turtlesim_node

(3)、出现一个小乌龟的LOGO后,再 打开一个新的终端(Termial),输入以下命令

rosrun turtlesim turtle_teleop_key

123

rosrun turtlesim turtle_teleop_key

然后,通过方向键控制小乌龟的移动:如下图所示

(4)、 打开新的Termial,输入以下命令,可以查看ROS节点信息:

rosrun rqt_graph rqt_graph

12

rosrun rqt_graph rqt_graph

如果你能顺利进行到这一步,说明ROS安装成功了。

错误提示:

$ rosdep update If you get reading in sources list data from /etc/ros/rosdep/sources.list.d Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml]: <urlopen error timed out> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml) then you can execute the following command:

12345678

$ rosdep updateIf you getreading in sources list data from /etc/ros/rosdep/sources.list.dHit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yamlHit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yamlERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml]:<urlopen error timed out> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml)then you can execute the following command:

解决方法:

sudo gedit /etc/resolv.conf

1

sudo gedit /etc/resolv.conf

改成下面两句:

nameserver 8.8.8.8 #google域名服务器 nameserver 8.8.4.4 #google域名服务器

123

nameserver 8.8.8.8 #google域名服务器 nameserver 8.8.4.4 #google域名服务器

安装husky

1.How to install husky-simulator in kinetic ?

安装:

sudo apt-get install ros-Kinetic-husky-simulator

报错提示:E: 无法定位软件包 ros-Kinetic-husky-simulator

正确方法:Kinetic改为小写即可!

sudo apt-get install ros-kinetic-husky-simulator

errror:[test_rig3.launch] is neither a launch file in package [svo_ros] nor is [svo_ros] a launch file name The traceback for the exception was written to the log file

只需要回到上层进行source即可

$ cd ~/catkin_ws: $source devel/setup.bash

或者直接

source ~/catkin_ws/devel/setup.bash

环境变量需要重新设置下

3.启动 使用roslaunch启动husky模拟器,启动一个空的世界(任选其一即可,两个区别就是地图不一样):

roslaunch husky_gazebo husky_empty_world.launch(空地图启动) roslaunch gazebo_ros willowgarage_world.launch(默认地图启动)

123

roslaunch husky_gazebo husky_empty_world.launch(空地图启动) roslaunch gazebo_ros willowgarage_world.launch(默认地图启动)

bug描述:

VMware: vmw_ioctl_command error Invalid argument.

解决方式:设置环境变量

export SVGA_VGPU10=0 //临时处理方式,一次性的,下次重启还会同样报错

1

export SVGA_VGPU10=0 //临时处理方式,一次性的,下次重启还会同样报错

或者

echo "export SVGA_VGPU10=0" >> ~/.bashrc //中间俩转义符换成英文大于号>>,此方式为永久方式,会添加一条环境变量,重启后或者运行下面的语句生效 source ~/.bashrc

12

echo "export SVGA_VGPU10=0" >> ~/.bashrc //中间俩转义符换成英文大于号>>,此方式为永久方式,会添加一条环境变量,重启后或者运行下面的语句生效source ~/.bashrc

Download as PDF

0 人点赞