Repository navigation
Reworks timeout logic. Fixes windows tests. Supports Copter 3.3 release in tests. - #407
Conversation
8eccc15 to
d7fa800
Compare
8a7be38 to
d751866
Compare
|
This branch supercedes and rolls in #406, since Linux was actually failing (somewhat consistently) on one of the old builds. |
|
Is this timeout just for connecting? If so, can user set 0 to disable the timeout altogether (should they so wish)? If it is a general timeout, would we ever want to change this timeout after connecting? |
|
@hamishwillee It can now be set to 0 (or None) to not trigger. We will probably want the ability to change this timeout after connecting, but I want to expose that in another PR (or issue). |
Reworks timeout logic. Fixes windows tests. Supports Copter 3.3 release in tests.
|
Looking forward to testing - do I just update Dronekit via pip to get the latest? Also, how do I access the documentation as listed in the top of lib/init.py? There's a lot of good info that doesn't seem to show up anywhere? "Connect"description / doco in lib/init.py doesn't include timeout (line 46) It seems that if the connection times out, this happens: raise APIException('Timeout in initializing connection.') The timeout.py sample doesn't use this, it seems to just end when / if it times out, which at least is better than hanging. Is the intent that you use the raised exception to identify that the connect has failed and handle it that way, or is there a parameter within "Vehicle" that indicates it's not connected? |
|
@mikerob It is unlikely that a new release has appeared for this on pip yet. YOu can however build dronekit from github source using the instructions here (on windows). You may have to uninstall dronekit first ( The documentation hasn't been rebuilt yet (@tcr3dr - worth doing another docs build soon!). It has much improved, but does not yet include the timeout docs (this only went in 3 hours ago!). If you want to build and test the docs locally yourself it is quite easy - see these instructions. |
|
Hamish, have installed - thanks. I'm running on a RasPi so it makes life easier than windows. Hit something odd, not sure if it's a PEBKAC or a code issue: from dronekit import connect try: If I set timeout to 10 or more, it works fine. If less than that, it throws the following:
APIException fail - Something bad happened It looks like setting timeout too low interferes with or gets inside some other exception handling loop. |
|
Hi @mikerob, the default heartbeat_timeout is 10 seconds. You should be able to set it to 0 to indicate you want no timeout. Otherwise it's possible it will throw early on in the connection process if it doesn't receive a heartbeat in time. The timeout configuration is very new, so possibly buggy! If you have an issue, please file it as a separate issue and we can address it there. |
Motivated by the Windows tests often failing, I figured out what was breaking them (finally!) This patch does a few things:
heartbeat_timeoutproperty toconnect(), by default set to 30s (this is different from the 5s warning, in that it actually closes the connection)