설치 기준 및 환경
- 우분투 22.04 LTS
- amd64 architecture
- ROS2 Humble-Desktop 기준
- ROS 2 Humble Hawksbill: Ubuntu 22.04 (Jammy Jellyfish)
설치 전 우분투 버전 확인!
버전이 다를 경우 문제가 발생함.
우분투를 재설치해야 함!!
lsb_release -a
# Ubuntu 22.04.4 LTS
ROS 설치
아래의 파일을 다운로드한 후 설치 진행. 만약 설치 중 오류가 난다면 재부팅 후 다시 시도.
# 우분투 버전 확인
lsb_release -a
# 설치 경로로 이동
cd ~/downloads
# 필요한 모듈 설치
# git install
sudo apt update
sudo apt install git
# 권한부여
chmod +x ros2-humble-desktop-main.sh
# ros-2 설치
./ros2-humble-desktop-main.sh
설치 확인
# 권한부여
chmod +x ./tutorial.sh
# 설치 확인
./tutorial.sh
Finished <<< launch_testing_examples
Summary: 22 packages finished
터미널에 위의 문구가 뜨고 더 이상 화면이 업데이트되지 않는다면 설치가 완료!!! 👏🏻
새로운 터미널을 열어 아래 명령어를 실행시켜 주기 🔽
ros2 run examples_rclcpp_minimal_publisher publisher_member_function
# 동작 확인 종료 방법 키보드: ctrl + c
ROS 버전 확인
printenv ROS_DISTRO
# humble
오류 발생 해결 (anaconda 환경일 경우)
# 1. pyqt5 버전 맞추기
sudo pip install pyqt5==5.15.9
# 2. 가상환경 비활성화 후에 다시 실행
# ROS2와 conda가 함께 작동하지 않을 수 있습니다.
conda deactivate
# 3. conda 충돌 해결
#.bashrc 에서 conda initialize하는 부분 삭제
echo "conda deactivate" >> ~/.bashrc
#.bashrc에 추가
# export PATH=/usr/bin/anaconda/bin:$PATH
anaconda-navigator
참고 :
conda does not work in conjunction with ROS 2. Make sure that your PATH environment variable does not have any conda paths in it. You may have to check your .bashrc for this line and comment it out.
Anaconda
When Anaconda installs, it will create a path in your .bashrc file. (press ctrl + h in home directory to view file)
example:
# added by Anaconda x.x.x installer
export PATH="/home/"user"/"anaconda version"/bin:$PATH"
Having an active Anaconda path in your .bashrc will cause errors when you try to use ROS.
The solution to the problem is to comment out the path:
#export PATH="/home/"user"/"anaconda version"/bin:$PATH"
In order to use Anaconda, simply paste in the Anaconda path when you start a new terminal; and hit enter. Then use as normal. This will allow you to use ROS and Anaconda on the same system
'ROS2' 카테고리의 다른 글
| [ROS2] 아이폰 LiDAR Scanner를 활용해 gazebo Map 만들기 (0) | 2025.06.29 |
|---|---|
| [ROS2] ros2 usb_cam 설치 및 사용 (0) | 2024.12.05 |
| [ROS2] ROS2 Action 알아보기, 근데 이제 turtlesim을 곁들인 (2) | 2024.10.22 |
| [ROS2] ROS2 Service 알아보기, 근데 이제 turtlesim을 곁들인 (1) | 2024.10.18 |
| [ROS2] ROS2 Topic 알아보기, 근데 이제 turtlesim을 곁들인 (1) | 2024.10.16 |