본문 바로가기

작업 일기

Ubuntu 18.04에 ROS melodic 설치하기

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

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

 

Step1. Ubuntu 18.04 설치

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

 

 

Step2. ROS melodic 설치

- Ubuntu 18.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 melodic 설치 (아래의 코드 중 하나를 선택 / 필자는 Desktop-Full을 선택했습니다.)

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

$ sudo apt install ros-melodic-desktop-full

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

$ sudo apt install ros-melodic-desktop

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

$ sudo apt install ros-melodic-ros-base

 

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

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

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

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

 

 

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

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

 

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

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

 

- Python 3 

$ catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3
더보기

cmake error 발생시

$ sudo apt-get install python3-pip python3-yaml
$ sudo pip3 install rospkg catkin_pkg
$ catkin_make

 

- setup.bash

$ source devel/setup.bash

 

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

$ gedit ~/.bashrc

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

 

 

 

 

※ 에러

E: Could not get lock /var/lib/dpkg/lock-fronted - open (11: Resource temporarily unavailalbe)

E: Unable to acquire the dpkg fronted lock (/var/lib/dpkg/lock-fronted), is another process using it?

#해결법
$ sudo killall apt apt-get

$ sudo rm /var/lib/apt/lists/lock
$ sudo rm /var/cache/apt/archives/lock
$ sudo rm /var/lib/dpkg/lock*

$ sudo dpkg --configure -a

$ sudo apt update

 

* cmake error 발생 시

더보기
닫기

https://github.com/tu-darmstadt-ros-pkg/hector_slam/tree/melodic-devel 에서 파일 다운로드 후,

~/catkin_ws/src 폴더로 이동

 

CMake Error at /usr/share/cmake-3.10/Modules/FindQt4.cmake:1320 (message):
  Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x 에러 발생 시,

$ sudo apt install qt4-default

 

No module named 'em' 에러 발생 시,

$ pip3 install empy