dronekit / dronekit-python

DroneKit-Python library for communicating with Drones via MAVLink.
https://readthedocs.org/projects/dronekit-python/
Apache License 2.0
1.62k stars 1.44k forks source link

"Device /dev/ttyACM0 is dead" with python3 #759

Open technorior opened 7 years ago

technorior commented 7 years ago

APM: Copter v3.5.3 when I use: vehicle = connect("/dev/ttyACM0", boud=ANY) in python 2 work great, but in python 3 I have message:

Device /dev/ttyACM0 is dead

and then

>>>> No IO Thread Heartbeat

Evidlo commented 6 years ago

I have this problem too in Python 3.5.3 and dronekit 2.9.1, without the No IO Thread Heartbeat part.

In [3]: v = connect('/dev/ttyACM0')
Device /dev/ttyACM0 is dead
>>> EKF2 IMU1 initial yaw alignment complete
>>> EKF2 IMU0 initial yaw alignment complete
>>> GPS 0: detected as u-blox at 38400 baud
>>> EKF2 IMU0 tilt alignment complete
>>> EKF2 IMU1 tilt alignment complete
>>> GPS 0: detected as u-blox at 115200 baud
>>> u-blox 0 HW: 00080000 SW: ROM CORE 3.01 (107888)

It prints out information about the IMU and GPS but never returns to the interactive session.

pietrodn commented 6 years ago

I have the same problem of @technorior with a Pixhawk Falcon, running the latest PX4 firmware, connected to a Raspberry Pi 3 Model B via serial port..

peterbarker commented 6 years ago

@Evidlo What interactive session? dronekit-python doesn't do those naturally.

@technorior Try using /dev/serial/by-id/<YOURDEVICENAME> instead of /dev/ttyACM0 - you're more likely to be able to reconnect to that if the device reboots.

@technorior The "No IO Thread Heartbeat" is probably because you don't have an SD card inserted.

pietrodn commented 6 years ago

I fixed this problem by patching pymavlink.

Evidlo commented 6 years ago

I no longer have a Pixhawk, so I can't confirm. It doesn't happen when connecting to the simulator.

@peterbarker All I meant was that connect() blocks forever.

pietrodn commented 6 years ago

Should be fixed in master.

pietrodn commented 6 years ago

I think this issue can be closed after the latest fixes in the Python 3 support.

otsuka-kohei commented 5 years ago

I found same problem on ArduPilot Copter 3.6.3, Python 3.7.1, Windows 10, and dronekit (latest github repo master).

Device com3 is dead
Exception in MAVLink input loop
Traceback (most recent call last):
  File "C:\Users\otsuka\AppData\Local\Programs\Python\Python37-32\lib\site-packages\dronekit\mavlink.py", line 210, in mavlink_thread_in
    fn(self)
  File "C:\Users\otsuka\AppData\Local\Programs\Python\Python37-32\lib\site-packages\dronekit\__init__.py", line 1370, in listener
    self._heartbeat_error)
dronekit.APIException: No heartbeat in 30 seconds, aborting.