Ubuntu14.04安装 ROS 安装步骤和问题总结

时间:2023-12-05 17:12:14

参考:

1.http://wiki.ros.org/indigo/Installation/Ubuntu

2.安装出现依赖库问题:

https://answers.ros.org/question/310473/ros-indigo-installation-dependency-issue/

首先看好自己的版本对应:(本人是Ubuntu14.04 对应的就是ROS Indigo)

Ubuntu14.04安装 ROS  安装步骤和问题总结

step1:搜索Software&updates 使用清华的源文件

http://wiki.ros.org/ROS/Installation/UbuntuMirrors#Tsinghua_University

Ubuntu14.04安装 ROS  安装步骤和问题总结

STEP2

sudo apt-get update && sudo apt-get install dpkg

就是一般因为dpkg版本低

需要更新 否则出现依赖库问题:

所以这一步相当重要,曾经被卡过得难受的一、塌糊涂

 

可能错误点:

(一定要有此步,如果跳过将会出现依赖库错误,依赖库错误如下:

Reading package lists... Done

Building dependency tree       

Reading state information... Done

You might want to run 'apt-get -f install' to correct these:

The following packages have unmet dependencies:

 python-rosdep : Depends: python-rosdistro (>= 0.4.0) but it is not going to be installed

 ros-indigo-desktop-full : Depends: ros-indigo-desktop but it is not going to be installed

                           Depends: ros-indigo-perception but it is not going to be installed

                           Depends: ros-indigo-simulators but it is not going to be installed

                           Depends: ros-indigo-urdf-tutorial but it is not going to be installed

E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

 

 

此时如果按照他的提示使用apt-get -f install 会出现:

dpkg-deb: error: archive '/var/cache/apt/archives/python-rosdistro-modules_0.7.0-1_all.deb' has premature member 'control.tar.xz' before 'control.tar.gz', giving up

dpkg: error processing archive /var/cache/apt/archives/python-rosdistro-modules_0.7.0-1_all.deb (--unpack):

 subprocess dpkg-deb --control returned error exit status 2

dpkg-deb: error: archive '/var/cache/apt/archives/python-rosdistro_0.7.0-100_all.deb' has premature member 'control.tar.xz' before 'control.tar.gz', giving up

dpkg: error processing archive /var/cache/apt/archives/python-rosdistro_0.7.0-100_all.deb (--unpack):

 subprocess dpkg-deb --control returned error exit status 2

Errors were encountered while processing:

 /var/cache/apt/archives/python-rosdistro-modules_0.7.0-1_all.deb

 /var/cache/apt/archives/python-rosdistro_0.7.0-100_all.deb

E: Sub-process /usr/bin/dpkg returned an error code (1)

 

 

STEP3

设置url

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

设置key

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

STEP4设置完之后更新一下

sudo apt-get update

STEP5安装ROS(注意对应的版本)

sudo apt-get install ros-indigo-desktop-full

STEP6

初始化rosdep

sudo rosdep init

rosdep update

可能错误点:

这里的rosdep update 可能会显示错误:

reading in sources list data from /etc/ros/rosdep/sources.list.d

Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml

ERROR: error loading sources list:

The read operation timed out

网络问题,多尝试几次就ok了。或者换个网络。

STEP7设置环境变量

echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc

source ~/.bashrc

STEP8安装插件rosinsatll

sudo apt-get install python-rosinstall

STEP9测试ROS安装是否成功

1.启动ROS环境:

roscore

Ubuntu14.04安装 ROS  安装步骤和问题总结

2.测试一下

(1)启动一个终端

roscore

启动服务。

(2)再启动一个终端

rosrun turtlesim turtlesim_node __name:=my_turtle

(3)再再启动一个终端,键盘控制turtlesim

rosrun turtlesim turtle_teleop_key

效果如图:

Ubuntu14.04安装 ROS  安装步骤和问题总结

鼠标必须放在第三个控制小乌龟运动的终端上才行