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?