Rescuer Learn 2: Installing the Distance Sensors
This is the third challenge within the Robotics with GoPiGo and Python Curriculum.
Your task is to design a robot program that can navigate through the maze-like jungle without trampling over any plants or getting stuck in any dead ends.
Learn how to use the Distance Sensor and practice using the left-hand rule of maze-solving.
2. Code: Creating Instances
You are now ready to create instances of the left-facing and front-facing distance sensors in our code.
They will be named them distance_left and distance_front for ease of reference later on.
- Type the following code into the Sensor Setup Code cell in the template notebook you have just opened.
- Select the Sensor Setup Code cell
- Click on Run Selected Cell.
If your robot’s eyes light up you can skip over the debug section below. However, before moving on, why not try breaking your sensor setup code by changing just one thing to see what happens? Use the debug section as inspiration for what you could change.
After each code-breaking experiment remember to fix your code, and prove that it is fixed by getting the eyes to light up once more, before moving on.
Do you see the eyes light up? If you do, great. Otherwise, read on…