1. 개발 환경
이번 ROS 2 강좌는 리눅스 민트 20.x를 기본 운영 체제로 사용하고, ROS는 ROS 2 Humble Hawksbill 을 사용하도록 한다. 그 이외에 개발 환경은 다음과 같다. 이는 최저 사양이고 이 이상의 버전을 사용하는 경우도 있음을 미리 밝혀둔다. ROS 2 릴리즈별 정보 및 개발 환경에 대한 더 자세한 내용은 참고 자료 [4]를 참고하도록 하자.
구분
|
추천
|
|
기본 운영 체제
|
Linux Mint 21.1
|
|
로봇 운영 체제
|
ROS 2 Humble Hawksbill
|
|
컴퓨터 아키텍처
|
amd64
|
|
통합 개발 환경 (IDE)
|
Visual Studio Code
|
|
프로그래밍 언어
|
Python 3 (3.8.0), C++ 14
|
|
시뮬레이터
|
Gazebo 11.x
|
|
DDS
|
Fast DDS
|
|
기타
|
CMake 3.16.3, Qt 5.12.5, OpenCV 4.2.0
|
참고설명
리눅스를 설치할 때 기본 언어를 한글로 설치하는 분들이 있는데 `English`로 설치 하시기를 강력히 추천한다. 한글로 설치하면 터미널에서 명령어를 이용할 때와 빌드할 때 한글로 에러가 표시된다. 그러면 구글링 이나 stackoverflow 에서 답변 검색할 때 당혹감을 감출 수 없을 것이다. 꼭 `English`로 설치하자.
참고설명
ROS가 다양한 운영체제와 도커 개발 환경을 지원하고 있지만 개발 환경의 기본은 리눅스 환경이다. macOS, Windows에서 개발하는 것은 가능은 하지만 처음 ROS를 사용하고 익히는 입장이라면 아무래도 가장 많은 개발자 및 유저들이 사용하는 리눅스 환경이 안정적이고 문제가 적다. 그리고 가상머신 및 도커를 이용한 컨테이너 이용은 리소스적인 면과 디바이스 연결면에서 개인적으로 추천하지 않는다.
3. 로봇 운영 체제 설치
ROS 2 Humble Hawksbill 설치 방법에는 1) 소스 빌드[7], 2) 미리 빌드된 파일 사용[8], 3) 데비안 패키지 사용[9]과 같이 3가지 방법이 있다. 제일 간단한 방법은 데비안 패키지를 이용하는 것으로 업데이트가 비교적 간단하기에 이 방법을 추천한다. 설치는 아래 링크의 공식 설치 메뉴얼대로 설치해도 되는데 이 강좌에는 이를 요약하여 명령어만 나열하여 기록해두니 참고하도록 하자.
* Installing ROS 2 via Debian Packages
sudo apt update && sudo apt install locales
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 install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
3) Install development tools and ROS tools
(1) Install common packages
sudo apt update && sudo apt install -y \
python3-flake8-docstrings \
python3-pip \
python3-pytest-cov \
ros-dev-tools
(2) Install packages according to your Ubuntu version.
sudo apt install -y \
python3-flake8-blind-except \
python3-flake8-builtins \
python3-flake8-class-newline \
python3-flake8-comprehensions \
python3-flake8-deprecated \
python3-flake8-import-order \
python3-flake8-quotes \
python3-pytest-repeat \
python3-pytest-rerunfailures
4) ROS 2 패키지 설치
sudo apt update
sudo apt upgrade
# ros2 humble desktop 설치 오류 시 여러번 재 입력하면 정상 설치
sudo apt install ros-humble-desktop
sudo apt install ros-humble-ros-base
sudo apt install ros-dev-tools
5) ROS 2 패키지 설치 확인
문제없이 설치되었다면 하기와 같이 두 터미널 창에서 ROS 2의 기본적인 퍼블리시와 서브스크라이브 동작을 확인 가능하다.
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talker
[INFO] [1612912263.574031946] [talker]: Publishing: 'Hello World: 1'
[INFO] [1612912264.574010597] [talker]: Publishing: 'Hello World: 2'
[INFO] [1612912265.574381893] [talker]: Publishing: 'Hello World: 3'
[INFO] [1612912266.574508130] [talker]: Publishing: 'Hello World: 4'
[INFO] [1612912267.574615200] [talker]: Publishing: 'Hello World: 5'
[INFO] [1612912268.574767202] [talker]: Publishing: 'Hello World: 6'
[INFO] [1612912269.574953419] [talker]: Publishing: 'Hello World: 7' ...
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_py listener
[INFO] [1612912265.593335793] [listener]: I heard: [Hello World: 3]
[INFO] [1612912266.576514520] [listener]: I heard: [Hello World: 4]
[INFO] [1612912267.576780341] [listener]: I heard: [Hello World: 5]
[INFO] [1612912268.576769156] [listener]: I heard: [Hello World: 6]
[INFO] [1612912269.577142775] [listener]: I heard: [Hello World: 7] ...
4. ROS 개발 툴 설치
하기의 소프트웨어는 ROS 2를 이용한 로봇 프로그래밍에 필수인 소프트웨어 모음이다. 개발 환경 설치시에 반드시 미리 설치해두도록 하자.
sudo apt update && sudo apt install -y build-essential cmake git libbullet-dev python3-colcon-common-extensions python3-flake8 python3-pip python3-pytest-cov python3-rosdep python3-setuptools python3-vcstool wget
python3 -m pip install -U argcomplete flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-import-order flake8-quotes pytest-repeat pytest-rerunfailures pytest
sudo apt install --no-install-recommends -y libasio-dev libtinyxml2-dev libcunit1-dev
5. ROS 2 빌드 테스트
ROS 2 Humble Hawsbill 설치를 마쳤으면 하기와 같이 'robot_ws' 이라는 이름으로 워크스페이스 폴더를 생성한 후 빌드를 해보자. 참고로 'robot_ws' 이름 대신에 원하는 이름이 있다면 마음껏 변경이 가능하고 아래 빌드는 워크스페이스에 패키지가 하나도 없기에 무엇인가를 빌드하는 것이 아닌 환경 셋팅을 하고 ROS 2 설치가 잘 되어 빌드에 문제가 없는지 알아보는 과정이다.
source /opt/ros/humble/setup.bash
mkdir -p ~/robot_ws/src
cd ~/robot_ws/
# 아래 코드는 ros2 humble install instruction(Get ROS 2 code)
vcs import --input https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos src
colcon build --symlink-install
위 과정대로 진행하여 환경 설정 및 빌드에 문제가 없었다면 워크스페이스 폴더의 하위 폴더로 src 이외에도 build, install, log 폴더가 생성되는 것을 확인할 수 있을 것이다.
Install dependencies using rosdep
- ROS 2 packages are built on frequently updated Ubuntu systems. It is always recommended that you ensure your system is up to date before installing new packages.
sudo apt upgrade
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers"
- Note: If you’re using a distribution that is based on Ubuntu (like Linux Mint) but does not identify itself as such, you’ll get an error message like Unsupported OS [mint]. In this case append --os=ubuntu:jammy to the above command.
6. Run commands 설정
위 `3. 로봇 운영 체제 설치`에서 `ROS 2` 설치 이후에 `source /opt/ros/humble/setup.bash` 를 설정 한 후, talker 노드 및 listener 노드를 실행하였는데 `source /opt/ros/humble/setup.bash` 와 같은 환경 설정을 매번 불러오기란 매우 귀찮을 수 있다. 이에 하기와 같이 Run commands(rc)를 모아두는 bashrc 파일에 많이 사용되는 alias, source, export 을 설정해두면 ROS 2 개발 및 사용에 있어서 매우 편리하다.
nano ~/.bashrc
# OR
vim ~/.bashrc
# OR
xed ~/.bashrc
bashrc 파일을 편집할 때에는 nano, vim, xed 등 원하는 편집기를 사용하면 되고 bashrc 파일의 기존 내용은 그대로 두고 맨 아래에 하기 설정들을 추가해주면 된다.
source /opt/ros/humble/setup.bash
source ~/robot_ws/install/local_setup.bash
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash
source /usr/share/vcstool-completion/vcs.bash
source /usr/share/colcon_cd/function/colcon_cd.sh
export _colcon_cd_root=~/robot_ws
export ROS_DOMAIN_ID=7
export ROS_NAMESPACE=robot1
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
# export RMW_IMPLEMENTATION=rmw_connext_cpp
# export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# export RMW_IMPLEMENTATION=rmw_gurumdds_cpp
# export RCUTILS_CONSOLE_OUTPUT_FORMAT='[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})'
export RCUTILS_CONSOLE_OUTPUT_FORMAT='[{severity}]: {message}'
export RCUTILS_COLORIZED_OUTPUT=1
export RCUTILS_LOGGING_USE_STDOUT=0
export RCUTILS_LOGGING_BUFFERED_STREAM=1
alias cw='cd ~/robot_ws'
alias cs='cd ~/robot_ws/src'
alias ccd='colcon_cd'
alias eb='gedit ~/.bashrc'
alias sb='source ~/.bashrc'
alias roshumble='source /opt/ros/humble/setup.bash && source ~/gcamp_ros2_ws/install/local_setup.bash'
alias cb='cd ~/robot_ws && colcon build --symlink-install'
alias cbs='colcon build --symlink-install'
alias cbp='colcon build --symlink-install --packages-select'
alias cbu='colcon build --symlink-install --packages-up-to'
alias ct='colcon test'
alias ctp='colcon test --packages-select'
alias ctr='colcon test-result'
alias rt='ros2 topic list'
alias re='ros2 topic echo'
alias rn='ros2 node list'
alias killgazebo='killall -9 gazebo & killall -9 gzserver & killall -9 gzclient'
alias af='ament_flake8'
alias ac='ament_cpplint'
alias testpub='ros2 run demo_nodes_cpp talker'
alias testsub='ros2 run demo_nodes_cpp listener'
alias testpubimg='ros2 run image_tools cam2image'
alias testsubimg='ros2 run image_tools showimage'
설정들을 추가해 준 후, 터미널을 껏다 켜고 alias 로 설정해둔 cb를 이용해 워크스페이스에 colcon을 통한 빌드를 진행한다.
Summary: 343 packages finished [30min 4s]
97 packages had stderr output: action_tutorials_py ament_clang_format ament_clang_tidy ament_copyright ament_cppcheck ament_cpplint ament_flake8 ament_index_python ament_lint ament_lint_cmake ament_mypy ament_package ament_pclint ament_pep257 ament_pycodestyle ament_pyflakes ament_uncrustify ament_xmllint demo_nodes_py domain_coordinator examples_rclpy_executors examples_rclpy_guard_conditions examples_rclpy_minimal_action_client examples_rclpy_minimal_action_server examples_rclpy_minimal_client examples_rclpy_minimal_publisher examples_rclpy_minimal_service examples_rclpy_minimal_subscriber examples_rclpy_pointcloud_publisher examples_tf2_py google_benchmark_vendor iceoryx_posh launch launch_pytest launch_ros launch_testing launch_testing_examples launch_testing_ros launch_xml launch_yaml libyaml_vendor lifecycle_py mimick_vendor osrf_pycommon qt_gui_cpp quality_of_service_demo_py rmw_connextdds_common ros2action ros2bag ros2cli ros2component ros2doctor ros2interface ros2launch ros2lifecycle ros2multicast ros2node ros2param ros2pkg ros2run ros2service ros2test ros2topic ros2trace rosidl_cli rosidl_runtime_py rpyutils rqt rqt_action rqt_bag rqt_bag_plugins rqt_console rqt_graph rqt_gui rqt_gui_py rqt_msg rqt_plot rqt_publisher rqt_py_console rqt_reconfigure rqt_service_caller rqt_shell rqt_srv rqt_topic rti_connext_dds_cmake_module sensor_msgs_py sros2 test_launch_ros test_tracetools_launch tf2_ros_py tf2_tools topic_monitor tracetools_launch tracetools_read tracetools_test tracetools_trace zstd_vendor
7. 통합 개발 환경 (IDE) 설치
ROS 2 개발 환경에서 IDE는 Visual Studio Code (이하 VSCode)를 추천한다. VSCode는 Linux, Windows, macOS와 같이 다양한 운영체제를 지원하는 크로스 플랫폼 에디터이고 다양한 프로그래밍 언어를 지원하고 있다. 그리고 32비트 계열은 물론 amd64, arm64를 지원하고 있어서 ARM 계열의 임베디드 보드에서도 사용 가능하다. 더불어 텍스트 에디터 형태로 매우 가벼우면서 IntelliSense와 Git 기능과 같은 다양한 기능을 확장(extension) 기능으로 제공하고 있다. ROS를 지원하는 IDE 중 한가지를 더 추천하자면 QtCreator이다. QtCreator는 ROS 2의 RQt의 Plugin 개발에 UI 작성할 때 편리하기에 서브로 사용하면 좋을 듯싶다.
7.1 Visual Studio Code
이하 내용은 ROS 2 개발 환경 구축을 위한 IDE 설정 및 사용법으로 VSCode의 설치, 실행, 확장 기능 설치, 개발 환경 설정을 다룬다. 특히 프로그래밍 개발에는 프로그래밍 언어별 소스 코드의 구문 강조 및 자동 완성, 점프 기능 등이 매우 중요하기에 이를 위한 IntelliSense [24]를 설정하는 방법과 사용하는 방법에 대해 알아보고 추가로 디버깅 설정 및 사용법을 설명할 것이다. VSCode 환경에서의 디버깅 툴로 C++의 경우 GDB[12], Python의 경우 debugpy[13]를 사용하고 있다. ROS 커뮤니티에서는 VSCode 개발 환경을 위한 확장[14]~[16]들과 VSCode를 이용한 다양한 사용 방법[17]~[20]들을 공개하고 있기에 참고하도록 하자.
1) 설치
VSCode 설치는 하기 링크[11]에서 '.deb'의 데비안 설치 파일을 받아 설치하면 된다.
* Download Visual Studio Code
https://code.visualstudio.com/Download
code
3) 확장 설치
- Extensions (`Ctrl + Shift + x`)으로 이동
- 아래의 C/C++/Python/ROS/File Format/유용한 Extensions 추가
* C/C++/Python Extensions (VS Code Extensions for C++ and Python)
이름
|
코드명
|
설명
|
C/C++
|
|
C/C ++ IntelliSense, 디버깅 및 코드 검색
|
CMake
|
|
CMake 언어 지원
|
CMake Tools
|
|
CMake 언어 지원 및 다양한 툴
|
Python
|
|
린팅, 디버깅, Intellisense, 코드 서식 지정, 리팩토링, 단위 테스트 등
|
* ROS Extensions (VS Code Extensions for ROS, URDF, Colcon)
이름
|
코드명
|
설명
|
ROS
|
|
ROS 개발 지원
|
URDF
|
|
URDF/xacro 지원
|
Colcon Tasks
|
|
Colcon 명령어를 위한 VSCode Task
|
* File Format Extensions (VS Code Extensions for XML, YAML, Markdown)
이름
|
코드명
|
설명
|
XML Tools
|
|
XML, XQuery, XPath 지원
|
YAML
|
|
YAML 지원
|
Markdown All in One
|
|
Markdown 지원
|
* 유용한 Extensions (VS Code Extensions for Etc.)
이름
|
코드명
|
설명
|
Highlight Trailing White Spaces
|
|
의미 없이 사용된 공백의 스페이스 문자 강조
|
EOF Mark
|
|
[EOF]이 없이 끝난 파일에 [EOF] 문자 추가
|
Better Comments
|
|
alert, informational, TODO 등의 코멘트 강화 기능
|
* 기타 추천 Extensions
- ms-azuretools.vscode-docker
- ms-vscode-remote.remote-ssh
- ms-vscode-remote.remote-ssh-edit
- ms-vscode-remote.remote-containers
- ms-python.vscode-pylance
- ms-toolsai.jupyter
- dbaeumer.vscode-eslint
- uctakeoff.vscode-counter
- vscode-icons-team.vscode-icons
* 사용하고 계신 VSCode의 Extensions 중에 추천 할만한 것이 있다면 댓글로 공유 부탁드려요. ^^
4) 워크스페이스 설정
- "File" > "Add Folder to Workspace..." 메뉴 선택
- "robot_ws" 폴더 선택
5) VSCode의 개발 환경 설정
하기의 6 ~ 9과정은 VSCode의 개발 환경 설정이다. 이 설정 과정에서 settings.json / c_cpp_properties.json / tasks.json / launch.json 파일을 사용하는데 없다면 다음 위치에 생성해주도록 하자. 참고로 리눅스에서 '.' 이 접두어로 붙은 폴더 및 파일은 숨겨져 있는 폴더나 파일임을 기억하자.
~/.config/Code/User/settings.json
~/robot_ws/.vscode/c_cpp_properties.json
~/robot_ws/.vscode/tasks.json
~/robot_ws/.vscode/launch.json
6) User settings 설정
'settings.json'은 VSCode의 사용자별 글로벌 환경 설정을 지정하는 파일이다. 이 파일에 기술된 설정들은 모든 작업 공간(workspace)에서 적용된다. 예를 들어, 미니맵 사용, 세로 제한 줄 표시, 탭 사이즈 등 이다.
ROS와 관련된 설정은 아래 3가지 정도로 'ms-iot.vscode-ros'의 '"ros.distro": "humble"과 같이 ROS 버전을 지정하고, 'deitry.colcon-helper'의 '"colcon.provideTasks": true'와 같이 colcon이 지원되는 Task를 사용한다는 의미로 지정한다. 그리고 "files.associations"을 통해 확장자로 알 수 없는 *.repos, *.world, *.xacro 와 같이 ROS에서만 사용되는 파일명을 파일 형식이 무엇인지 명시해주는 설정을 하게된다.
"ros.distro": "humble",
"colcon.provideTasks": true,
"files.associations": {
"*.repos": "yaml",
"*.world": "xml",
"*.xacro": "xml"
},
User settings 설정의 전문은 아래와 같다. ~/.config/Code/User/ 에 위치한 settings.json 에 다음과 같이 설정하면 된다. 물론 본인이 즐겨사용하는 설정이 있다면 함께 적어주면 된다.
settings.json
~/.config/Code/User/settings.json
{
"cmake.configureOnOpen": false,
"editor.minimap.enabled": false,
"editor.mouseWheelZoom": true,
"editor.renderControlCharacters": true,
"editor.rulers": [100],
"editor.tabSize": 2,
"files.associations": {
"*.repos": "yaml",
"*.world": "xml",
"*.xacro": "xml"
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.scrollback": 1000000,
"workbench.iconTheme": "vscode-icons",
"workbench.editor.pinnedTabSizing": "compact",
"ros.distro": "humble",
"colcon.provideTasks": true
}
7) C/C++ properties 설정
C/C++ 관련 설정이다. 현재 지정한 작업 공간 (여기서는 ~/robot_ws)의 운영체제는 무엇인지, include 폴더의 경로는 어떻게 되는지, C/C++ 규칙은 어떤 표준을 기준을 사용할지의 여부, 컴파일의 경로, intelliSense[24] 모드 등을 설정하게 된다.
~/robot_ws/.vscode/c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${default}",
"${workspaceFolder}/**",
"/opt/ros/humble/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c99",
"cppStandard": "c++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
8) Tasks 설정
VSCode에서는 외부 프로그램을 Command Line Interface (CLI) 을 통해 연동하게 하는 기능이 있는데 이를 Task [25]라고 한다. 단순한 텍스트 에디터 기능이 기본인 VSCode가 다양한 기능을 수행하고 쉽게 기능 확장을 사용할 수 있게 된 것도 이 Task 기능이 있었기 때문이다.
아래의 내용은 ROS 2에서 빌드할 때 사용되는 colcon과 관려한 build, test, clean 작업을 Task로 만들었다. 이를 통해 VScode에서 `Ctrl + Shift + b`로 빌드할 수 있고 아래와 같이 기본 설정 이외의 Task도 실행할 수 있다.
- `Ctrl + Shift + p` > Tasks: Run Task > 지정한 Task 선택
~/robot_ws/.vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "colcon: build",
"type": "shell",
"command": "colcon build --cmake-args '-DCMAKE_BUILD_TYPE=Debug'",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "colcon: test",
"type": "shell",
"command": "colcon test && colcon test-result"
},
{
"label": "colcon: clean",
"type": "shell",
"command": "rm -rf build install log"
}
]
}
9) Launch 설정
VSCode에서의 Launch는 'Run and Debug' (`Ctrl + Shift + d`)에서 사용되는 실행 명령어로 언어별, 디버거별로 설정이 가능하고 세부 옵션으로 Launch가 실행되기 전 즉 디버깅하기 전에 사용할 Task를 지정하거나 콘솔 기능을 설정할 수도 있다.
여기서는 ROS 2에서 많이 사용되는 Python과 C++ 언어에 맞추어 VSCode의 디버깅 툴을 지정하였다. C++의 경우 GDB[12], Python의 경우 debugpy[13]으로 설정하였고 Python의 경우 별도 빌드 없이 디버깅하도록 하였고, C++의 경우에는 GDB를 실행하기 전에 colcon build 를 수행하도록 하였다.
~/robot_ws/.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug-rclpy(debugpy)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Debug-rclcpp(gbd)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/install/${input:package}/lib/${input:package}/${input:node}",
"args": [],
"preLaunchTask": "colcon: build",
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
],
"inputs": [
{
"id": "package",
"type": "promptString",
"description": "package name",
"default": "topic_service_action_rclcpp_example"
},
{
"id": "node",
"type": "promptString",
"description": "node name",
"default": "argument"
}
]
}
10) 빌드
- `Ctrl + Shift + b` 단축키로 빌드를 진행할 수 있다.
11) 디버깅
- `Ctrl + Shift + d` 단축키로 빌드를 진행할 수 있다. C++, Python 과 같이 언어별로 다른데 아래의 GIF 그림과 실행 순서를 참고하여 각 언어에 맞게 디버깅해보자.
11-1) rclcpp
- Run and Debug (`Ctrl + Shift + d`)로 이동
- "Debug-rclcpp(gbd)" 선택
- "Package name" 입력 (예: topic_service_action_rclcpp_example)
- "node name" 입력 (예: argument)
- Start Debugging 클릭 (`F5`)
11-2) rclpy
- Run and Debug (`Ctrl + Shift + d`)로 이동
- "Debug-rclpy(debugpy)" 선택
- Start Debugging 클릭 (`F5`)
7.2 QtCreator
1) 설치
QtCreator는 위 3번 항목에서 이미 설치하였다. 다시 한번 설치하려면 다음과 같이 설치하면 된다.
sudo apt install qtcreator
qtcreator
* QtCreator는 ROS 2의 RQt의 Plugin 개발에 UI 작성할 때 편리하기에 서브로 사용하면 좋을 듯싶다.
[그림 3: QtCreator의 Desing 화면]
7.3 QtCreator ROS
1) 설치
ROS Qt Creator Plug-in [22]는 ROS-Industrial [23] 컨소시엄에서 ROS의 통일된 개발 환경 구축을 위해 QtCreator의 플러그인 형태로 만든 것으로 ROS-Industrial 컨소시엄 멤버들간에 공통 개발 환경으로 사용하고 있다. 위의 일반적인 QtCreator에 ROS 개발 환경 설정을 더 편하게 해놓은 것으로 QtCreator를 기본 IDE로 사용하고자 한다면 사용해보기를 추천하고 싶다. QtCreator를 ROS 2의 IDE로 설정하려면 아래의 `Installation Instructions (Users)` 항목에서 신규 qtcreator-ros를 다운로드 받고 설정은 아래 링크의 도움말을 참고하도록 하자.
qtcreator-ros
[그림 4: ROS Qt Creator Plug-in]
7.4 기타
통합 개발 환경은 개발자 선호도에 따라 결정되는 것이 일반적인데 이 강좌에서 소개하지 못한 Vim, Eclipse, CLion, Emacs 등의 IDE들은 하기 링크에서 정보를 얻어 사용하도록 하자.
8. ROS 2 삭제
재설치 등의 이유로 ROS 2를 삭제하고자 한다면 하기의 명령어를 이용하여 ROS 2를 삭제할 수 있다.
sudo apt remove ros-humble-* && sudo apt autoremove