본문 바로가기
  • 경제적 자유를 얻는 그날까지
엔지니어링/프로그래밍

Ubuntu 20.04에서 VSCode를 이용하여 ROS 개발환경 구축하기

by 베니스상인 2021. 8. 17.

1. ROS 플러그인 설치하기

 

Ctrl+Shift + X를 눌러 ros 를 검색하여 플러그인을 설치한다.

 

 

그리고 XML툴도 함께 설치한다.

 

 

vscode에서 Ctrl+,를 누르면 Setting을 할 수 있는 항목들의 검색창이 나타난다. ROS를 검색하여 자신에게 맞는 distro를 적어준다.

Ubuntu 20.04이면 noetic이므로 noetic 을 적어주면 된다.

 

그리고 ~/.bashrc에 아래와 같이 setup.bash를 추가한다.

source devel/setup.bash

 

mavros 관련 패키지들을 설치한다.

 

swift@swift-HP-Pavilion-dv6-Notebook-PC:~$ sudo apt-get install ros-noetic-mav*
[sudo] password for swift: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'ros-noetic-mavros' for glob 'ros-noetic-mav*'
Note, selecting 'ros-noetic-mavros-msgs' for glob 'ros-noetic-mav*'
Note, selecting 'ros-noetic-mavlink' for glob 'ros-noetic-mav*'
Note, selecting 'ros-noetic-mavros-extras-dbgsym' for glob 'ros-noetic-mav*'
Note, selecting 'ros-noetic-mavros-extras' for glob 'ros-noetic-mav*'
Note, selecting 'ros-noetic-mavros-dbgsym' for glob 'ros-noetic-mav*'
The following package was automatically installed and is no longer required:
  libllvm11
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  geographiclib-tools libgeographic-dev libgeographic19
  ros-noetic-geographic-msgs ros-noetic-libmavconn ros-noetic-uuid-msgs
Suggested packages:
  geographiclib-doc
The following NEW packages will be installed:
  geographiclib-tools libgeographic-dev libgeographic19
  ros-noetic-geographic-msgs ros-noetic-libmavconn ros-noetic-mavlink
  ros-noetic-mavros ros-noetic-mavros-dbgsym ros-noetic-mavros-extras
  ros-noetic-mavros-extras-dbgsym ros-noetic-mavros-msgs ros-noetic-uuid-msgs
0 upgraded, 12 newly installed, 0 to remove and 24 not upgraded.
Need to get 53.6 MB of archives.
After this operation, 89.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://packages.ros.org/ros/ubuntu focal/main amd64 ros-noetic-uuid-msgs amd64 1.0.6-1focal.20210423.224434 [11.9 kB]
Get:2 http://kr.archive.ubuntu.com/ubuntu focal/universe amd64 libgeographic19 amd64 1.50.1-1build1 [243 kB]
Get:3 http://packages.ros.org/ros/ubuntu focal/main amd64 ros-noetic-geographic-msgs amd64 0.5.6-1focal.20210605.000032 [72.0 kB]
Get:4 http://packages.ros.org/ros/ubuntu focal/main amd64 ros-noetic-mavlink amd64 2021.8.8-1focal.20210809.125654 [806 kB]
Get:5 http://kr.archive.ubuntu.com/ubuntu focal/universe amd64 geographiclib-tools amd64 1.50.1-1build1 [179 kB]
Get:6 http://kr.archive.ubuntu.com/ubuntu focal/universe amd64 libgeographic-dev amd64 1.50.1-1build1 [392 kB]
Get:7 http://packages.ros.org/ros/ubuntu focal/main amd64 ros-noetic-libmavconn amd64 1.8.0-1focal.20210809.130011 [144 kB]
Get:8 http://packages.ros.org/ros/ubuntu focal/main amd64 ros-noetic-mavros-msgs amd64 1.8.0-1focal.20210727.071620 [334 kB]
Get:9 http://packages.ros.org/ros/ubuntu focal/main amd64 ros-noetic-mavros amd64 1.8.0-1focal.20210809.130558 [882 kB]
Get:10 http://packages.ros.org/ros/ubuntu focal/main amd64 ros-noetic-mavros-dbgsym amd64 1.8.0-1focal.20210809.130558 [31.0 MB]
Get:11 http://packages.ros.org/ros/ubuntu focal/main amd64 ros-noetic-mavros-extras amd64 1.8.0-1focal.20210809.131659 [361 kB]
Get:12 http://packages.ros.org/ros/ubuntu focal/main amd64 ros-noetic-mavros-extras-dbgsym amd64 1.8.0-1focal.20210809.131659 [19.2 MB]
Fetched 53.6 MB in 1min 22s (652 kB/s)                                         
Selecting previously unselected package libgeographic19:amd64.
(Reading database ... 285184 files and directories currently installed.)
Preparing to unpack .../00-libgeographic19_1.50.1-1build1_amd64.deb ...
Unpacking libgeographic19:amd64 (1.50.1-1build1) ...
Selecting previously unselected package geographiclib-tools.
Preparing to unpack .../01-geographiclib-tools_1.50.1-1build1_amd64.deb ...
Unpacking geographiclib-tools (1.50.1-1build1) ...
Selecting previously unselected package libgeographic-dev.
Preparing to unpack .../02-libgeographic-dev_1.50.1-1build1_amd64.deb ...
Unpacking libgeographic-dev (1.50.1-1build1) ...
Selecting previously unselected package ros-noetic-uuid-msgs.
Preparing to unpack .../03-ros-noetic-uuid-msgs_1.0.6-1focal.20210423.224434_amd64.deb ...
Unpacking ros-noetic-uuid-msgs (1.0.6-1focal.20210423.224434) ...
Selecting previously unselected package ros-noetic-geographic-msgs.
Preparing to unpack .../04-ros-noetic-geographic-msgs_0.5.6-1focal.20210605.000032_amd64.deb ...
Unpacking ros-noetic-geographic-msgs (0.5.6-1focal.20210605.000032) ...
Selecting previously unselected package ros-noetic-mavlink.
Preparing to unpack .../05-ros-noetic-mavlink_2021.8.8-1focal.20210809.125654_amd64.deb ...
Unpacking ros-noetic-mavlink (2021.8.8-1focal.20210809.125654) ...
Selecting previously unselected package ros-noetic-libmavconn.
Preparing to unpack .../06-ros-noetic-libmavconn_1.8.0-1focal.20210809.130011_amd64.deb ...
Unpacking ros-noetic-libmavconn (1.8.0-1focal.20210809.130011) ...
Selecting previously unselected package ros-noetic-mavros-msgs.
Preparing to unpack .../07-ros-noetic-mavros-msgs_1.8.0-1focal.20210727.071620_amd64.deb ...
Unpacking ros-noetic-mavros-msgs (1.8.0-1focal.20210727.071620) ...
Selecting previously unselected package ros-noetic-mavros.
Preparing to unpack .../08-ros-noetic-mavros_1.8.0-1focal.20210809.130558_amd64.deb ...
Unpacking ros-noetic-mavros (1.8.0-1focal.20210809.130558) ...
Selecting previously unselected package ros-noetic-mavros-dbgsym.
Preparing to unpack .../09-ros-noetic-mavros-dbgsym_1.8.0-1focal.20210809.130558_amd64.deb ...
Unpacking ros-noetic-mavros-dbgsym (1.8.0-1focal.20210809.130558) ...
Selecting previously unselected package ros-noetic-mavros-extras.
Preparing to unpack .../10-ros-noetic-mavros-extras_1.8.0-1focal.20210809.131659_amd64.deb ...
Unpacking ros-noetic-mavros-extras (1.8.0-1focal.20210809.131659) ...
Selecting previously unselected package ros-noetic-mavros-extras-dbgsym.
Preparing to unpack .../11-ros-noetic-mavros-extras-dbgsym_1.8.0-1focal.20210809.131659_amd64.deb ...
Unpacking ros-noetic-mavros-extras-dbgsym (1.8.0-1focal.20210809.131659) ...
Setting up libgeographic19:amd64 (1.50.1-1build1) ...
Setting up ros-noetic-uuid-msgs (1.0.6-1focal.20210423.224434) ...
Setting up ros-noetic-mavlink (2021.8.8-1focal.20210809.125654) ...
Setting up ros-noetic-libmavconn (1.8.0-1focal.20210809.130011) ...
Setting up geographiclib-tools (1.50.1-1build1) ...
Setting up libgeographic-dev (1.50.1-1build1) ...
Setting up ros-noetic-geographic-msgs (0.5.6-1focal.20210605.000032) ...
Setting up ros-noetic-mavros-msgs (1.8.0-1focal.20210727.071620) ...
Setting up ros-noetic-mavros (1.8.0-1focal.20210809.130558) ...
Setting up ros-noetic-mavros-extras (1.8.0-1focal.20210809.131659) ...
Setting up ros-noetic-mavros-dbgsym (1.8.0-1focal.20210809.130558) ...
Setting up ros-noetic-mavros-extras-dbgsym (1.8.0-1focal.20210809.131659) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
swift@swift-HP-Pavilion-dv6-Notebook-PC:~$ 

 

 

터미널 창을 열어서 catkin_make를 실행하면 정상적으로 컴파일 되는 것을 확인할 수 있다.

728x90

댓글