In this chapter, we will write Python code to control a drone with MQTT messages. We will write code that will be able to run on different popular IoT platforms. We will:
Understand the requirements to control a drone with MQTT
Define the topics and commands to control a drone
Install paho-mqtt for Python
Connect the client to the MQTT server with Python
Understand callbacks
Subscribe to topics with Python
Create a class to represent a drone
Receive messages with Python
Process commands with Python
Work with the network loop with Python
Send messages with Python