news 2026/5/23 16:22:41

自动驾驶—CARLA仿真(0)报错记录

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
自动驾驶—CARLA仿真(0)报错记录

报错1:make_unit_vector

Traceback (most recent call last):
File “/home/zfjuan/CarLa/PythonAPI/examples/automatic_control.py”, line 873, in
main()
File “/home/zfjuan/CarLa/PythonAPI/examples/automatic_control.py”, line 866, in main
game_loop(args)
File “/home/zfjuan/CarLa/PythonAPI/examples/automatic_control.py”, line 739, in game_loop
agent = BehaviorAgent(world.player, behavior=args.behavior)
File “/home/zfjuan/CarLa/PythonAPI/carla/agents/navigation/behavior_agent.py”, line 40, ininit
super().init(vehicle, opt_dict=opt_dict, map_inst=map_inst, grp_inst=grp_inst)
File “/home/zfjuan/CarLa/PythonAPI/carla/agents/navigation/basic_agent.py”, line 100, ininit
self._global_planner = GlobalRoutePlanner(self._map, self._sampling_resolution)
File “/home/zfjuan/CarLa/PythonAPI/carla/agents/navigation/global_route_planner.py”, line 72, ininit
self._build_graph()
File “/home/zfjuan/CarLa/PythonAPI/carla/agents/navigation/global_route_planner.py”, line 204, in _build_graph
net_carla_vector = (exit_wp.transform.location - entry_wp.transform.location).make_unit_vector()
Boost.Python.ArgumentError: Python argument types in
Vector3D.make_unit_vector(Vector3D)
did not match C++ signature:
make_unit_vector(carla::geom::Vector3D {lvalue}, float)

原因分析:理论上应该是server client 版本不一致造成的,但我的确实都是0.9.16版本;
解决办法:修复 make_unit_vector 调用

修改文件:
/home/zfjuan/CarLa/PythonAPI/carla/agents/navigation/global_route_planner.py
找到报错行:

net_carla_vector=(exit_wp.transform.location-entry_wp.transform.location).make_unit_vector()

替换为(添加一个极小的 epsilon 参数):

vec=exit_wp.transform.location-entry_wp.transform.location try:net_carla_vector=vec.make_unit_vector()except TypeError:# 新版需要 epsilon 参数 net_carla_vector=vec.make_unit_vector(1e-6)

报错2:Retrying /location_info: Status 403, Message Access denied. Please check the provided API key. Retry #1, Backoff 1 seconds

✅ 错误原因
你正在运行一个 集成了 InvertedAI 服务的 CARLA 脚本(invertedai_traffic.py),该脚本需要调用 InvertedAI 的云端 API 来生成高真实感交通行为。

但你没有提供有效的 API Key,或提供的 Key 无效/已过期/无权限,导致服务器返回 HTTP 403(Forbidden)。

✅ 解决方案
步骤 1:获取 InvertedAI API Key,访问官网:注册登录,会自动生成一组Key

步骤 2:在命令行中传入 API Key
运行脚本时,必须通过 --iai-key 参数传入你的密钥:

python invertedai_traffic.py--host30.207.90.42--iai-key xxxxxxxxxxxxxxxxxxx
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/22 19:52:20

番禺区智慧文旅平台完成MySQL平滑替换,筑牢自主可控数据底座

在数字政府建设纵深推进与信创应用从“核心系统”向“全场景覆盖”拓展的背景下,地方党政部门正加速治理对开源数据库的隐性依赖风险。2025年2月,广州市番禺区政务服务数据管理局(以下简称“番禺区政数局”)成功将其智慧文旅综合管…

作者头像 李华
网站建设 2026/5/23 16:07:22

智慧引领未来 智慧型浊度传感器如何重塑工业水质监测新格局

在水质监测领域,精度与可靠性往往是决定成败的关键因素。FST100-ZD102智慧型浊度传感器的问世,不仅代表着技术层面的突破,更象征着工业水质监测向着智能化、精准化方向迈出了坚实的一步。这款传感器凭借其卓越的性能和广泛的应用适应性&#…

作者头像 李华
网站建设 2026/5/22 18:24:18

如何快速使用中华新华字典数据库:完整入门指南

如何快速使用中华新华字典数据库:完整入门指南 【免费下载链接】chinese-xinhua :orange_book: 中华新华字典数据库。包括歇后语,成语,词语,汉字。 项目地址: https://gitcode.com/gh_mirrors/ch/chinese-xinhua 中华新华字…

作者头像 李华
网站建设 2026/5/21 5:00:49

5个理由告诉你为什么HyPlayer是网易云音乐的最佳替代方案

5个理由告诉你为什么HyPlayer是网易云音乐的最佳替代方案 【免费下载链接】HyPlayer 仅供学习交流使用 | 第三方网易云音乐播放器 | A Netease Cloud Music Player 项目地址: https://gitcode.com/gh_mirrors/hy/HyPlayer 还在为官方网易云音乐的功能限制和广告困扰吗&a…

作者头像 李华
网站建设 2026/5/11 22:50:14

聚焦AI!亚马逊云科技re:Invent 2025中国行!

2025年12月1—5日,亚马逊云科技re:Invent 2025在拉斯维加斯呈现了Agentic AI重塑云计算的关键进展,Agentic AI不再只是概念,而是正在驱动企业应用、开发流程与业务模式的深刻变化。为了帮助中国开发者、架构师、技术团队更系统地理解这场技术…

作者头像 李华