Mavproxy.py works, dronekit fails


#1

I’ve built a PiHawk drone and have successfully installed python2, MAVProxy, and dronekit on my Raspberry Pi. The Pi is configured send commands to the PixHawk over the UART which is accessible as /dev/ttyAMA0. I can quickly switch the Pi back and forth from being an ad-hoc wireless network access point (for controlling the drone through code running on the Pi) or being a wireless client (to download and install software).

When I SSH into the Pi and run the mavproxy.py script, everything works. I can arm the drone, tell it to takeoff, and land it again. The commands that I use are shown here:
  $ mavproxy.py --master=/dev/ttyAMA0
  STABILIZE> mode GUIDED
  GUIDED> arm throttle
  GUIDED> takeoff 1
  GUIDED> mode LAND

The drone responds immediately and correctly.

But when I try to connect to the drone via dronekit, I use the following connection string but the connection times out with a heartbeat error. Here is my connection line and the response:
  >>> vehicle = connect("/dev/ttyAMA0", wait_ready=True, baud=9600)
  WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds

Thank you for the help.

Also… is there a command to quit mavproxy.py without having to ctrl+c?


#2

The baudrate might not match what has been configured. Try 115200 or look in Mission Planner CONFIG at the SERIALx_BAUD what is shown. Or while in mavproxy, use the command

param show SERIALx_BAUD

for the serial port used. Let me know what you get.

Ctrl+C is the only way I know to quit. Is there a problem using that?


#3

Thanks Jax… 57600 it was. I would have insisted that I had previously tried that value. For a while I was running on python3 before reading that Dronekit required python2. Maybe I tried 57600 with python3 and forgot to try it again with python2. My mistake, thanks so much for the help.

Ctrl+C is fine if that’s the way to do it, but sometimes there is cleanup code that gets skipped with a SIGABORT signal.

Thanks again for such a quick and spot-on answer.