Instructional Material: Fly a Square Pattern

Printer-friendly version

Now lets do something more complicated. Lets fly a mission that requires the drone to travel in a square pattern ending up where it started. Examine the code for the FlySquare class.

This class is like the others we have looked at. It uses a Java for loop to execute a set of movements 4 times. We fly forward, turn 90 degrees. Then we repeat until we have flown in a square.

We also introduce a feature of the TelloCamera class. Updating the video feed status area with drone status information gets repetitive and updating rapidly can be a problem to integrate into our flying code. To help with this, The TelloCamera.setStatusBar() method will accept the name of some other method in our code. That method will be called when each image of the video stream is processed. That method (which you write) should return a string containing whatever text you want displayed on the feed. This gets the feed updated rapidly in the background, and we don't have to figure out where in our flying code to do it.

Modify the Main class to run the FlySquare class and try it out.

You will notice that the drone flys a nice square on some flights and not others. There are several reasons for this. Drone battery level will effect the flight movements. Air currents can as well. Also, the forward/backward movements and hover position hold by the drone are measured by the drone's downward facing cameras (Vision Positioning System). These cameras do station keeping and distance measurement by watching the ground. The lighting and texture of the ground will influence how accurate the drone movements are. The Tello has no GPS capability so watching the ground is a substitute and may not be that accurate in some cases.

 

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