Snap Lesson 5: Flight Movements part 3
In this lesson we will learn how to precisely maneuver our CoDrone.

Copy of IMG_9828

 The next problem we need to look at is momentum. When the drone is moving in one direction and you try to switch directions mid-flight, it does not stop and make a sudden switch in direction. It is just like if you run full speed forward, you can not quickly run backwards. With the CoDrone it can easily be seen in the following code:

 

Looking at the program one would expect it to takeoff, fly forwards, then fly to the right, and finally land. However if we would run it when it went to go sideways it would move in a curve, not a sharp change in direction. Now sometimes this might be fine, but imagine you are trying to fly in a tight hallway and need to make a sharp corner. To fix this we will add a step in that will slow the CoDrone down before it changes direction.


By having the CoDrone use a high negative pitch it will slow down quickly, so that is why we have such a short delay. You may need to adjust the speed and time of the slow down, the goal is to have the CoDrone almost stopped before it goes sideways. This way since it is not moving forward, when it moves sideways the CoDrone will not curve, but make a sharp movement.

We can use this code to complete the challenge below.

Activity: Figure-Eight

Using our precise movement code create a program that moves the CoDrone in a figure-eight

Challenge Rules:

  1. Move in a figure-eight shape in the air
  2. Make it a “digital” figure-eight, that is rather than being curved have it move in straight lines to make a more “digital” looking 8 (see picture below)