Uncategorized

How Does PyMAVLink Fit Into the MAVLink Software Stack?

You’re here because you have a specific question about open source drones, and you want to know what pymavlink is. 

Well, to understand what pymavlink is, we first must zoom out to get some perspective. 

You’ll notice at the bottom of this diagram is MAVLink. This is the foundation upon which some higher level APIs are built on. We won’t take a deep dive on MAVLink here, but here’s a fun ELI5 example. 

What is the English language? It is an idea. A method of communication. But that method of communication can be expressed in a thousand different ways. A pen and paper, two thumbs texting on a phone, chalk on a chalkboard, and obviously audibly speaking the language. 

Well, in the ArduPilot world, MAVLink is the communication method. It gives us a standardized ‘language’ to communicate with the flight controller. 

Let’s say we wanted to arm the drone and make its motors start spinning. There is a MAVLink message for that. This could be sent from a phone, a desktop GCS, or even a python script. 

Ah, what is that last part? Okay, now lets start talking about pymavlink. 

What is PyMAVLink?

PyMAVLink is the MAVLink catalog of messages encoded in the python programming language. 

Remember, MAVLink is agnostic to the programming language. It is just a communication protocol, so it can be encoded in ANY programming language. PyMAVLink gives us a programmatic interface into controlling the robot, so we can control the robot in python scripts. 

PyMAVLink is the rosetta stone that MAVProxy and even python-dronekit are built on top off. You may be unaware of this package, because the pip python package handler automatically installs PyMAVLink if MAVProxy or Dronekit is installed. 

If you want to learn more about this ArduPilot software stack, read more here. 

Leave a Reply