"No module named dronekit"

Hello all, I am trying to run a python script when connected to the flight computer, but the problem is that Mission Planner says “No module named dronekit” even though I pip installed dronekit in my command prompt.

Photo:
Capture

Thank you.

Since MP ships with a compiled copy of IronPython, I don’t know if you can import modules outside of the standard IronPython library. This question from Stackoverflow has some information about how to import another dll into IronPython, but I am not sure if that would work when going this direction. It also looks like there are some other forum posts trying to do something similar.

I’m curious what you are wanting to do with dronekit in a MP script. The vehicle state is already available through the environment the MP creates. Guessing from your script name you are testing making a connection to a vehicle, but that is usually done by clicking Connect in the MP UI.

I know, but it goes even further than that, I am just doing a connection testing to see if missionplanner works with a python script. I am planning to use a python script to control the drone autonomously. I have seen the same happen with lua scripts.

MP does use Python scripts of the IronPython variety and can do a lot of things, including sending MAVLink commands, without dronekit. Take a look that the example scripts that ship with MP here.

ArduPilot supports Lua scripting on board the autopilot (meaning independent of the GCS). You can read more about that feature here.

You can also use dronekit along side MP to send/receive MAVLink data, but that is separate from ArduPilot Lua or MP Python.

Ok, and how can I use dronekit along side MP to send/receive MAVLink data? I tried the Dronekit-SITL thing, but that is not what I want.

Using dronekit alongside the GCS would be similar to what is shown in the dronekit SITL demo. Rather than have MAVProxy connect to a virtual instance of ArduPilot, you can connect to a vehicle using the interface name.

From the MAVProxy docs the command would look similar to mavproxy --master=COM14 --out 127.0.0.1:14550

Oh yeah. One thing I want to do the same. Connecting to the physical flight computer instead of dronekit-sitl, but instead, is there a way to connect with TCP port instead of the mavproxy udp?