Learn 3: Create Your First Class

This is the fifth challenge within the Robotics with GoPiGo and Python Curriculum.

Your task is to design a robot program to deliver a selection of mail to the residents of GoPiGo Drive, a small cul-de-sac containing 3 houses.

Learn how to how to use and calibrate the color sensor.

3. Variable Container Init()

Let’s show you how to do this with the simple test functions that you have written.

In the Variable Container Class cell we have created a basic class definition for you and called this our GlobalVariables class. It already contains some attribute definitions. These are attributes that will be set by the notebook’s template functions and buttons.

There is also an empty  __init__(self ) function definition. __init__(  ) is a special function, known as the constructor method. The code it contains is automatically run whenever an object of the class is instantiated. We do not need it but it's handy to see the print statement when we instantiate it.