当前位置: 首页 > news >正文

实用指南:自动驾驶—CARLA仿真(0)报错记录

报错0:XDG_RUNTIME_DIR not set in the environment.

error: XDG_RUNTIME_DIR not set in the environment.
ALSA lib ... No such file or directory
...
Segmentation fault

在 WSL2(Windows Subsystem for Linux)中运行依赖图形界面(GUI)或音频的 Python 程序(如 Pygame、OpenCV imshow、Matplotlib 等)时的经典崩溃问题。
WSL2 默认没有图形显示服务器(如 X11),而程序试图创建窗口(例如 Pygame、cv2.imshow),图形库初始化失败,可能触发后续崩溃。
不在vscode 终端执行命令,在mobaxterm执行即可;

报错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
找到报错行:

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 --host 30.207.90.42 --iai-key xxxxxxxxxxxxxxxxxxx

报错3:pygame.error: Invalid joystick device number and cannot find card ‘0’

Welcome to CARLA manual control with steering wheel Logitech G29.
To drive start by preshing the brake pedal.
Change your wheel_config.ini according to your steering wheel.
To find out the values of your steering wheel use jstest-gtk in Ubuntu.
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
File "/home/zfjuan/CarLa/PythonAPI/examples/manual_control_steeringwheel.py", line 848, in <module>main()File "/home/zfjuan/CarLa/PythonAPI/examples/manual_control_steeringwheel.py", line 840, in maingame_loop(args)File "/home/zfjuan/CarLa/PythonAPI/examples/manual_control_steeringwheel.py", line 770, in game_loopcontroller = DualControl(world, args.autopilot)File "/home/zfjuan/CarLa/PythonAPI/examples/manual_control_steeringwheel.py", line 212, in __init__self._joystick = pygame.joystick.Joystick(0)pygame.error: Invalid joystick device number

G29 是复合 HID 设备(方向盘+踏板+按钮),需要正确接入外设设备;

open3D GLFW Error: GLX: Failed to create context: GLXBadFBConfig

[Open3D WARNING] GLFW Error: GLX: Failed to create context: GLXBadFBConfig
[Open3D WARNING] Failed to create window

OpenGL 版本问题;

http://www.jsqmd.com/news/365537/

相关文章:

  • Conda 虚拟环境完整指南
  • 2026国内最新儿童房地板品牌TOP10推荐:优质企业权威榜单发布,环保安全适配成长需求,打造放心孩童空间 - 品牌推荐2026
  • 2026年水质分析仪厂家权威推荐榜:多参数/便携式/COD/氨氮等全类型水质分析仪厂家选择指南 - 品牌推荐大师1
  • HCL使用浏览器访问AC
  • 营养早餐门店数量第一的一鸣食品低糖营养早餐搭配食谱大揭秘 - myqiye
  • 智慧城市街道摆摊占道经营流动摊贩检测数据集VOC+YOLO格式2401张1类别
  • 2026年探究车百强产品怎么样 高性价比汽车内饰排名 - 工业推荐榜
  • 2026年国产COD测定仪厂家盘点:国产仪器崛起!高性价比COD测定仪品牌与厂家解析 - 品牌推荐大师1
  • 四个维度了解codigger
  • 2026年万渠水泥制品公司介绍,价格和口碑分析 - mypinpai
  • 2026年好用的四轴撕碎机服务商排名前十有哪些 - mypinpai
  • 计算机毕业设计springboot基于网上求职招聘平台 基于 SpringBoot 的网络求职招聘系统的设计与实现 SpringBoot 框架下线上求职招聘平台的开发与应用
  • 2026年PE高压膜定制服务商价格大比拼,哪家费用合理 - 工业品网
  • 讲讲能稳定供货的流延磨砂膜生产企业,哪家性价比高 - 工业设备
  • 2026年重庆权威青少年叛逆教育学校推荐,解决孩子叛逆问题的好选择 - 工业品牌热点
  • cube头像集合
  • 盘点2026年郑州靠谱美容美发学校,培训费用大揭秘 - 工业设备
  • uniapp+deepseek流式ai助理|uniapp+vue3对接deepseek三端Ai问答模板
  • 提升展厅科技感与接待效率:2026年企业展厅迎宾机器人选型指南 - 智造出海
  • 2026年永亚智能有机肥设备价格大揭秘,费用怎么算 - myqiye
  • 【日记】这炒河粉好辣!怎么还能放山海椒的啊…… 不过好好吃(1703 字)
  • 专科生收藏!倍受青睐的降AIGC工具 —— 千笔·降AI率助手
  • 真心不骗你 9个AI论文平台深度测评:研究生毕业论文+科研写作必备工具推荐
  • 讲讲2026年有机肥设备堵料解决办法,顺便推荐好厂家 - 工业推荐榜
  • 2026年360航空软包汽车脚垫管理平台,广州地区哪家口碑好 - 工业品牌热点
  • 用数据说话 9个降AIGC软件测评:本科生降AI率全攻略
  • 摆脱论文困扰! AI论文平台 千笔写作工具 VS 万方智搜AI,专科生专属利器!
  • 梳理2026年福州服务不错的雅思培训机构,哪家性价比更高 - 工业品网
  • 合同审查的真正门槛,不在法律条文,而在交易结构判断
  • 聊聊佛山靠谱的汽车丝圈脚垫制造厂,车百强口碑出众 - 工业品牌热点