Skip to content

Dronekit

LPRDev1 edited this page May 30, 2016 · 7 revisions

Dronekit will be used to handle the communications between the raspberrypi and the APM 2.0 module. It provides the provides an API that allows the raspberry pi (referred to as a "Companion Computer") to use the mav-link protocol to communicate with the ardupilot software running on the APM 2.0.

Dronekit installation on the Raspberry Pi: (from droneapi-tutorial). Note that apt-get install python-pip had a broken version of pip so a alternative version was installed via curl:

sudo apt-get update 
sudo apt-get install python-numpy python-opencv python-serial python-pyparsing python-wxgtk2.8 python-dev
sudo curl https://bootstrap.pypa.io/get-pip.py | sudo python
sudo pip install dronekit
sudo pip install dronekit-sitl

A small micro USB to USB cable was placed between the RaspberryPi and the APM 2.6 module. We noted that the device mapped to /dev/ttyACM0 and not /dev/ttyUSB0 as shown in most examples. ttyACM0 implies a serial port, so use a baud rate of 115200 (if needed). Note the snippet below uses /dev/ttyACM0.

To test the connection between the pi and the APM 2.6 module the following python file (dronekit_init.py) was created:

from dronekit import connect
vehicle = connect('/dev/ttyACM0',wait_ready=True)
print " System status: %s" % vehicle.system_status.state

running the python code:

$ python dronekit_init.py

>>> Calibrating barometer
>>> Warming up ADC...
>>> <startup_ground> GROUND START
>>> Beginning INS calibration; do not move vehicle
>>> Initialising APM...
>>>
>>>  Ready to drive.
>>> ArduRover v2.50 (90838f67)
>>> init home
>>> init home
>>> Reached Destination
>>> command received:
>>> command received:
>>> command received:
 System status: UNINIT

Useful references

Clone this wiki locally