自动驾驶—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, in init

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, in init

self._global_planner = GlobalRoutePlanner(self._map, self._sampling_resolution)

File "/home/zfjuan/CarLa/PythonAPI/carla/agents/navigation/global_route_planner.py", line 72, in init

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

找到报错行:

c 复制代码
net_carla_vector = (exit_wp.transform.location - entry_wp.transform.location).make_unit_vector()

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

c 复制代码
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 参数传入你的密钥:

c 复制代码
python invertedai_traffic.py --host 30.207.90.42 --iai-key xxxxxxxxxxxxxxxxxxx
相关推荐
猫咪老师17 小时前
AI 时代,为什么说万物皆可 CLI?
人工智能
前进的李工17 小时前
智能Agent实战指南:从入门到精通(工具)
开发语言·人工智能·架构·langchain·agent·tool·agentexecutor
小凡同志17 小时前
从 Vibe Coding 到 Spec-Driven:AI 编程范式的下一次进化
前端·人工智能·架构
hbstream17 小时前
受够了Vibe Coding的失控?换个起点,让AI事半功倍
前端·人工智能
memeflyfly17 小时前
从"工具闲置"到"智能分配":OpenCode 多 Agent 工具管理方案实践
人工智能·开源
sp_fyf_202417 小时前
【大语言模型】 揭秘OPD:大语言模型的长度膨胀与稳定化策略
人工智能·深度学习·神经网络·机器学习·语言模型
视觉&物联智能17 小时前
【杂谈】-洞察业务风险潜藏暗礁:影子人工智能如何重塑移动威胁格局
人工智能·网络安全·aigc·agi
小鱼~~17 小时前
集成学习思想
人工智能·机器学习·集成学习
涡能增压发动积17 小时前
10 分钟带你快速上手 CluadeCode
人工智能·后端
洛卡卡了17 小时前
Hermes Agent 火了,我也把它从安装到飞书聊天跑了一遍
人工智能·aigc·ai编程