ROS 설치
ROS Kinetic Kame은 공식적으로 Debian 리눅스와 Ubuntu 리눅스를 지원하며 본 문서에서는 Ubuntu 리눅스 환경에서 ROS를 설치한다고 가정한다. 또한 ROS Kinetic Kame 설치 시, 전체 설치 (Desktop Full Install) 방식(권장)과 일반 설치 (Desktop Install) 방식 중 하나를 선택할 수 있다.
ROS 설치 (terminal에서 다음 명령 실행)
# source list 추가
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) 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
# 패키지 인덱스 업데이트
$ sudo apt-get update
# 모든 패키지 업그레이드 (권장)
$ sudo apt-get upgrade
# 전체 설치
$ sudo apt-get install ros-kinetic-desktop-full
rosdep 초기화 & 업데이트
# rosdep 초기화 (ros package의 의존 패키지 설치를 위한 도구)
sooyoung@sooyoung-Laptop2015:~$ sudo rosdep init
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run
rosdep update
sooyoung@sooyoung-Laptop2015:~$ 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
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index.yaml
Add distro "groovy"
Add distro "hydro"
Add distro "indigo"
Add distro "jade"
Add distro "kinetic"
Add distro "lunar"
Add distro "melodic"
updated cache in /home/sooyoung/.ros/rosdep/sources.cache
sooyoung@sooyoung-Laptop2015:~$
참고: ros sources.list 내용 (/etc/ros/rosep/sources.list.d/20-default.list>
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
~
~
~
~
apt-get 명령어를 이용하여 ROS를 설치한 경우, ROS 명령어 사용이 가능하려면 setup 스크립트를 실행해 줘야 한다.
setup script 실행
# /opt/ros/kinetic/setup.sh 스크립트 실행
source /opt/ros/kinetic/setup.bash
터미널을 실행할 때마다 setup 명령을 호출하는 번거로움을 피하기 위해 다음 명령으로 bash shell이 실행될 때마다 자동으로 ROS 환경 설정이 이루어 지도록 한다.
.bashrc 파일에 ROS 환경 설정 스크립트 호출문 추가
# bash shell이 실행될 때마다 "setup.bash 파일이 실행되도록 저장
$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
# 현재 실행 중인 쉘 프로세스에 변경 내용 적용
$ source ~/.bashrc
toolchain 설치
# ROS workspace 생성 & 관리에 필요한 툴체인 설치
$ sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential python-catkin-tools