You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vehicle.commands.download() timeout when called multiple times on a telemetry link brokered by MAVProxy #688
When calling Vehicle.commands.download() and Vehicle.commands.wait_ready() repeatedly through MAVProxy, the wait_ready() always fail after a number of trials:
File "/usr/local/lib/python2.7/dist-packages/dronekit/__init__.py", line 2650, in wait_ready
return self._vehicle.wait_ready('commands', **kwargs)
File "/usr/local/lib/python2.7/dist-packages/dronekit/__init__.py", line 2182, in wait_ready
timeout)
dronekit.APIException: wait_ready experienced a timeout after 30 seconds.
The above error is guaranteed to be thrown when running the following integration test:
I can verify that I am having this same problem. If after calling cmds.download() in DroneKit, I go to MavProxy and see "No waypoint load started" as a response to that requestion, then I issue a mp command "wp list" DroneKit unblocks, receives the download and continues. This isn't a problem with a direct connection or SITL.
This is causing me to be super stuck at the moment with no workaround.
I get this issue as well. In addition, sometimes calling connect('connection_string', wait_ready=True) causes this issue as well.
@peterbarker Any help here would be appreciated. I am able to connect to Mission Planner from MAVProxy, but I cannot run a drone kit connection. I can provide any information you need for debugging the issue.
Some additional information that we discovered in our application:
On SITL or direct serial connection, this wasn't a problem. On a radio connection, this was a huge problem. We also found that if we had a ground station (Mission Planner) using the same connection as DroneKit, we could get it to work. It was assumed that something in the exchange of data from Mission Planner through DroneKit was satisfying Wait Ready statements. Also, while the documentation for Vehicle.commands.wait_ready and Vehicle.wait_ready implies that the first just waits for a mission to be downloaded, it appears they both hang in the identical way. Also, the docs suggest doing a Vehicle.commands.wait_ready after a vehicle.commands.download, however a review of the code on GitHub suggests that the wait_ready has been added to the downloads function, and doesn't need to be added again.
@custeve If you don't mind elaborating, how did you connect DroneKit and Mission Planner using the same connection? I can try to do this tomorrow to see if it fixes the problem on my end as well.
Run through MavProxy. Connect mavproxy with one input and two outputs, something like:
mavproxy.py --master={path to your radio, like /dev/ttyUSB0} --out=udpbcast:{ip of your mission planner pc}:14550 --out=udp:0.0.0.0:14551
Then, in DroneKit, connect to 0.0.0.0:14551 and in mission planner connect to 14550. Depending on your network and machine setup, you may have to experiment with your udp ins and udp outs. See the mavproxy docs for me.
Interestingly, I was not able to get a UDP broadcast to work. I have been using Mission Planner and my script using TCP ports without any issues, however.
Each of my tests included the following setup:
Run MAVProxy, connect to the UAV
Connect Mission Planner to the MAVProxy instance running
Connect my script to the MAVProxy instance running
When I was ran my script in Python 3 (version 3.6.2), setting wait_ready=False in connect() caused none of the parameters to load. Although it fixed the timeout error, it broke the program since none of the parameters would load. Similarly frustrating, I could not get the parameters to load using wait_ready=True. Trying to run wait_ready=True caused a timeout after 30 seconds. Once I switched my program to Python 2, however, setting wait_ready=False successfully loaded the parameters. I was able to connect to my UAV, and use Mission Planner at the same time as my script. I will try setting wait_ready=True in Python 2 tomorrow, and I will add another comment with my testing results.
Using Python 2 fixed this issue. Once I switched back to Python 2 and added the wait_ready=True to the waypoint download command as well as the connect command, nothing timed out. It appears there is a bug somewhere in the Python 3 implementation that causes DroneKit to time out.
I think I figured it out. mavlink.py silently swallowed an exception, deep down in the mavlink message encoding methods.
The exception was about struct.pack complaining about a str argument which should have been bytes (in Python 3, the semantics of str are different). This fix appears to solve the problem.
I set timeout=180, and then still
Traceback (most recent call last):
File "mission_basic.py", line 38, in
vehicle.wait_ready(True, timeout=180)
File "/home/clickmox/.local/lib/python2.7/site-packages/dronekit/init.py", line 2375, in wait_ready
timeout)
dronekit.TimeoutError: wait_ready experienced a timeout after 180 seconds.
is that because possibly my pymavlink is the version of 2.4.1?
Having same problem in Python 2 with continuous wait_ready calls when waiting home_location to arrive to DK. I have serial connection through pixhawk cube. All modules up to date.
I tried to re-request the next waypoint when timeout occured and worked fine. Dronekit does not implement MAVLink's mission protocol properly. I will create a PR but I don't think it will be merged.
@eminakgun could you please elaborate on what you meant by "re-request the next waypoint"?
I experienced this same issue yesterday and am looking into workarounds as well
Activity
WebCache renamed to DocCache
custeve commentedon Apr 19, 2017
I can verify that I am having this same problem. If after calling cmds.download() in DroneKit, I go to MavProxy and see "No waypoint load started" as a response to that requestion, then I issue a mp command "wp list" DroneKit unblocks, receives the download and continues. This isn't a problem with a direct connection or SITL.
This is causing me to be super stuck at the moment with no workaround.
DarkmatterVale commentedon Apr 30, 2017
I get this issue as well. In addition, sometimes calling
connect('connection_string', wait_ready=True)causes this issue as well.@peterbarker Any help here would be appreciated. I am able to connect to Mission Planner from MAVProxy, but I cannot run a drone kit connection. I can provide any information you need for debugging the issue.
Thank you for the help!
custeve commentedon Apr 30, 2017
Some additional information that we discovered in our application:
On SITL or direct serial connection, this wasn't a problem. On a radio connection, this was a huge problem. We also found that if we had a ground station (Mission Planner) using the same connection as DroneKit, we could get it to work. It was assumed that something in the exchange of data from Mission Planner through DroneKit was satisfying Wait Ready statements. Also, while the documentation for Vehicle.commands.wait_ready and Vehicle.wait_ready implies that the first just waits for a mission to be downloaded, it appears they both hang in the identical way. Also, the docs suggest doing a Vehicle.commands.wait_ready after a vehicle.commands.download, however a review of the code on GitHub suggests that the wait_ready has been added to the downloads function, and doesn't need to be added again.
DarkmatterVale commentedon Apr 30, 2017
@custeve If you don't mind elaborating, how did you connect DroneKit and Mission Planner using the same connection? I can try to do this tomorrow to see if it fixes the problem on my end as well.
custeve commentedon May 1, 2017
Run through MavProxy. Connect mavproxy with one input and two outputs, something like:
mavproxy.py --master={path to your radio, like /dev/ttyUSB0} --out=udpbcast:{ip of your mission planner pc}:14550 --out=udp:0.0.0.0:14551
Then, in DroneKit, connect to 0.0.0.0:14551 and in mission planner connect to 14550. Depending on your network and machine setup, you may have to experiment with your udp ins and udp outs. See the mavproxy docs for me.
DarkmatterVale commentedon May 1, 2017
Interestingly, I was not able to get a UDP broadcast to work. I have been using Mission Planner and my script using TCP ports without any issues, however.
Each of my tests included the following setup:
When I was ran my script in Python 3 (version 3.6.2), setting
wait_ready=Falseinconnect()caused none of the parameters to load. Although it fixed the timeout error, it broke the program since none of the parameters would load. Similarly frustrating, I could not get the parameters to load usingwait_ready=True. Trying to runwait_ready=Truecaused a timeout after 30 seconds. Once I switched my program to Python 2, however, settingwait_ready=Falsesuccessfully loaded the parameters. I was able to connect to my UAV, and use Mission Planner at the same time as my script. I will try settingwait_ready=Truein Python 2 tomorrow, and I will add another comment with my testing results.@custeve Are you running Python 2 or Python 3?
DarkmatterVale commentedon May 4, 2017
Using Python 2 fixed this issue. Once I switched back to Python 2 and added the
wait_ready=Trueto the waypoint download command as well as the connect command, nothing timed out. It appears there is a bug somewhere in the Python 3 implementation that causes DroneKit to time out.DarkmatterVale commentedon Jul 1, 2017
I still get this error with my UAV if I use Python 3.
Will this be fixed soon? It is forcing me to continue to use Python 2.
tribbloid commentedon Jul 2, 2017
I only test it on Python 2 and got the error, DK's support for Python 3 is still beta (though it should be supported and Python 2 should be dropped).
hamishwillee commentedon Jul 2, 2017
@DarkmatterVale DK isn't getting any great resource. However if "someone" puts in a PR to fix this we'll certainly review it.
pietrodn commentedon Jan 13, 2018
I am still seeing this error intermittently on the SITL tests in Python 3.
pietrodn commentedon Jan 13, 2018
I think I figured it out.
mavlink.pysilently swallowed an exception, deep down in the mavlink message encoding methods.The exception was about
struct.packcomplaining about astrargument which should have beenbytes(in Python 3, the semantics ofstrare different).This fix appears to solve the problem.
tizianofiorenzani commentedon Jul 9, 2018
Assuming that your connection string is ok, sometimes you just need to extend the timeout period to get rid of the issue. Here is what I do:
This will connect with the vehicle and then wait until all the main messages have been received up to timeout_in_seconds
Guohao91 commentedon Dec 18, 2019
I set timeout=180, and then still
Traceback (most recent call last):
File "mission_basic.py", line 38, in
vehicle.wait_ready(True, timeout=180)
File "/home/clickmox/.local/lib/python2.7/site-packages/dronekit/init.py", line 2375, in wait_ready
timeout)
dronekit.TimeoutError: wait_ready experienced a timeout after 180 seconds.
is that because possibly my pymavlink is the version of 2.4.1?
eminakgun commentedon Jun 6, 2020
Having same problem in Python 2 with continuous wait_ready calls when waiting home_location to arrive to DK. I have serial connection through pixhawk cube. All modules up to date.
DoneMan commentedon Jun 20, 2020
anyone solved this? im having the same issue
eminakgun commentedon Jun 20, 2020
I tried to re-request the next waypoint when timeout occured and worked fine. Dronekit does not implement MAVLink's mission protocol properly. I will create a PR but I don't think it will be merged.
nick-schafhauser commentedon Jun 26, 2020
@eminakgun could you please elaborate on what you meant by "re-request the next waypoint"?
I experienced this same issue yesterday and am looking into workarounds as well
eminakgun commentedon Jun 26, 2020
#1039 is the implementation here.