ROS-kinetic安裝
前言:雖然ROS已經(jīng)更新到了Melodic 版本(2018.5.23),因?yàn)槭切率謱W(xué)習(xí)肯定會(huì)遇到各種問(wèn)題,選一個(gè)舊一點(diǎn)使用比較多的容易找到問(wèn)題的答案脂凶,所以選擇了 Ubuntu16.04(這個(gè)在2018.1月份有過(guò)一次更新)贞绵。
一,設(shè)置源
? ? 我在安裝的時(shí)候遇到較多的這呀那呀的問(wèn)題大部分是網(wǎng)絡(luò)上找不到源的問(wèn)題御滩,這里先設(shè)置好缴川。
? ?1.備份系統(tǒng)自帶的源
????????sudo cp /etc/apt/sources.list?/etc/apt/sources.list.bak?
? ? 2.編輯源文件,將里面的內(nèi)容全刪除额湘,寫(xiě)入如下內(nèi)容(假如有更好的可以添加)
? ??????deb http://archive.ubuntu.com/ubuntu xenial main universe restricted multiverse
????????deb http://security.ubuntu.com/ubuntu/ xenial-security main restricted multiverse universe
????????deb http://archive.ubuntu.com/ubuntu xenial-updates main restricted multiverse universe
????????deb http://packages.ros.org/ros-shadow-fixed/ubuntu xenial main
? ? 3.更新生效
? ? ? ? sudo apt-get update
---- 下面開(kāi)始基本上可以參考官網(wǎng)的教程了 ----
二卿吐,開(kāi)始安裝ROS
1. 添加 ros 源(這步我在上一步已經(jīng)添加了所以這里不需要再添加,這里只是照搬官網(wǎng)的教程)
? ??sudo?sh?-c?'echo?"deb?http://packages.ros.org/ros/ubuntu?$(lsb_release?-sc)?main"?>?/etc/apt/sources.list.d/ros-latest.list'?
2.設(shè)置key
? ??sudo?apt-key?adv?--keyserver?hkp://ha.pool.sks-keyservers.net:80?--recv-key?421C365BD9FF1F717815A3895523BAEEB01FA116??
-- 如果無(wú)法連接服務(wù)器锋华,請(qǐng)將上面的 hkp:// .......:80 改為?hkp://pgp.mit.edu:80或者h(yuǎn)kp://keyserver.ubuntu.com:80 試試
? ? 3.再次更新package
? ? ????sudo apt-get update
? ? 4.這里安裝桌面完整版但两,當(dāng)然也可以按個(gè)別包來(lái)安裝,可參考官網(wǎng)
????????sudo?apt-get?install?ros-kinetic-desktop-full
? ? ? ? --- 如果這里有錯(cuò)誤請(qǐng)參考后面的錯(cuò)誤處理
? ? 5.查看可用安裝包
? ? ? ? apt-cache?search?ros-kinetic??
? ? 6.初始化rosdep (使用之前必須初始化)
????????sudo?rosdep?init?
? ??????rosdep?update?
7.配置環(huán)境
? ??echo?"source?/opt/ros/kinetic/setup.bash"?>>?~/.bashrc?
????source?~/.bashrc??
8.安裝building package?
? ??sudo?apt-get?install?python-rosinstall?python-rosinstall-generator?python-wstool?build-essential?
?9.測(cè)試 (打開(kāi)Termial供置,輸入以下命令谨湘,初始化ROS環(huán)境:)
????roscore
? ? (打開(kāi)新的Termial,輸入以下命令芥丧,彈出一個(gè)小烏龜窗口:)
????rosrun?turtlesim?turtlesim_node?
? ? (打開(kāi)新的Termial紧阔,輸入以下命令,可以在Termial中通過(guò)方向鍵控制小烏龜?shù)囊苿?dòng):)
????rosrun?turtlesim?turtle_teleop_key?? ??
? ? (打開(kāi)新的Termial续担,輸入以下命令擅耽,彈出新的窗口查看ROS節(jié)點(diǎn)信息:)
????rosrun?rqt_graph?rqt_graph??
------------------------- 錯(cuò)誤處理 -----------------
錯(cuò)誤1:rosdep init Error? 或 rosdep update Error?
錯(cuò)誤內(nèi)容:
????ERROR: default sources list file already exists:
????etc/ros/rosdep/sources.list.d/20-default.list
????Please delete if you wish to re-initialize
? ? 處理:?
????????sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
????????sudo apt-get update
????????sudo rosdep init
? ??????rosdep update
錯(cuò)誤內(nèi)容:
? ??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]: ????(https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml)
????then you can execute the following command:
? ? 處理:(同上處理過(guò)程)