![](/img/trans.png)
[英]XMLSchemaChildrenValidationError in Carla simulator (Python 3.7)
[英]How to establish data communication between Python and the Carla simulator?
我将 Carla 模拟器下载到我的 Windows PC,我正在尝试将 Carla 真实引擎链接到 python,但我不确定如何。 我想使用python定位车辆,我们如何访问python中的接口? 谢谢!
因此,您需要启动 CARLA 并连接到客户端,然后集成 API...
首先,使用(Windows 版本)中的可执行文件通过命令行启动 CARLA
cd /carla/root
./CarlaUE4.sh
您将转到文件目录,然后运行引擎
通过python API使用CARLA,需要将Python客户端通过一个端口连接到服务器,这样就可以连接和控制仿真了
import carla
import random
# Connecting to a client and retrieve the world object
client = carla.Client('localhost', 2000)
world = client.get_world()
客户端object 只是客户端连接到服务器的实例,您将使用它来加载函数
在您的情况下,如果您想使用world.get_actors()方法关注模拟中的所有车辆,您可以过滤掉车辆并使用set_autopilot()方法将车辆控制给交通管理器
for vehicle in world.get_actors().filter('vehicle'):
vehicle.setUautopilot(true)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.