Snap Mission 4: Roulette
This mission is to fly the CoDrone from one location to another, but the user will need to time their movements with the cycle of directions. As they are flying, a program is cycling through the directions the CoDrone will move. Every time they press a key, the CoDrone will move in the direction that program selected.

Neutral above studio shot

Summary

We can move the CoDrone in four main directions, pitch forward, pitch backwards, roll right, and roll left. So we will need to create a program that will cycle through 4 options forever and to give us an idea of which one it is doing, we will have it play a different sound each time.

This program will do that part.

We use the variable named choice to keep track of which direction the CoDrone will go. As we go through the forever loop we add one to choice each time. Then we perform a check to make sure that we do not go past the number of choices we want to have. Since we can move in four directions for this challenge (left, right, forward, backward) we need four choices (0, 1, 2, 3), so if the choice is greater than 3 we will set it to 0. This keep the choice cycling from 0 to 3. Then each time it cycles we play a different note to allow you to hear the different choices. When choice is 0, the note will be 50, then for 1 it is 55, and so on until 3 which is 65.

Now that we can cycle through choices and have audio feedback on which direction it is going to go, we can add in the code to move in the proper directions.

We take off and then enter the loop. Each time through the loop we wait for the buttons to be pressed then check which choice is currently selected. Each choice has it own direction to move the CoDrone. It sets the movement values in the if statements then at the end of them all it sends the command and waits one second. Then it stops all movement and waits for the button to be pressed again.

Full code:

How to play:

  1. Setup
    • Setup a starting zone and a target area (going through a door way works well).  The competitors will attempt to take off from the starting zone and attempt to make it to the target zone using only the the roulette code.
  2. Begin
    • Begin by placing the CoDrone in the starting zone.  When the player is ready, they can start the code.
  3. Timing
    • Keep your finger ready to press the key. Listen for the different sounds and try to figure out which sound is each direction. Try to make it to the target area.

Rules

  • Multiple players will alternate turns
  • All parts of the CoDrone must be within the target zone for it to count
  • Each contestant gets a set time to complete the challenge
  • First one to successfully land in the landing zone wins

 

Customization

There can be multiple variations of this mission ranging in difficulty.  A few variations will include:

  • A hoop or tunnel to fly through to get to the target area
  • Obstacles to move around to get there
  • Lower the time of choice loop so that you have less time to select the movement before it changes
  • Add in more movements choices (throttle and yaw can be easily added)

The kill-switch can be used to stop and restart, but you cannot touch the CoDrone during your run.