前言
如果是刚开始接触carla,尽量先试预编译版本。
无论搞过几次,安装编译版carla都非常费劲,第一次我用了一周才安完,现在安一次也需要一两天。最大的问题就是网络问题,vpn、流量、WiFi这几个来回搭配看哪个行。
尽量不要选择太新的系统,要不然可能出各种奇怪的问题,我推荐ubuntu18安装,也不要用anaconda。0.9.11经过一次大改版,配置不行就装0.9.10版本以下的,配置好就装0.9.11以上的。
一、编译安装ue4
1、配置git
(1)申请github账户
这个去github上注册就行,不多说了。
(2)配置本地仓库
git config --global user.name “xxx”
git config --global user.email “xxx@xxx.xxx”
(3)连接github远程仓库
ssh-keygen
一路回车生成密匙,去/username/.ssh/id_rsa.pub复制密匙,配置到github上。
2、编译ue4
(1)克隆ue4仓库
git clone --depth 1 -b carla https://github.com/CarlaUnreal/UnrealEngine.git ~/UnrealEngine_4.26
这里有个地方要注意,克隆后要输入的名字是绑定的邮箱,密码是git的token。
(2)编译ue4
cd ~/UnrealEngine_4.26
./Setup.sh && ./GenerateProjectFiles.sh && make
(3)测试
cd ~/UnrealEngine_4.26/Engine/Binaries/Linux && ./UE4Editor
二、编译安装carla
1、克隆carla和content
git clone https://github.com/carla-simulator/carla
./Update.sh
2、配置ue4环境变量
gedit ~/.bashrc
增加 export UE4_ROOT=~/UnrealEngine_4.26到最后一行。
3、编译carla
make launch
如果出现下面这种报错,基本都是因为网络不行导致的多试几次直到成功启动carla。
fatal: unable to access 'https://github.com/carla-simulator/recastnavigation.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
Util/BuildTools/Linux.mk:137: recipe for target 'setup' failed
make: *** [setup] Error 128
如果反复尝试都不行,还有一个办法就是看一下编译的脚本,位置在carla/Util/BuildTools/setup.sh,里面有下载程序的git网址,手动下载放到对应的位置去。
至此,carla的编译已经完成了,已经可以松一口气了。
4、编译pythonAPI
make PythonAPI
这个pythonapi的编译同样会遇到各种网络不好的问题,包括有一些网络没有更新,需要自己手动改。但是,api的编译其实是可以直接下载编译版的代码然后复制过来的,所以能编译就编译,不行的话就复制吧。