Mission Instructions

Your mission is to create a robot that can explore remote, narrow canyons. First, you will create a sample canyon system with both a left and right turn. Then you will design, test, and refine your robot until it can navigate the canyon system independently.

3. Pre-Code: A Simple Corner

Let’s try turning a simple corner first. 

We need to evaluate how the robot can successfully make a turn. After all, humans have brains that auto-magically calculate how we go through an open door, but not robots.

Try the following code to go around a cardboard box:


What happened? Did the robot hit the box? Can you think of better ways to handle corners?  

Here are a couple of options to try and questions to answer:

        1. Does turning behave better than spinning?

        2. Which requires a wider corridor, the spin or the turn? Will your canyon system be wide enough for either of those, or do you need to choose the tighter turn?
        3. Should the robot drive forward a couple of inches and then spin (or turn)? 
        4. Maybe the side distance sensor should be moved elsewhere on the robot? Closer to the back or just above the wheel? 

Try different scenarios until you are happy with the way your robot handles the corner. 

Remember that robots process extremely quickly. So the moment a Distance Sensor detects an opening to the left of the robot, it will start to turn.  BUT your robot might need to drive forward for a couple more inches so it doesn’t run into the wall.  Since every canyon system is different, you’ll need to figure out what works for you!


Make It a Function

Once you are happy with your robot’s simple corner program, turn it into a custom function that you can use later. You’ve done this before in Mission 08, so look there if you need a reminder. 

It will be most helpful if you name your function something very specific.  In your Simple Corner Test, did your robot turn left or turn right? That answer should be in the name: To {Turn Left}.