Learn 3: 3-2-1-GoPiGO!

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

Your task is to program your robot to navigate an area of previously unseen terrain to reach its destination, passing through a number of waypoints.

1. On Your Marks..

Now that we’ve woken up our robot orienteer, let's tell it to move around. How about a little square dance?

Click on the Insert A Cell Below icon in your notebook to open up a second cell in your Jupyter Notebook.

Type the following code into it:
# trace the 1st side of the square    
orienteer.drive_cm(50)
    
# rotate clockwise 90 degrees    
orienteer.turn_degrees(90)
    
# pause for 1 second    
time.sleep(1)    

# repeat the same actions for the 2nd side of the square    
orienteer.drive_cm(50)    
orienteer.turn_degrees(90)    
time.sleep(1)  
  
# repeat the same actions for the 3rd side of the square    
orienteer.drive_cm(50)     
orienteer.turn_degrees(90)    
time.sleep(1)  
  
# repeat the same actions for the 4th side of the square    
orienteer.drive_cm(50)     
orienteer.turn_degrees(90)    
time.sleep(1)

WARNING: Before running any code, always remember to place your robot on the floor. Forget to do this and you may turn your robot into a no-bot!


NOTE: The # characters are known as comment marks. These tell the robot to ignore everything on the same line that comes afterwards. Robots don’t read the text that follows. Only humans do. This allows us to write notes to ourselves and other people to explain what each line of code is doing. Good comments make code much more readable and understandable for both ourselves and other people.