OS/Ubuntu

[ROS/ROS2] 0. 소개 및 설치

Auzii 2022. 2. 25. 15:47
300x250

 

귀찮은거 할 필요없이 이거로만 설치하기
[ Ubuntu 18.04 / Melodic 기준 ]
[ Ubuntu 20.04 / Foxy 기준 ]

Robot Operating System

 

ROS/ROS2란? melodic, foxy?

https://www.ros.org/

 

ROS: Home

It has been well over a year since we quietly rolled out the first rolling release for ROS 2 under the codename Rolling Ridley. For those of you who are still unfamiliar with our rolling release, it is our new approach to synchronizing and releasing code.

www.ros.org

ROS는 Robot Operating System의 약자로 다양한 OS에서 작동을 지원하지만, Ubuntu 환경에서 많이 사용된다. 다양한 소개글이 있기에 여기서는 쉽게 실무적인 부분 위주로 간단하게만 소개하겠다. ROS는 로봇/자율주행 연구에 특히 많이 사용되고 있는 플랫폼 시스템으로 UDP/TCP과 같은 통신 방법을 통해 여러 가지 역할들이 하나의 몸처럼 움직이게 해주는 것이다. 크게 WorkSpace > Package > Node > Topic & Message 처럼 생각하면 된다. 이에 대한 자세한 소개는 다음 장에서 다루도록 한다.

 

우선 버젼 별 소개는 링크를 참고하면 좋다. 여기서 ROS 버젼 순서는 A,B,C~~~Melodic, Noetic 으로 된다. 

http://wiki.ros.org/Distributions

 

Distributions - ROS Wiki

See Also: ROS/Installation Distributions (this page) Installation What is a Distribution? A ROS distribution is a versioned set of ROS packages. These are akin to Linux distributions (e.g. Ubuntu). The purpose of the ROS distributions is to let developers

wiki.ros.org

 

우분투 18.04에서는 ROS가 사용되며 Melodic이 가장 널리 사용된다. 하지만 Noetic으로 넘어가거나, 우분투 20.04의 Foxy 또는 Galatic 버젼이 떠오르고 있는 중이다. 이 후 ROS 관련된 정보 및 사용 방법들은 1, 2를 모두 소개하겠다. 완전한 해설들은 해주지 못하겠지만, 사용하는데 최대한 필요한 정보들을 잘 정리하도록 해보겠다. 궁금한 건 Google....

 


ROS 설치 

설치와 관련해서는 한 줄 설치 등 다양한 방법이 있지만, 꼭 그럴 필요 없이 아래 명령어를 통해 바로 설치 할 수 있다.

 

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
$ sudo apt install curl
$ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
$ sudo apt update
$ sudo apt install ros-melodic-desktop-full     // full을 통해서 모든 설치 진행

--------------------------추가---------------------------
$ sudo apt install ros-melodic-desktop          // 기본적인 라이브러리 설치 (rqt / rviz 등)
$ sudo apt install ros-melodic-ros-base         // 패키지, 빌드, 통신 라이브러리 정도만 포함
$ sudo apt install ros-melodic-{특정 패키지}   // 특정 패키지를 설치
[  $ apt search ros-melodic  을 통해 검색]
// ROS 패키지들을 빌드하기 위한 의존성 설치

$ sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
$ sudo apt install python-rosdep                 // ROS 도구를 사용하기 위해 Dep를 설치 및 초기화 해준다.
$ sudo rosdep init
$ rosdep update

 

※ 주의

  • software update 서버에 따라 안될수도 있으니 체크하기 (미국꺼는 무조건 가능)

ROS2 설치 

가장 좋은 것은 기본 docs를 보는 것이다.

https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Binary.html

 

Installing ROS 2 on Ubuntu Linux — ROS 2 Documentation: Foxy documentation

You're reading the documentation for an older, but still supported, version of ROS 2. For information on the latest version, please have a look at Galactic. Installing ROS 2 on Ubuntu Linux This page explains how to install ROS 2 on Ubuntu Linux from a pre

docs.ros.org

아래는 apt를 이용한 방법으로 순서대로만 따라 하면 된다.

$ sudo apt update && sudo apt install locales                      // locale 설정
$ sudo locale-gen en_US en_US.UTF-8
$ sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ sudo apt update && sudo apt install curl gnupg2 lsb-release
$ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
$ sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
$ sudo apt update
$ sudo apt install ros-foxy-desktop-full                     // ros-foxy-desktop로 해도 된다.
// 부가적으로 설치 하면 좋은 것들

$ sudo apt install -y python3-pip
$ pip3 install -U argcomplete
$ sudo apt install python3-colcon-common-extensions

 


환경 설정

 Ubuntu는 터미널을 열 때마다 .bashrc 의 설정이 적용된다. (.bashrc는 Home에 존재) 그러므로 이를 적용시켜서 매 터미널을 열때마다 적용할 필요없이 하는게 좋다.

 

$ sudo gedit ~/.bashrc                     // gedit이 안되면 nano 또는 vi를 이용하면 된다. 
.bashrc의 맨 아래 부분 (또는 source 있는 부분) 아래와 같이 입력하고, 저장

: source /opt/ros/melodic/setup.bash            //melodic
: source /opt/ros/foxy/setup.bash                 //foxy

 

ROS MASTER 네트워크 설정 등은 추가적인 것으로, 네트워크를 이용하면 다른 PC간 통신을 연결할 수 있다. 아래를 bashrc에 입력하면 된다. IP와 Address는 지정.

export ROS_MASTER_URI=http://{IP}:{Address}
export ROS_HOSTNAME={IP}

 

 


도움이 되는 다른 추천 사이트

https://durian9s-coding-tree.tistory.com/157

 

ROS란 / 왜 ROS를 배워야 하는가? / 다른 로봇 플랫폼은?

ROS란? 로봇 운영체제(ROS,Robot Operating System)는 로봇 응용 프로그램을 개발할 때 필요한 하드웨어 추상화, 하위 디바이스 제어, 일반적으로 사용되는 기능의 구현, 프로세스간의 메시지 패싱, 패키

durian9s-coding-tree.tistory.com

https://robertchoi.gitbook.io/ros/

 

ROS 하루에 입문하기 - ROS 하루에 입문하기

문서 작성을 위해서 최규남, 이상우, 성규현, 설윤호, 하희목, 하지현, 김영주님이 분담하여, 작성하였습니다.

robertchoi.gitbook.io

 

300x250

'OS > Ubuntu' 카테고리의 다른 글

[Ubuntu 18.04] 설치 방법 및 기본 요구 파일 설치 정리  (1) 2022.02.25