본문 바로가기

작업 일기

Ubuntu 20.04에 ROS Noetic 설치하기

 

- 개발환경 : Raspberry Pi 4B (Ubuntu 20.04)

- 참조 : http://wiki.ros.org/melodic/Installation/Ubuntu

 

Step1. Ubuntu 20.04설치

https://do-9un6.tistory.com/41 참고

 

 

Step2. ROS Noetic 설치

- Ubuntu 20.04에서 Ctrl+Alt+T를 눌러 터미널 창을 열어줍니다.

 

- Package.ros.org로부터 소프트웨어를 받아들일 수 있도록 PC를 세팅합니다.

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

 

- Keys를 설정합니다.

$ sudo apt install curl # if you haven't already installed curl
$ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

 

- 설치를 위해 Debian 패키지 목록을 최신화 합니다.

$ sudo apt update

 

- Ros noetic 설치 (아래의 코드 중 하나를 선택 / 필자는 Desktop-Full을 선택했습니다.)

Desktop-Full Install (Recommended) : ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators and 2D/3D perception

$ sudo apt install ros-noetic-desktop-full

Desktop Install : ROS, rqt, rviz, and robot-generic libraries

$ sudo apt install ros-noetic-desktop

ROS-Base: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.

$ sudo apt install ros-noetic-ros-base

 

- 새로운 셀을 실행할 때마다 ROS 환경 변수가 자동으로 추가되도록 설정합니다.

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

- 현재 셀의 환경만 바꾸고 싶으면 위 명령어 대신 아래의 명령어를 입력하면 됩니다.

$ source /opt/ros/noetic/setup.bash

 

 

- ROS 패키지 빌드에 필요한 의존 패키지를 설치합니다.

$ sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
$ sudo apt install python3-rosdep
$ sudo rosdep init
$ rosdep update

 

- Workspace를 생성 및 빌드를 실시합니다.

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make

 

- setup.bash

$ source devel/setup.bash

 

- 매번 setup.bash를 치기 귀찮을 때,

$ gedit ~/.bashrc

맨 밑에 아래의 글 추가
source ~/catkin_ws/devel/setup.bash