编辑
通过使用以下命令确保我的 pyserial 介于 2.0 和 2.999 之间,我能够解决这个问题:
sudo pip install "pySerial>=2.0,<=2.9999"
看到这个问题是不久前提出的,这可能不是你的问题,但也许 pyserial 和你的dronekit 版本不匹配可能会导致你遇到问题。
结束编辑
对于看到这篇文章的其他人,这是 PeterL 在 30 秒未找到心跳后谈论的输出:
Connecting to vehicle on: /dev/cu.usbserial-DB00BWMM
>>> Link timeout, no heartbeat in last 5 seconds
>>> No heartbeat in 30 seconds, aborting.
Traceback (most recent call last):
File "vehicle_state.py", line 23, in <module>
vehicle = connect(args.connect, wait_ready=True)
File "/Library/Python/2.7/site-packages/dronekit/__init__.py", line 2354, in connect
vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)
File "/Library/Python/2.7/site-packages/dronekit/__init__.py", line 1815, in initialize
raise APIException('Timeout in initializing connection.')
dronekit.APIException: Timeout in initializing connection.