參考:
1.http://wiki.ros.org/indigo/Installation/Ubuntu
2.安裝出現依賴庫問題:
https://answers.ros.org/question/310473/ros-indigo-installation-dependency-issue/
首先看好自己的版本對應:(本人是Ubuntu14.04 對應的就是ROS Indigo)
step1:搜索Software&updates 使用清華的源文件
http://wiki.ros.org/ROS/Installation/UbuntuMirrors#Tsinghua_University
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
2.測試一下
(1)啟動一個終端
roscore
啟動服務。
(2)再啟動一個終端
rosrun turtlesim turtlesim_node __name:=my_turtle
(3)再再啟動一個終端,鍵盤控制turtlesim
rosrun turtlesim turtle_teleop_key
效果如圖:
鼠標必須放在第三個控制小烏龜運動的終端上才行