In this lesson we will cover how to use DroneBlocks and Tello to navigate in a box pattern. In the navigation block, "fly" commands are useful to navigate Tello in three dimensions. We will approach this mission using two different techniques: one mission that keeps the nose of the drone pointed forward and another that uses "yaw" blocks to direct the nose of the drone in the direction of flight. These flight concepts are useful to understand when learning to program more complex missions.
We will use two different techniques to fly in a box pattern. In the first mission we will keep the nose of the drone pointed forward. Figure 1 demonstrates this concept. The magenta icon represents our drone with the nose pointed forward. The turquoise line represents the direction of flight.
The takeoff location represents the start of the mission. Now we will create our DroneBlocks mission to generate the box pattern.
Figure 1
Use any distance that is applicable for your flying space. For best results you should run the box mission indoors with minimal wind. Launch the mission and observe the results.
Another version of the box mission is to use the "yaw" block. Yawing is the aeronautical term for rotating about a vertical axis. In the "Hello Tello" mission you used the yaw block to turn the Tello 360 degrees.
Figure 2 shows an example of our block code.
Figure 3 shows the script written in Java Script which is a general purpose coding language. To view the general purpose code click the 'stacked pancake symbol' 3 horizontal lines in the top right corner of Droneblocks and select show code.
Figure 3 Box mission written in General purpose language
You can see that the mission starts similarly to the previous one, but the nose of the aircraft points in the direction of flight for each side of the box. The code for this mission can be seen in Figure 4.
Figure 4 shows the box mission where at each corner we will yaw 90 degrees to the right. Notice how each magenta arrow turns, or yaws, in the direction of flight.
Visually look at each block and gain an understanding of what this mission accomplishes. It is always a good idea to perform a code review before launching a new mission. Launch your mission and observe how the flight pattern differs from the original box mission.
Figure 5 Box mission using yaw right general purpose code