项目简介
openpilot 是开源机器人操作系统,当前可为 300 多款车型提升驾驶辅助能力。它提供高级驾驶辅助功能,由 comma.ai 及社区共同开发。
README 预览
\n\nopenpilot\n\n\n openpilot is an operating system for robotics.\n \n Currently, it upgrades the driver assistance system in 300+ supported cars.\n\n\n\n Docs\n · \n Roadmap\n · \n Contribute\n · \n Community\n · \n Try it on a comma four\n\n\nQuick start: `bash \n\n\n \n \n \n \n \n\n\n\nUsing openpilot in a car\n------\n\nTo use openpilot in a car, you need four things:\n1. **Supported Device:** a comma four, available at [comma.ai/shop/comma-four](https://www.comma.ai/shop/comma-four).\n2. **Software:** The setup procedure for the comma four allows users to enter a URL for custom software. Use the URL `openpilot.comma.ai` to install the release version.\n3. **Supported Car:** Ensure that you have one of [the 300+ supported cars](docs/CARS.md).\n4. **Car Harness:** You will also need a [car harness](https://comma.ai/shop/car-harness) to connect your comma four to your car.\n\nWe have detailed instructions for [how to install the harness and device in a car](https://comma.ai/setup). Note that it's possible to run openpilot on [other hardware](https://blog.comma.ai/self-driving-car-for-free/), although it's not plug-and-play.\n\n\n### Branches\n\nRunning `master` and other branches directly is supported, but it's recommended to run one of the following prebuilt branches:\n\n| comma four branch | comma 3X branch | URL | description |\n|------------------------|------------------------|----------------------------------------|-------------------------------------------------------------------------------------|\n| `release-mici` | `release-tizi` | openpilot.comma.ai | This is openpilot's release branch. |\n| `release-mici-staging` | `release-tizi-staging` | openpilot-test.comma.ai | This is the staging branch for releases. Us
常见问题 (5)
故障排除如何修复 Tesla 冷启动后出现的 openpilot selfdrived 初始化超时和 DI_cruiseState 故障?
当 modeld 以实时优先级运行并从冷页缓存加载 773 MB 大模型时,会出现此问题。加载器继承了 modeld 的实时调度,在内存回收期间使 controlsd/selfdrived 陷入饥饿,导致 6 秒初始化超时、carControl not alive、DAS_control 被阻塞以及巡航故障。
修复方法是更新到包含 [PR #39007](https://github.com/commaai/openpilot/pull/39007)("modeld: set realtime scheduling after model load")的 openpilot 构建。回移植时:
1. 在调用 config_realtime_process()/设置实时调度之前加载大模型。
2. 在加载期间保持垃圾回收处于禁用状态(此前在 config_realtime_process() 内部完成),例如使用 gc.disable()。
3. 仅在模型加载完成后才将 modeld 切换为实时优先级。
这不会对模型加载性能产生可测量的影响,并可防止 controlsd 启动时陷入饥饿。在模型已位于页缓存中后进行第二次启动或许可以避免该故障,但优先级更改才是真正的修复方法。
故障排除为什么 comma four 在车辆长时间停放后无法 bootkick,并触发 Toyota LKAS/摄像头仪表盘故障?
当 panda 的 STM32 进入欠压(brown-out)/NMI 状态时可能会出现此问题。NMI 处理程序会陷入无限循环而不是执行复位,导致 GPIO/继电器和 CAN 总线状态处于异常状况。临时解决方法:拔下并重新连接 comma 设备;之后它应该能正常启动并正常工作。永久修复:将 openpilot/panda 固件更新到包含 PR #38737 "Handle and report NMI/hardfaults" 的版本,该 PR 会在 NMI/硬件故障时复位 STM 并添加日志记录。在 night-dev 上,待修复合并后检查更新;高级用户可以刷入测试分支。如果问题重复出现,请检查 comma 的电源和供电电压。
故障排除如何修复因缺少 dm_warp_1344x760_tinygrad.pkl 导致 comma four 的 dmonitoringmodeld 无法运行以及驾驶员监控校准卡在 0% 的问题?
这会影响 PR #38684 之后的 nightly 构建,comma ARM64 portable 构建只会为构建设备生成对应的相机 warp 文件,而不是同时生成 TICI 和 MICI 两种分辨率的文件。comma four/MICI 需要 selfdrive/modeld/models/dm_warp_1344x760_tinygrad.pkl 文件。
临时解决方法:重新刷写或将 comma four 切换到已知可用的 release-chestnut 构建:
- AGNOS: 19.6
- 分支: release-chestnut
- 提交: 053d9c446800df38aca42b69bb99197aefbea77b
在 openpilot 目录下验证该文件是否存在:
ls -l selfdrive/modeld/models/dm_warp_1344x760_tinygrad.pkl该构建还包含
dm_warp_1928x1208_tinygrad.pkl,并且驾驶员监控标定可正常进行。
对于 portable nightly/release 构建,需修复 SConscript,使 comma ARM64 预构建文件同时包含两种相机配置:
- TICI: 来自 _ar_ox_fisheye 的 1928x1208
- MICI/comma four: 来自 _os_fisheye 的 1344x760
仅在设备本地构建中保留单相机优化。重新构建,并在部署前确认两个文件都存在:
ls -l selfdrive/modeld/models/dm_warp_1344x760_tinygrad.pkl \
selfdrive/modeld/models/dm_warp_1928x1208_tinygrad.pkl然后重启设备或重新启动 openpilot。
故障排除如何修复 2019 Kia Niro PHEV 在车速低于 32 MPH 时 openpilot 转向脱离或顿挫的问题?
2019 Kia Niro PHEV 的 EPS 固件强制执行约 32 MPH (14 m/s) 的最低转向速度;openpilot 无法让车辆在该 EPS 上从 0 MPH 开始转向。你使用的分叉版本未声明这一限制,因此 openpilot 会持续请求转向,并可能在实际速度跨越 32 MPH 时突然重新施加转向。
修复方法:使用包含官方 HKG 2019 Kia Niro PHEV 支持/PR 的上游 openpilot 版本,而不是 hkg_085 或 Donfyffe 等 v0.8.5 分叉版本。如果你维护一个分叉,请在 selfdrive/car/hyundai/interface.py 中添加该车辆,并为 2019 Niro PHEV 设置 ret.minSteerSpeed = 14.0,与现有 2019 Hyundai Ioniq 的处理方式保持一致。这样可以让 openpilot 在跨越该阈值时干净地抑制和重新启用转向,而不是与 EPS 对抗。
在升级之前,请勿在走走停停的交通中或车速可能在 32 MPH 附近徘徊时使用该系统,并随时准备手动接管转向。缺失的 LKAS 故障警告是一个单独的问题,需要受影响路线的日志。
故障排除为什么 openpilot 的 logmessaged 会丢弃新启动进程(如 dmonitoringmodeld)最初的几条日志消息?
这是一个启动顺序竞态问题。各进程在 loggerd/logmessaged 连接 ZeroMQ 订阅者之前就发布了早期日志,因此这些初始的 PUB 消息会被丢弃,且无法恢复。
修复方法:
1. 将 openpilot 更新到同时包含以下两个 PR 的版本:
- logmessaged: avoid dropping messages
- manager: start loggerd before other processes
2. 如果手动 backport,请编辑 selfdrive/manager/process_config.py,将 loggerd 移到 dmonitoringd、dmonitoringmodeld、modeld 以及其他会输出启动日志的进程之前。
3. 重新编译并重启 manager,或重启设备:
cd /data/openpilot
scons -j$(nproc)
sudo reboot
4. 验证早期日志现在已被捕获:
./selfdrive/debug/filter_log_message.py "" 0 | grep modeld
关键要求是 loggerd 必须在客户端进程开始记录日志之前就已运行并完成订阅。