admin管理员组

文章数量:1532732

0.写在前面

其实官方文档写的很详细,所有细节都有涉及,不过暂时没有中文版。本文写作目的,一个是作为自己的操作笔记,二个是帮助一些更习惯看中文版本的一些朋友

https://carla.readthedocs.io/en/latest/start_quickstart/

这是Carla的环境约束

System requirements. CARLA is built for Windows and Linux systems.
An adequate GPU. CARLA aims for realistic simulations, so the server needs at least a 6 GB GPU although we would recommend 8 GB. A dedicated GPU is highly recommended for machine learning.
Disk space. CARLA will use about 20 GB of space.
Python. Python is the main scripting language in CARLA. CARLA supports Python 2.7 and Python 3 on Linux, and Python 3 on Windows.
Pip. Some installation methods of the CARLA client library require pip or pip3 (depending on your Python version) version 20.3 or higher.

简单来说,主要保障:
1.显存:保证6G,推荐8G
2.磁盘:空间占用约20G

1. 环境准备

第一步:安装anaconda

本质上来说这一步不是必须的,官方的文档中其实也没提起这个。但是从维护 Python 环境的便捷性来说,这一步是大家都比较推荐的方式。由于我电脑上anaconda是现成的,所以这一步我这边就略过了。

https://www.anaconda/products/distribution

第二步:在anaconda上创建Carla运行环境

由于蛮多网上的使用者都提到用如果使用Python3的话,要使用3.7,所以虽然官方文档中虽然没有提及这个,为了避免踩坑,我这边还是选用了Python 3.7.15的版本

创建好运行环境后,后续命令行操作,都需要在这个环境中执行,后略。

第三步:安装依赖包

pip3 install --user pygame numpy networkx

凡是 pip install 强烈建议用国内源,我随便找了一个豆瓣,用发如下,后略:

pip3 install --user pygame numpy networkx -i http://pypi.douban/simple --trusted-host pypi.douban

CARLA安装

Windows上只有人肉下载这一种方式

https://github/carla-simulator/carla/blob/master/Docs/download.md


这两个分别下载,其中AdditiaoalMaps**.zip是资源文件和地图,下载后需要直接解压到CARLA**.ZIP解压文件的根目录下

最后在安装客户端:

 pip install carla

2.检验成果

第一步:运行CARLA

cd path/to/carla/root
CarlaUE4.exe


注意,CARLA需要一直保持运行状态,这个相当于是服务器

第二~N步:启动N个车

这一块的内容都在以下目录下

cd path/to/carla/root/PythonAPI/examples

需要进行依赖库安装:

python -m pip install -r requirements.txt

这里有蛮多DEMO,举几个常见的Case

人肉控制:可以用WASD进行控制

python manual_control.py 

自动开车:

python automatic_control.py 

本文标签: CARLAWindows