Build a Self Driving Car With the GoPiGo3

4. Program the GoPiGo3 to Handle an Intersection

There are two things our self-driving car needs to be able to do that are not easy! The first is to make a turn at an intersection. The second is to find a destination. In this step, we are going to try out both things.

Turning at an Intersection

In the example code in Bloxter, we can see that the robot is going to follow the line using the line follower block. It will follow until the line follower reads all black. This happens when the line follower drives over the intersecting road.


Next, we will put the wheels on the intersecting road. We drive forward the same distance we measured in the last step, 7 cm.

And then we turn 90 degrees to the right or left. In this example, we turn 90 degrees left.

Stopping at Destination

The last block will drive until we hit an intersection. We can see that we follow the line until the line follower reads all black. Once the line sensor rolls over the destination "T" it should stop.