Dronekit 2022, not quite getting it

I’m trying to utilize dronekit, especially since it is included and “built in” to the RPi build, but I cannot get it to work. Is this still the best thing to use or are there better options to run mission scripts?

I get invalid syntax errors when I try to get vehicle status. Not sure what I’m doing wrong or what setups I missed.

initial

Hi Scott,

DroneKit configuration isn’t the easiest one and usually requires some programming skills. That’s why I’d recommend using pre-installed tools like ArduPilot autopilot to control a drone instead.

But if you want to figure out how to work with DroneKit, I suggest checking out its official docs as it contains the most necessary info. You can also search through the issues on GitHub to check whether anyone has already got the same question.

Thank you, those are good links with good info.

The biggest selling point for the Navio2 was it’s hook up to the RPi. Being able to ssh remote into the Pi, and execute a script to control drone via the Navio2 was the only reason I bought it. This seems like something I should be able to do but I have not yet been able to.

I see successful examples of running a command on the Pi like:

mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600

But it never works for the Navio2. I have been able to run the following on a Windows machine CMD window:

C:>mavproxy.py --master=COM4 --baudrate=57600 --out 192.168.1.108:14550

And then open another window to execute a script on the Navio2 using:

C:> python vehicle_status.py --connect 192.168.1.108:14550

But that is a lot of “moving parts” and a seemingly very round about way to run a script on a Pi.

Is it simply not possible to use the serial connection between Pi and Navio2 to run command scripts remotely?

Hi Scott,

I was able to successfully run the vehicle_state.py example with the default settings for ArduPilot. The command python vehicle_state.py --connect udp:127.0.0.1:14550 works fine. I see from your screenshots in the beginning that you use tcp with the IP address when it’s udp in the parameters of ArduCopter. It looks like the cause of an error.

Thanks for exploring this. I’ve tried (I thought) every combination I could. I’ll try this one.

Some research points to there being an issue with the Pi 3 because of the way the serial port is used. I’ve gotten a Pi 2, and I’ll try with that as well.

Thanks again and I’ll update with my results.

I tried a few things, including your suggestion and nothing ever worked. I kept getting “Invalid syntax” errors when I would run the example.

So - I started over. I re-formatted an SD card with a fresh copy of the Emlid Raspberry Pi OS Buster.

The dronekit examples worked perfectly on both a Pi 2 and a Pi 3.

I tried to copy over my existing configuration from /opt/ardupilot/navio2/arducopter-4.0/bin - the dronekit script still worked but there were all kinds of errors.

When I returned the “fresh” unconfigured arducopter file, the errors went away. I’m guessing the updated versions (past 4.0.3) have changes that aren’t compatible with dronekit.

So…I have to re-configure the hardware.

Hi Scott,

Thanks for sharing the updates with me.

It’s quite hard to identify why DroneKit throws errors with the non-default configuration. There can be many different things affecting the output of the DroneKit programs; maybe the settings you’re using don’t align with the code. Still, it’s better to look into the source code when the program doesn’t work. Many contributors are maintaining the project and changing the code. They can change something, which can cause errors from the other side.

Hi Liudmila,

I figured out the issue. There is a dist-package called “protobuf” from google (version 3.18.0) I uninstalled that package and installed a version (3.12.2) that was close to the release date of the Emlid Pi image.

Works.

Thank you for you help!!

1 Like