Instructional Material: Retrieving Drone Status Information Automatically

Printer-friendly version

In the last example, the program explicitly retrieved the status information available from the drone by calling methods on the TelloControl class. These methods send commands to the drone which request an information item, receive the reply, then return the information to the caller (and also store it in the TelloDrone class instance).

As it turns out, the Tello automatically broadcasts most of this information on the network on a regular and rapid basis. The TelloControl class contains a method called StartStatusMonitor(). Calling this method creates a background thread which monitors the network for this status information feed. When this thread receives an update, it stores the information in the TelloDrone class. Since this is done in a separate thread, the rest of the program can go about it's business. Using the status monitor means you don't have to issue commands for status information, you can simply get the most recent data by calling methods on the TelloDrone class.

The Demo2 example program demonstrates this. Modify the Main class by commenting out the code that runs Demo1 and uncommenting the lines that run Demo2. Take a look at the Demo2 code and then run it with the green arrow button.

 

Material Type: 
Lab Activity
Education Level: 
HW Platform: 
SW Platform: 
Interactivity Style: 
Audience: