Andrew Tridgell's Posts (61)

Sort by
Developer

Python MAVLink interface (version 0.2)

mavlink-logo.png?w=400

 

For those of you who prefer a scripting language for your MAVLink needs, you may like to have a look at pymavlink, a Python implementation of the MAVLink protocol.I've just released version 0.2, which fixes some bugs, and adds support for the latest changes in the upstream mavlink git repository.

I initially wrote pymavlink to make it easier to develop MAVProxy, a little command line tool which provides a proxy between a MAVLink master and some number of slaves. I use this for a HIL setup between FlightGear, APM and qgroundcontrol. I'm releasing it more widely as I'm hoping it will be more generally useful to the diydrones community. It can be used to write little scripts that manipulate and display MAVLink messages in interesting ways.

The way pymavlink works is that you generate a custom mavlink python module using mavgen.py, which reads a set of MAVLink message definition files in their XML format, and spits out a ready to use python module that implements all the messages in the XML files.

A good example of what can be done with a short script is mavlogdump.py, which formats a qgroundcontrol MAVLink log file in a human readable manner. This really shows the advantage of using a scripting language for MAVLink, as it can easily display structures without having to write a lot of formatting code for each of the messaging types.

For our UAV project we are planning on using sets of python scripts with pymavlink to do things like mission planning, log analysis, camera control, image processing etc.

If you want to ask questions about pymavlink, it is probably best to join the mavlink mailing list.

 

Read more…