dronekit / dronekit-python

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

Reconnecting To The Autopilot Again #792

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi. I am trying to make some python script about reconnecting to the board. If i try to connect a nonexisting board i can get dronekit.APIException but when i connect to my existing board and read some info from it and unplug it, i can not get APIException. How can i detect broken link and try to reconnect it again? Thanks...

pietrodn commented 6 years ago

You can run a thread which periodically checks the last_heartbeat attribute and takes the necessary actions. The attribute documentation shows an example.