Carla를 위한 ROS bridge (ubuntu 20.04)

2024. 1. 14. 15:47SDV(Software Defined Vehicle)/carla simulator

carla 공싯 문서를 보고 따라하면 되지만 주의해야 할 사항이있다. 

https://carla.readthedocs.io/projects/ros-bridge/en/latest/ros_installation_ros1/

 

Install ROS Bridge for ROS 1 - CARLA Simulator

ROS bridge installation for ROS 1 This section is a guide on how to install the ROS bridge on Linux for use with ROS 1. You will find the prerequisites, installation steps, how to run a basic package to make sure everything is working well and commands to

carla.readthedocs.io

위 문서를 자세히 읽어 보면 

 

ubuntu 18.04 일때랑 아닐때랑 설치 방법이 다르다. 

 

 

나는 ubuntu 20.04 ver이므로 두번째 방법으로 해야한다. 

 

만약 첫번째 방법으로 잘못시도했을 경우 다음의 오류를 만나게 되는데 이때 컴퓨터에 문제가 발생한다. 

 

해결하기 위해서는 key를 삭제해주고 source list도 수정해줘야 한다. 

에러는 다음과 같다. 

 

User
youngsangcho@youngsangcho:~$ sudo apt update
[sudo] password for youngsangcho: 
Hit:1 http://packages.microsoft.com/repos/code stable InRelease
Hit:2 http://packages.ros.org/ros/ubuntu focal InRelease                       
Hit:3 https://dl.google.com/linux/chrome/deb stable InRelease                  
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease               
Hit:5 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu focal InRelease  
Hit:6 http://kr.archive.ubuntu.com/ubuntu focal InRelease                      
Hit:8 http://kr.archive.ubuntu.com/ubuntu focal-updates InRelease              
Hit:10 http://kr.archive.ubuntu.com/ubuntu focal-backports InRelease           
Hit:7 https://packagecloud.io/github/git-lfs/ubuntu focal InRelease            
Hit:9 https://apt.llvm.org/focal llvm-toolchain-focal InRelease                
Err:11 http://dist.carla.org/carla(lsb_release -sc) InRelease                  
  Could not connect to dist.carla.org:80 (34.227.255.250), connection timed out
Err:12 http://dist.carla.org/carla focal InRelease
  Unable to connect to dist.carla.org:http:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://dist.carla.org/carla(lsb_release/dists/-sc)/InRelease  Could not connect to dist.carla.org:80 (34.227.255.250), connection timed out
W: Failed to fetch http://dist.carla.org/carla/dists/focal/InRelease  Unable to connect to dist.carla.org:http:
W: Some index files failed to download. They have been ignored, or old ones used instead.

 

 

이를 해결하기 위해서는 

 

sudo gedit /etc/apt/sources.list
#deb [arch=amd64] http://dist.carla.org/carla focal main
# deb-src [arch=amd64] http://dist.carla.org/carla focal main

이런식으로 문제가 되는 코드 맨앞에 #을 붇이거나 코드자체를 지워서 해결하면 된다. 

 

 

중요한건 ubuntu 20.04 ver에서는 공식 문서상의 방법 B를 사용해야한다. (방법A 건너뛰기)

 

중간에 헷갈릴수 있는 부분은 catkin_build가 아니라 catkin_make를 해줘야 한다는 것이다. 

 

또한 나는 carla를 설치할 때 Build from source version in carla root folder

방식으로 설치했기 때문에 carla실행 명령어도 

 

cd ~/carla && make launch

로 해주면 된다.