gpt4 book ai didi

python - 使用python-obd连接和查询汽车的问题

转载 作者:行者123 更新时间:2023-12-03 16:49:37 25 4
gpt4 key购买 nike

我正在尝试使用 USB OBD-II 设备将我的 linux 与汽车连接,它连接到 OBD-II 设备但不连接到汽车。 OBD汽车医生软件https://www.obdautodoctor.com/连接很好,看看 Debug模式下的python-obd在尝试连接和执行查询(RPM)时说了什么:

```
>>> connection = obd.OBD()
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/ttyUSB0']
[obd.obd] Attempting to use port: /dev/ttyUSB0
[obd.elm327] Initializing ELM327: PORT=/dev/ttyUSB0 BAUD=auto PROTOCOL=auto
[obd.elm327] Response from baud 38400: '?\r\r>'
[obd.elm327] Choosing baud 38400
[obd.elm327] write: 'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'\r\rELM327 v1.5\r\r>'
[obd.elm327] write: 'ATE0\r'
[obd.elm327] read: b'ATE0\rOK'
[obd.elm327] write: 'ATH1\r'
[obd.elm327] read: b'OK'
[obd.elm327] write: 'ATL0\r'
[obd.elm327] read: b'OK'
[obd.elm327] write: 'AT RV\r'
[obd.elm327] read: b'13.9V\r\r>'
[obd.elm327] write: 'ATSP0\r'
[obd.elm327] read: b'OK'
[obd.elm327] write: '0100\r'
[obd.elm327] read: b'\r\r>'
[obd.elm327] write: 'ATDPN\r'
[obd.elm327] Failed to read port
[obd.elm327] read: b''
[obd.elm327] Failed to retrieve current protocol
[obd.elm327] Adapter connected, but the ignition is off
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
>>> connection.status()
'OBD Connected'
>>> response = connection.query(obd.commands.RPM, force=True)
[obd.obd] Sending command: 010C: Engine RPM
[obd.elm327] write: '010C\r'
[obd.elm327] read: b'010C\r41 0C 0D 4D \r\r>'
[obd.OBDCommand] 010C: Engine RPM did not receive any acceptable messages
>>>
```

任何帮助将不胜感激。
提前致谢

最佳答案

将 obd 降级到 v0.6.1,这对我有用
我有同样的问题。
我看到你正在使用 v0.7.1

关于python - 使用python-obd连接和查询汽车的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60606277/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com