PA Designer Learn 1: The Notebook

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

Your task is to program your robot to alert a person with a hearing impairment to visiting house guests.

Learn how to use the Loudness Sensor alongside Jupyter Notebooks.

3. The Template Notebook

The assistant.ipynb notebook contains the following code cells. Some of them are pre-populated for your convenience, some are empty.

You will be writing the code for the empty cells.

Robot Setup Code

In challenge 1 you learned how to create an instance of the EasyGoPiGo3 class and name it. To give you a bit of practice, we’ll ask you to do the same again here.

Template Functions

You have been have provided with some pre-written functions. These will allow you to perform some of the challenge-related tasks without having to know precisely how they work. A description of these functions, along with some example usage, is provided in the markdown cells within the notebook.

Sensor Setup Code

In this challenge you will learn how to use our first GoPiGo3 add-ons; a loudness sensor and an LED. In this cell you will create instances of these objects and tell our code which ports you have plugged them in to so you can listen for the bell and light up the LED. Later in the LEARN section you will get some help to write the code for this cell.

Variable Initialization

You have been provided with a cell with an empty init() function where you can declare all your program’s variables and give them sensible starting values. This is known as initialization.

Why initialize? 

Imagine you are playing your favorite computer game and it ends because you lost your final life. What do you think would happen if you started a new game and your life counter was not reset? Be wise. Initialize!

Main Loop

This is the cell where you will write your challenge code.

Data Analysis

Data analysis is the process of interpreting the meaning of the data you have collected in a table, bar chart, line graph, or other visual representation. You can use this cell to pass any data you have collected to a graph drawing function that have been written for you.

You can also display graphs from within the Main Code cell. However, putting the graph drawing code in its own cell makes it optional. If you want to see a graph after running the Main Code cell you simply select the Data Analysis cell and click on Run Selected Code. This is one of the great things about Jupyter Notebooks.

Tags: