Dronekit-python, dronekit-sitl, missionplanner problems

458 views
Skip to first unread message

Trond Hindenes

unread,
Mar 1, 2016, 4:14:33 AM3/1/16
to drones-discuss
Hi all, 
I'm experiencing some problems with my simulation setup, and wondered if anyone else have seen the same.
I'm running dronekit-sitl on a separate linux computer, I've tried both the latest version and installing directly from the master branch.

The problems I'm facing are most notably arming trouble. Seems like when the copter has managed to takeoff, everything is fine. The impression I'm getting is that the simulation lags behind on arming commands. Here's the output of the "taking off" example (http://python.dronekit.io/guide/taking_off.html):


C:\Python27\python.exe "C:/Users/Trond Hindenes/PycharmProjects/twistlink/testflight.py"
>>> APM:Copter V3.3 (d6053245)
>>> Frame: QUAD
Basic pre-arm checks
Arming motors
 Waiting for arming...
>>> ARMING MOTORS
>>> Initialising APM...
Taking off!
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0
>>> DISARMING MOTORS
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0
 Altitude:  0.0

Process finished with exit code -1

Randy Mackay

unread,
Mar 1, 2016, 4:51:47 AM3/1/16
to drones-...@googlegroups.com

Trond,

 

     I think there’s a line missing in the arm-and-takeoff function.  From what I can see it’s not sending a take-off command which should appear right after the ‘print “taking off!”’.

 

-Randy

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hamish Willee

unread,
Mar 1, 2016, 4:54:58 AM3/1/16
to drones-discuss
What happens if you run the Simple Goto example (http://python.dronekit.io/examples/simple_goto.html). Despite what it says, you just navigate to the directory and run `python simple_goto.py` - if SITL is installed on your machine it will be started for you.

Hamish Willee

unread,
Mar 1, 2016, 6:23:49 AM3/1/16
to drones-discuss
Randy, duh - you're right. No idea how that got cut off - it is in the text further down. I've raised a PR: https://github.com/dronekit/dronekit-python/pull/600

Trond Hindenes

unread,
Mar 1, 2016, 8:47:56 AM3/1/16
to drones-discuss
For me this turned out to be a problem related to threading. Seems like dronekit isn't completely thread-safe. Or I might just be a complete python noob. Probably the latter.

Hamish Willee

unread,
Mar 1, 2016, 5:07:05 PM3/1/16
to drones-discuss
Hi Trond

It is quite possible DroneKit isn't thread safe. AFAIK we don't have any tests to prove it either way. That said, we'd like it to be, so if you have a reproducable test case, please create a gist and raise an issue https://github.com/issues with it linked.

Thanks!

Regards
Hamish

Hamish Willee

unread,
Mar 1, 2016, 5:08:44 PM3/1/16
to drones-discuss

--
You received this message because you are subscribed to a topic in the Google Groups "drones-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/drones-discuss/PvgF7AiYLmI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to drones-discus...@googlegroups.com.

Trond Hindenes

unread,
Mar 1, 2016, 5:30:37 PM3/1/16
to drones-discuss
Cool, I'll try and deconstruct my code into something reproduceable that uses threading.

Basically, I have a main thread which passes queue messages to a "runner" thread which does most of the dronekit interaction. One exception is "real-time" velocity inputs which are handled by a third thread and gets passed the vehicle object from the second thread as input. This worked mostly well (I thought), but as I mentioned caused problems with arming/mode change and also the weird missionplanner-related message flooding.

I changed the code so that I only spin up the third thread only when airborne and only when I'm in a situation where I need real-time velocity inputs, everything seems to be working fine now.

Anyhow, I'll try and create some gist-able code. 

Hamish Willee

unread,
Mar 1, 2016, 5:44:50 PM3/1/16
to drones-discuss
HI Trond

The missionplanner issues may (partially) due to https://github.com/dronekit/dronekit-python/pull/585 - in essence we don't properly filter the messages that are from our connected vehicle. In theory this is OK since a broadcast message on the network should go to everyone, but in practice the heartbeat from mission planner contains mode, and this is being used to reset our stored vehicle mode. 

Regards
H
Reply all
Reply to author
Forward
0 new messages